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
struct Property
class ScopedLock
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
using FeatureMap = std::map < std::string, Feature >;
PropertyMap
using PropertyMap = std::map < std::string, Property >;
Member Functions
getFeature
bool getFeature(
const std::string & name
) const;
getProperty
Poco::Any getProperty(
const std::string & name
) const;
getPropertyBool
bool getPropertyBool(
const std::string & name
) const;
getPropertyDouble
double getPropertyDouble(
const std::string & name
) const;
getPropertyInt
int getPropertyInt(
const std::string & name
) const;
getPropertyInt16
Poco::Int16 getPropertyInt16(
const std::string & name
) const;
getPropertyInt64
Poco::Int64 getPropertyInt64(
const std::string & name
) const;
getPropertyString
std::string getPropertyString(
const std::string & name
) const;
getPropertyTimestamp
Poco::Timestamp getPropertyTimestamp(
const std::string & name
) const;
hasFeature
bool hasFeature(
const std::string & name
) const;
hasProperty
bool hasProperty(
const std::string & name
) const;
setFeature
void setFeature(
const std::string & name,
bool enable
);
setProperty
void setProperty(
const std::string & name,
const Poco::Any & value
);
setPropertyBool
void setPropertyBool(
const std::string & name,
bool value
);
setPropertyDouble
void setPropertyDouble(
const std::string & name,
double value
);
setPropertyInt
void setPropertyInt(
const std::string & name,
int value
);
setPropertyInt16
void setPropertyInt16(
const std::string & name,
Poco::Int16 value
);
setPropertyInt64
void setPropertyInt64(
const std::string & name,
Poco::Int64 value
);
setPropertyString
void setPropertyString(
const std::string & name,
const std::string & value
);
setPropertyTimestamp
void setPropertyTimestamp(
const std::string & name,
Poco::Timestamp value
);
addFeature
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
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
void lock() const;
Locks the internal Mutex.
Should not be called directly, only via ScopedLock.
unlock
void unlock() const;
Unlocks the internal Mutex. Should not be called directly, only via ScopedLock.
Variables
_features
FeatureMap _features;
_mutex
mutable Poco::Mutex _mutex;
_properties
PropertyMap _properties;