IoTivity C++ SDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
OIC::Service::SoftSensorResource Class Referenceabstract

This class represents bundle resource for Soft Sensor to be registered in the container and make resource server. More...

Inherits OIC::Service::BundleResource.

Public Member Functions

 SoftSensorResource ()
 Constructor for SoftSensorResource. More...
 
virtual ~SoftSensorResource ()
 Virtual destructor for SoftSensorResource. More...
 
virtual void initAttributes ()
 Initialize input and output attributes for the resource. More...
 
virtual RCSResourceAttributes handleGetAttributesRequest (const std::map< std::string, std::string > &queryParams)=0
 This function should be implemented by the according bundle resource and execute the according business logic (e.g., light switch or sensor resource) to retrieve a sensor value. More...
 
virtual void handleSetAttributesRequest (const RCSResourceAttributes &attrs, const std::map< std::string, std::string > &queryParams)=0
 This function should be implemented by the according bundle resource and execute the according business logic (e.g., light switch or sensor resource) and write either on soft sensor values or external bridged devices. More...
 
virtual void executeLogic ()=0
 SoftSensor logic. More...
 
virtual void onUpdatedInputResource (const std::string attributeName, std::vector< RCSResourceAttributes::Value > values)=0
 Callback from the client module in the container. More...
 
- Public Member Functions inherited from OIC::Service::BundleResource
 BundleResource ()
 Constructor for BundleResource. More...
 
virtual ~BundleResource ()
 Virtual destructor for BundleResource. More...
 
std::list< std::string > getAttributeNames ()
 Return the list of attribute names of the resource. More...
 
void registerObserver (NotificationReceiver *pNotiReceiver)
 Register notification receiver(resource container) to notify for the changes of attributes. More...
 
const RCSResourceAttributes getAttributes ()
 Return all attributes of the resource. More...
 
void setAttributes (const RCSResourceAttributes &attrs)
 Set attributes of the resource. More...
 
void setAttributes (const RCSResourceAttributes &attrs, bool notify)
 
RCSResourceAttributes::Value getAttribute (const std::string &key)
 Return the value of an attribute. More...
 
void setAttribute (const std::string &key, RCSResourceAttributes::Value &&value, bool notify)
 Sets the value of an attribute. More...
 
void setAttribute (const std::string &key, RCSResourceAttributes::Value &value, bool notify)
 Sets the value of an attribute. More...
 
void setAttribute (const std::string &key, RCSResourceAttributes::Value &&value)
 Sets the value of an attribute. More...
 
void setAttribute (const std::string &key, RCSResourceAttributes::Value &value)
 Sets the value of an attribute. More...
 

Public Attributes

std::list< std::string > m_inputList
 
- Public Attributes inherited from OIC::Service::BundleResource
std::string m_bundleId
 
std::string m_name
 
std::string m_uri
 
std::string m_resourceType
 
std::string m_interface
 
std::string m_address
 
std::map< std::string,
std::vector< std::map
< std::string, std::string > > > 
m_mapResourceProperty
 

Additional Inherited Members

- Public Types inherited from OIC::Service::BundleResource
typedef std::shared_ptr
< BundleResource
Ptr
 

Detailed Description

This class represents bundle resource for Soft Sensor to be registered in the container and make resource server.

Constructor & Destructor Documentation

OIC::Service::SoftSensorResource::SoftSensorResource ( )

Constructor for SoftSensorResource.

virtual OIC::Service::SoftSensorResource::~SoftSensorResource ( )
virtual

Virtual destructor for SoftSensorResource.

Member Function Documentation

virtual void OIC::Service::SoftSensorResource::executeLogic ( )
pure virtual

SoftSensor logic.

Has to be provided by the soft sensor developer. This function will be executed if an input attribute is updated.

Returns
void
virtual RCSResourceAttributes OIC::Service::SoftSensorResource::handleGetAttributesRequest ( const std::map< std::string, std::string > &  queryParams)
pure virtual

This function should be implemented by the according bundle resource and execute the according business logic (e.g., light switch or sensor resource) to retrieve a sensor value.

If a new sensor value is retrieved, the setAttribute data should be called to update the value. The implementor of the function can decide weather to notify OIC clients about the changed state or not.

Parameters
queryParamsRequest parameters
Returns
Value of all attributes

Implements OIC::Service::BundleResource.

virtual void OIC::Service::SoftSensorResource::handleSetAttributesRequest ( const RCSResourceAttributes attrs,
const std::map< std::string, std::string > &  queryParams 
)
pure virtual

This function should be implemented by the according bundle resource and execute the according business logic (e.g., light switch or sensor resource) and write either on soft sensor values or external bridged devices.

The call of this method could for example trigger a HTTP PUT request on an external APIs. This method is responsible to update the resource internal data and call the setAttribute method.

The implementor of the function can decide weather to notify OIC clients about the changed state or not.

Parameters
attrsAttributes to set
queryParamsRequest parameters
Returns
void

Implements OIC::Service::BundleResource.

virtual void OIC::Service::SoftSensorResource::initAttributes ( )
virtual

Initialize input and output attributes for the resource.

Returns
void

Implements OIC::Service::BundleResource.

virtual void OIC::Service::SoftSensorResource::onUpdatedInputResource ( const std::string  attributeName,
std::vector< RCSResourceAttributes::Value values 
)
pure virtual

Callback from the client module in the container.

This function will be called if input data from remote resources are updated. SoftSensor resource can get a vector of input data from multiple input resources which have attributeName that softsensor needs to execute its logic.

Parameters
attributeNameAttribute key of input data
valuesVector of input data value
Returns
void

Member Data Documentation

std::list<std::string> OIC::Service::SoftSensorResource::m_inputList

The documentation for this class was generated from the following file: