IoT::Devices

class EnumDatapoint

File Information

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

Description

The base class for datapoints holding an enumeration value (based on an int).

An implementation should handle conversion between an integer value and the corresponding symbolic name.

In addition to the methods defined in this interface, a EnumDatapoint 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: definedValues, stringValue, update, updateString, validStringValue, validValue, value

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

Constructors

EnumDatapoint

EnumDatapoint();

Creates the EnumDatapoint.

Destructor

~EnumDatapoint virtual

~EnumDatapoint();

Destroys the EnumDatapoint.

Member Functions

definedValues virtual

virtual std::vector < EnumValue > definedValues() const = 0;

Returns a vector containing the possible values and mappings to symbolic names.

stringValue virtual

virtual std::string stringValue() const = 0;

Returns the symbolic name corresponding to the datapoint's current value, even if the datapoint has been invalidated.

Use validStringValue() to get a valid value only.

update virtual

virtual void update(
    int value
) = 0;

Updates the value of the enumeration.

Throws a Poco::InvalidArgumentException if the given value is not in the range of defined values.

updateString virtual

virtual void updateString(
    const std::string & symbolicName
) = 0;

Updates the value of the enumeration from the given symbolic name.

Throws a Poco::InvalidArgumentException if the given symbolicName is not in the range of defined values and their symbolic names.

validStringValue virtual

virtual Poco::Optional < std::string > validStringValue() const = 0;

Returns the symbolic name corresponding to the datapoint's current value if the datapoint is valid, otherwise an empty value.

validValue virtual

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

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

value virtual

virtual int value() const = 0;

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

Use validValue() to get a valid value only.

Variables

validated

Poco::BasicEvent < const int > 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 int > valueChanged;

Fired when the value of the datapoint has changed.

valueUpdated

Poco::BasicEvent < const int > valueUpdated;

Fired when the value of the datapoint has been updated by calling update(). This event is also fired if the actual value has not changed.

Securely control IoT edge devices from anywhere   Connect a Device