IoT::Devices

class Sensor

File Information

Library: IoT/Devices
Package: Devices
Header: IoT/Devices/Sensor.h

Description

The base class for analog sensors, such as temperature or ambient light sensors.

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

  • physicalQuantity (string): The physical quantity that is being measured by the sensor, e.g. "temperature".
  • physicalUnit (string): The physical unit the measured value is being represented in (e.g. "Cel" for degree Celsius). This should use the "c/s" symbols from the Unified Code for Units of Measure (http://unitsofmeasure.org/ucum.html). See the PHYSICAL_UNIT_* strings for predefined values.
  • displayValue (string, optional): The current value of the sensor, formatted as string for display purposes.

Inheritance

Direct Base Classes: Device

All Base Classes: Device

Member Summary

Member Functions: clearValueChangedFilter, ready, setValueChangedHysteresisFilter, setValueChangedIsGreaterThanFilter, setValueChangedIsGreaterThanOrEqualToFilter, setValueChangedIsLessThanFilter, setValueChangedIsLessThanOrEqualToFilter, setValueChangedMinimumDeltaFilter, setValueChangedMinimumIntervalAndDeltaFilter, setValueChangedMinimumIntervalFilter, setValueChangedMinimumIntervalOrDeltaFilter, value

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

Constructors

Sensor

Sensor();

Creates the Sensor.

Destructor

~Sensor virtual

~Sensor();

Destroys the Sensor.

Member Functions

clearValueChangedFilter

void clearValueChangedFilter(
    const std::string & subscriberURI
);

Clears the filter set for the valueChanged event.

ready virtual

virtual bool ready() const = 0;

Returns true if a valid value is available.

setValueChangedHysteresisFilter

void setValueChangedHysteresisFilter(
    const std::string & subscriberURI,
    double lowerThreshold,
    double upperThreshold
);

Sets a Poco::RemotingNG::HysteresisFilter for the valueChanged event.

setValueChangedIsGreaterThanFilter

void setValueChangedIsGreaterThanFilter(
    const std::string & subscriberURI,
    double limit
);

Sets a Poco::RemotingNG::GreaterThanFilter for the valueChanged event.

setValueChangedIsGreaterThanOrEqualToFilter

void setValueChangedIsGreaterThanOrEqualToFilter(
    const std::string & subscriberURI,
    double limit
);

Sets a Poco::RemotingNG::GreaterThanFilter for the valueChanged event.

setValueChangedIsLessThanFilter

void setValueChangedIsLessThanFilter(
    const std::string & subscriberURI,
    double limit
);

Sets a Poco::RemotingNG::LessThanFilter for the valueChanged event.

setValueChangedIsLessThanOrEqualToFilter

void setValueChangedIsLessThanOrEqualToFilter(
    const std::string & subscriberURI,
    double limit
);

Sets a Poco::RemotingNG::LessThanOrEqualToFilter for the valueChanged event.

setValueChangedMinimumDeltaFilter

void setValueChangedMinimumDeltaFilter(
    const std::string & subscriberURI,
    double delta
);

Sets a Poco::RemotingNG::MinimumDeltaFilter for the valueChanged event.

setValueChangedMinimumIntervalAndDeltaFilter

void setValueChangedMinimumIntervalAndDeltaFilter(
    const std::string & subscriberURI,
    long milliseconds,
    double delta
);

Sets a Poco::RemotingNG::MinimumIntervalAndDeltaFilter for the valueChanged event.

setValueChangedMinimumIntervalFilter

void setValueChangedMinimumIntervalFilter(
    const std::string & subscriberURI,
    long milliseconds
);

Sets a Poco::RemotingNG::MinimumIntervalFilter for the valueChanged event.

setValueChangedMinimumIntervalOrDeltaFilter

void setValueChangedMinimumIntervalOrDeltaFilter(
    const std::string & subscriberURI,
    long milliseconds,
    double delta
);

Sets a Poco::RemotingNG::MinimumIntervalOrDeltaFilter for the valueChanged event.

value virtual

virtual double value() const = 0;

Returns the current value measured by the sensor.

Some sensors may not be able to immediately report a valid value. Therefore, before calling value() the first time, ready() should be called to check if a valid value is available.

Variables

PHYSICAL_UNIT_AMPERE static

static std::string PHYSICAL_UNIT_AMPERE;

PHYSICAL_UNIT_CANDELA static

static std::string PHYSICAL_UNIT_CANDELA;

PHYSICAL_UNIT_DEGREES_CELSIUS static

static std::string PHYSICAL_UNIT_DEGREES_CELSIUS;

PHYSICAL_UNIT_DEGREES_FAHRENHEIT static

static std::string PHYSICAL_UNIT_DEGREES_FAHRENHEIT;

PHYSICAL_UNIT_KELVIN static

static std::string PHYSICAL_UNIT_KELVIN;

PHYSICAL_UNIT_KILOGRAM static

static std::string PHYSICAL_UNIT_KILOGRAM;

PHYSICAL_UNIT_LUX static

static std::string PHYSICAL_UNIT_LUX;

PHYSICAL_UNIT_MBAR static

static std::string PHYSICAL_UNIT_MBAR;

PHYSICAL_UNIT_METER static

static std::string PHYSICAL_UNIT_METER;

PHYSICAL_UNIT_MOL static

static std::string PHYSICAL_UNIT_MOL;

PHYSICAL_UNIT_SECOND static

static std::string PHYSICAL_UNIT_SECOND;

PHYSICAL_UNIT_VOLT static

static std::string PHYSICAL_UNIT_VOLT;

valueChanged

Poco::BasicEvent < const double > valueChanged;

Fired when the state of the Sensor 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