IoT::Devices

template < class Super, class Sub >

class DeviceImpl

File Information

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

Description

A helper class for implementing device features and properties.

Inheritance

Direct Base Classes: Super

All Base Classes: Super

Member Summary

Member Functions: addFeature, addProperty, getFeature, getProperty, getPropertyBool, getPropertyDouble, getPropertyInt, getPropertyInt16, getPropertyInt64, getPropertyString, getPropertyTimestamp, hasFeature, hasProperty, lock, setFeature, setProperty, setPropertyBool, setPropertyDouble, setPropertyInt, setPropertyInt16, setPropertyInt64, setPropertyString, setPropertyTimestamp, unlock

Nested Classes

struct Feature protected

 

struct Property protected

 

class ScopedLock protected

 

Types

Poco::Any

typedef Poco::Any (Sub::* PropertyGetter)(const std::string &)const;

The getter method for a property.

bool

typedef bool (Sub::* FeatureGetter)(const std::string &)const;

The getter method for a feature.

void

typedef void (Sub::* FeatureSetter)(const std::string &, bool);

The setter method for a feature.

void

typedef void (Sub::* PropertySetter)(const std::string &, const Poco::Any &);

The setter method for a property.

Types Aliases

FeatureMap protected

using FeatureMap = std::map < std::string, Feature >;

PropertyMap protected

using PropertyMap = std::map < std::string, Property >;

Member Functions

getFeature inline

bool getFeature(
    const std::string & name
) const;

getProperty inline

Poco::Any getProperty(
    const std::string & name
) const;

getPropertyBool inline

bool getPropertyBool(
    const std::string & name
) const;

getPropertyDouble inline

double getPropertyDouble(
    const std::string & name
) const;

getPropertyInt inline

int getPropertyInt(
    const std::string & name
) const;

getPropertyInt16 inline

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

getPropertyInt64 inline

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

getPropertyString inline

std::string getPropertyString(
    const std::string & name
) const;

getPropertyTimestamp inline

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

hasFeature inline

bool hasFeature(
    const std::string & name
) const;

hasProperty inline

bool hasProperty(
    const std::string & name
) const;

setFeature inline

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

setProperty inline

void setProperty(
    const std::string & name,
    const Poco::Any & value
);

setPropertyBool inline

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

setPropertyDouble inline

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

setPropertyInt inline

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

setPropertyInt16 inline

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

setPropertyInt64 inline

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

setPropertyString inline

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

setPropertyTimestamp inline

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

addFeature protected inline

void addFeature(
    const std::string & name,
    FeatureGetter getter,
    FeatureSetter setter = 0
);

Adds a feature to the map of supported features.

The setter or getter can be null, in case setting or getting a feature is not supported.

addProperty protected inline

void addProperty(
    const std::string & name,
    PropertyGetter getter,
    PropertySetter setter = 0
);

Adds a property to the map of supported properties.

The setter or getter can be null, in case setting or getting a property is not supported.

lock protected inline

void lock() const;

Locks the internal Mutex.

Should not be called directly, only via ScopedLock.

unlock protected inline

void unlock() const;

Unlocks the internal Mutex. Should not be called directly, only via ScopedLock.

Variables

_features protected

FeatureMap _features;

_mutex protected

mutable Poco::Mutex _mutex;

_properties protected

PropertyMap _properties;

Securely control IoT edge devices from anywhere   Connect a Device