IoT::Devices

class CounterDatapoint

File Information

Library: IoT/Devices
Package: Datapoints
Header: IoT/Devices/CounterDatapoint.h

Description

The base class for datapoints holding a counter (a 64-bit unsigned integer).

In addition to the methods defined in this interface, a CounterDatapoint implementation should expose the following properties:

  • displayValue (string, optional): The current value of the datapoint, formatted as string for display purposes.

Inheritance

Direct Base Classes: Datapoint

All Base Classes: Datapoint, Device

Member Summary

Member Functions: increment, reset, validValue, value

Inherited Functions: getFeature, getPropertyBool, getPropertyDouble, getPropertyInt, getPropertyInt16, getPropertyInt64, getPropertyString, getPropertyTimestamp, hasFeature, hasProperty, invalidate, setFeature, setPropertyBool, setPropertyDouble, setPropertyInt, setPropertyInt16, setPropertyInt64, setPropertyString, setPropertyTimestamp, valid

Types Aliases

CounterType

using CounterType = Poco::Int64;

Constructors

CounterDatapoint

CounterDatapoint();

Creates the CounterDatapoint.

Destructor

~CounterDatapoint virtual

~CounterDatapoint();

Destroys the CounterDatapoint.

Member Functions

increment virtual

virtual CounterType increment(
    CounterType delta = 1
) = 0;

Updates the counter and returns the new value.

Not all CounterDatapoint implementations may support this method.

reset virtual

virtual CounterType reset(
    CounterType value = 0
) = 0;

Resets the counter to zero or the given value and returns the previous value. Also makes the datapoint valid.

Not all CounterDatapoint implementations may support this method.

validValue virtual

virtual Poco::Optional < CounterType > validValue() const = 0;

Returns the current value of the datapoint if it is valid, otherwise an empty value.

value virtual

virtual CounterType value() const = 0;

Returns the current value of the datapoint, even if the datapoint has been invalidated.

Use validValue() to get a valid value only.

Variables

validated

Poco::BasicEvent < const CounterType > validated;

Fired when an invalid datapoint becomes valid again, by being updated with a new value. The new valud is given as event argument.

valueChanged

Poco::BasicEvent < const CounterType > valueChanged;

Fired when the value of the datapoint has changed.

Actual behavior of this event (e.g., minimum interval between fires) are implementation specific and can be configured via properties.

Securely control IoT edge devices from anywhere   Connect a Device