IoT::Devices

class Switch

File Information

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

Description

The base class for switchable things (that can be turned on and off).

A Switch has a current state and a target state. Depending upon the implementation, the current state and target state may be different for a short amount of time (e.g., while the device is powering on).

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

  • displayState (string, optional): The current state of the Switch, formatted as string for display purposes.

Inheritance

Direct Base Classes: Device

All Base Classes: Device

Member Summary

Member Functions: getTargetState, setTargetState, state

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

Constructors

Switch

Switch();

Creates the Switch.

Destructor

~Switch virtual

~Switch();

Destroys the Switch.

Member Functions

getTargetState virtual

virtual bool getTargetState() const = 0;

Returns the target state of the Switch.

setTargetState virtual

virtual void setTargetState(
    bool newState
) = 0;

Sets the target state of the Switch.

state virtual

virtual bool state() const = 0;

Returns the current state of the Switch.

Variables

stateChanged

Poco::BasicEvent < const bool > stateChanged;

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