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

This class represents Basic bundle resource template to be registered in the container and make resource server. More...

Inherited by OIC::Service::ProtocolBridgeResource, and OIC::Service::SoftSensorResource.

Public Types

typedef std::shared_ptr
< BundleResource
Ptr
 

Public Member Functions

 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...
 
virtual void initAttributes ()=0
 Initialize attributes 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...
 
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...
 

Public Attributes

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
 

Detailed Description

This class represents Basic bundle resource template to be registered in the container and make resource server.

Member Typedef Documentation

Constructor & Destructor Documentation

OIC::Service::BundleResource::BundleResource ( )

Constructor for BundleResource.

virtual OIC::Service::BundleResource::~BundleResource ( )
virtual

Virtual destructor for BundleResource.

Member Function Documentation

RCSResourceAttributes::Value OIC::Service::BundleResource::getAttribute ( const std::string &  key)

Return the value of an attribute.

Parameters
keyKey of attribute to get
Returns
Value of the attribute
std::list<std::string> OIC::Service::BundleResource::getAttributeNames ( )

Return the list of attribute names of the resource.

Returns
List of the attribute names
const RCSResourceAttributes OIC::Service::BundleResource::getAttributes ( )

Return all attributes of the resource.

Returns
Attributes of the resource
virtual RCSResourceAttributes OIC::Service::BundleResource::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
All attributes

Implemented in OIC::Service::ProtocolBridgeResource, and OIC::Service::SoftSensorResource.

virtual void OIC::Service::BundleResource::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

Implemented in OIC::Service::ProtocolBridgeResource, and OIC::Service::SoftSensorResource.

virtual void OIC::Service::BundleResource::initAttributes ( )
pure virtual

Initialize attributes of the resource.

Returns
void

Implemented in OIC::Service::ProtocolBridgeResource, and OIC::Service::SoftSensorResource.

void OIC::Service::BundleResource::registerObserver ( NotificationReceiver pNotiReceiver)

Register notification receiver(resource container) to notify for the changes of attributes.

Parameters
pNotiReceiverNotification Receiver to get notification from bundle resource
Returns
void
void OIC::Service::BundleResource::setAttribute ( const std::string &  key,
RCSResourceAttributes::Value &&  value,
bool  notify 
)

Sets the value of an attribute.

Parameters
keyName of attribute to set
valueValue of attribute to set
notifyFlag to indicate if OIC clients should be notified about an update
Returns
void
void OIC::Service::BundleResource::setAttribute ( const std::string &  key,
RCSResourceAttributes::Value value,
bool  notify 
)

Sets the value of an attribute.

Parameters
keyName of attribute to set
valueValue of attribute to set
notifyFlag to indicate if OIC clients should be notified about an update
Returns
void
void OIC::Service::BundleResource::setAttribute ( const std::string &  key,
RCSResourceAttributes::Value &&  value 
)

Sets the value of an attribute.

Parameters
keyName of attribute to set
valueValue of attribute to set
Returns
void
void OIC::Service::BundleResource::setAttribute ( const std::string &  key,
RCSResourceAttributes::Value value 
)

Sets the value of an attribute.

Parameters
keyName of attribute to set
valueValue of attribute to set
Returns
void
void OIC::Service::BundleResource::setAttributes ( const RCSResourceAttributes attrs)

Set attributes of the resource.

Parameters
attrsAttributes to set
Returns
void
void OIC::Service::BundleResource::setAttributes ( const RCSResourceAttributes attrs,
bool  notify 
)

Member Data Documentation

std::string OIC::Service::BundleResource::m_address
std::string OIC::Service::BundleResource::m_bundleId
std::string OIC::Service::BundleResource::m_interface
std::map< std::string, std::vector< std::map< std::string, std::string > > > OIC::Service::BundleResource::m_mapResourceProperty
std::string OIC::Service::BundleResource::m_name
std::string OIC::Service::BundleResource::m_resourceType
std::string OIC::Service::BundleResource::m_uri

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