IoT::Devices

class IDevice

File Information

Library: IoT/Devices
Package: Generated
Header: IoT/Devices/IDevice.h

Description

The base class for all devices and sensors.

This class defines a generic interface for setting and querying device properties and features.

The class also defines an event for notifications about changes to the device status.

Every implementation of Device should expose the following properties:

  • symbolicName: A name in reverse DNS notation that identifies the specific implementation of the device type.
  • type (string): A name in reverse DNS notation that identifies the generic device type (e.g., "io.macchina.serial").
  • name (string): A human-readable device type (e.g., "Serial Port").
  • status (int): Current device status (DeviceStatus); optional.

The following generic device types are currently defined:

Inheritance

Direct Base Classes: Poco::OSP::Service

All Base Classes: Poco::OSP::Service, Poco::RefCountedObject

Known Derived Classes: ScalarDatapointRemoteObject, SensorRemoteObject, IDatapoint, CameraRemoteObject, BooleanSensorRemoteObject, CompositeRemoteObject, CounterRemoteObject, FlagsDatapointRemoteObject, EnumDatapointRemoteObject, IBooleanSensor, IComposite, ICounterDatapoint, IEnumDatapoint, IGNSSSensor, IIO, IORemoteObject, IRotaryEncoder, IStringDatapoint, LEDRemoteObject, ISwitch, ITrigger, RotaryEncoderRemoteObject, GNSSSensorRemoteObject, IBooleanDatapoint, ICounter, SerialDeviceRemoteObject, BarcodeReaderRemoteObject, IAccelerometer, ICamera, IGyroscope, IFlagsDatapoint, ILED, ISensor, IVectorDatapoint, StringDatapointRemoteObject, VectorDatapointRemoteObject, AccelerometerRemoteObject, BooleanDatapointRemoteObject, CounterDatapointRemoteObject, DatapointRemoteObject, DeviceRemoteObject, GyroscopeRemoteObject, IBarcodeReader, IMagnetometer, IScalarDatapoint, ISerialDevice, MagnetometerRemoteObject, SwitchRemoteObject, TriggerRemoteObject

Member Summary

Member Functions: getFeature, getPropertyBool, getPropertyDouble, getPropertyInt, getPropertyInt16, getPropertyInt64, getPropertyString, getPropertyTimestamp, hasFeature, hasProperty, isA, remoting__enableEvents, remoting__typeId, setFeature, setPropertyBool, setPropertyDouble, setPropertyInt, setPropertyInt16, setPropertyInt64, setPropertyString, setPropertyTimestamp, type

Inherited Functions: duplicate, isA, referenceCount, release, type

Types Aliases

Ptr

using Ptr = Poco::AutoPtr < IDevice >;

Constructors

IDevice

IDevice();

Creates a IDevice.

Destructor

~IDevice virtual

virtual ~IDevice();

Destroys the IDevice.

Member Functions

getFeature virtual

virtual bool getFeature(
    const std::string & name
) const = 0;

Returns true if the feature with the given name is enabled, or false otherwise.

getPropertyBool virtual

virtual bool getPropertyBool(
    const std::string & name
) const = 0;

Returns the value of the device property with the given name.

Throws a Poco::NotFoundException if the property with the given name is unknown.

getPropertyDouble virtual

virtual double getPropertyDouble(
    const std::string & name
) const = 0;

Returns the value of the device property with the given name.

Throws a Poco::NotFoundException if the property with the given name is unknown.

getPropertyInt virtual

virtual int getPropertyInt(
    const std::string & name
) const = 0;

Returns the value of the device property with the given name.

Throws a Poco::NotFoundException if the property with the given name is unknown.

getPropertyInt16 virtual

virtual Poco::Int16 getPropertyInt16(
    const std::string & name
) const = 0;

Returns the value of the device property with the given name.

Throws a Poco::NotFoundException if the property with the given name is unknown.

getPropertyInt64 virtual

virtual Poco::Int64 getPropertyInt64(
    const std::string & name
) const = 0;

Returns the value of the device property with the given name.

Throws a Poco::NotFoundException if the property with the given name is unknown.

getPropertyString virtual

virtual std::string getPropertyString(
    const std::string & name
) const = 0;

Returns the value of the device property with the given name.

Throws a Poco::NotFoundException if the property with the given name is unknown.

getPropertyTimestamp virtual

virtual Poco::Timestamp getPropertyTimestamp(
    const std::string & name
) const = 0;

Returns the value of the device property with the given name.

Throws a Poco::NotFoundException if the property with the given name is unknown.

hasFeature virtual

virtual bool hasFeature(
    const std::string & name
) const = 0;

Returns true if the feature with the given name is known, or false otherwise.

hasProperty virtual

virtual bool hasProperty(
    const std::string & name
) const = 0;

Returns true if the property with the given name exists, or false otherwise.

isA virtual

bool isA(
    const std::type_info & otherType
) const;

Returns true if the class is a subclass of the class given by otherType.

remoting__enableEvents virtual

virtual std::string remoting__enableEvents(
    Poco::RemotingNG::Listener::Ptr pListener,
    bool enable = bool (true)
) = 0;

Enable or disable delivery of remote events.

The given Listener instance must implement the Poco::RemotingNG::EventListener interface, otherwise this method will fail with a RemotingException.

This method is only used with Proxy objects; calling this method on a RemoteObject will do nothing.

remoting__typeId static

static const Poco::RemotingNG::Identifiable::TypeId & remoting__typeId();

Returns the TypeId of the class.

setFeature virtual

virtual void setFeature(
    const std::string & name,
    bool enable
) = 0;

Enables or disables the feature with the given name.

Which features are supported is defined by the actual device implementation.

setPropertyBool virtual

virtual void setPropertyBool(
    const std::string & name,
    bool value
) = 0;

Sets a device property.

Which properties are supported is defined by the actual device implementation.

setPropertyDouble virtual

virtual void setPropertyDouble(
    const std::string & name,
    double value
) = 0;

Sets a device property.

Which properties are supported is defined by the actual device implementation.

setPropertyInt virtual

virtual void setPropertyInt(
    const std::string & name,
    int value
) = 0;

Sets a device property.

Which properties are supported is defined by the actual device implementation.

setPropertyInt16 virtual

virtual void setPropertyInt16(
    const std::string & name,
    Poco::Int16 value
) = 0;

Sets a device property.

Which properties are supported is defined by the actual device implementation.

setPropertyInt64 virtual

virtual void setPropertyInt64(
    const std::string & name,
    Poco::Int64 value
) = 0;

Sets a device property.

Which properties are supported is defined by the actual device implementation.

setPropertyString virtual

virtual void setPropertyString(
    const std::string & name,
    const std::string & value
) = 0;

Sets a device property.

Which properties are supported is defined by the actual device implementation.

setPropertyTimestamp virtual

virtual void setPropertyTimestamp(
    const std::string & name,
    Poco::Timestamp value
) = 0;

Sets a device property.

Which properties are supported is defined by the actual device implementation.

type virtual

const std::type_info & type() const;

Returns the type information for the object's class.

Variables

statusChanged

Poco::BasicEvent < const IoT::Devices::DeviceStatusChange > statusChanged;

Securely control IoT edge devices from anywhere   Connect a Device