IoT::Devices

class Composite

File Information

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

Description

A composite device consists of one or more sub devices or device fragments.

Composites are used to build hierarchies of devices, also known as device trees. This is intended to represent the hierarchical structure of a more complex device.

For example, for an electric vehicle, the (simplified) device tree may look like:

/ (root)
 Battery/
  Voltage
  Temperature
  ChargeLevel
 Motor/
   Switch
   PowerUsage
   RPM
   Temperature
   ...    
 ...

The DeviceTree class can be used to conveniently find a device in the tree.

Inheritance

Direct Base Classes: Device

All Base Classes: Device

Member Summary

Member Functions: fragmentByName, fragments

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

Constructors

Composite

Composite();

Creates the Composite.

Destructor

~Composite virtual

virtual ~Composite();

Destroys the Composite.

Member Functions

fragmentByName virtual

virtual Poco::Optional < std::string > fragmentByName(
    const std::string & nodeName
) const = 0;

Returns the device identifier of the direct sub device with the given node name (property "io.macchina.nodeName"), or an empty optional if no such device node exists.

Note: if multiple child nodes with the same node name exist, which of these nodes is returned is undefined.

fragments virtual

virtual std::vector < std::string > fragments() const = 0;

Returns a vector containing the device identifiers of all direct sub devices owned by this device.

Securely control IoT edge devices from anywhere   Connect a Device