X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=service%2Fresource-container%2Fbundle-api%2Finclude%2FBundleResource.h;h=23e9f85dd535f40bfeee1ac3171f8848aff64a96;hb=390866079e285d2c74918432c0d597d5da52f8a0;hp=5315edda6c4cf68cf49b32dc174ea4829edab4f9;hpb=3e9402ad71cb3e93266a77796f44d17bab9853fd;p=platform%2Fupstream%2Fiotivity.git diff --git a/service/resource-container/bundle-api/include/BundleResource.h b/service/resource-container/bundle-api/include/BundleResource.h index 5315edd..23e9f85 100644 --- a/service/resource-container/bundle-api/include/BundleResource.h +++ b/service/resource-container/bundle-api/include/BundleResource.h @@ -26,6 +26,8 @@ #include #include #include +#include + #include "NotificationReceiver.h" #include "RCSResourceAttributes.h" @@ -79,14 +81,14 @@ namespace OIC * * @return void */ - void registerObserver(NotificationReceiver *pNotiReceiver); + void registerObserver(NotificationReceiver* pNotiReceiver); /** * Return all attributes of the resource * * @return Attributes of the resource */ - RCSResourceAttributes &getAttributes(); + const RCSResourceAttributes getAttributes(); /** * Set attributes of the resource @@ -95,7 +97,9 @@ namespace OIC * * @return void */ - void setAttributes(RCSResourceAttributes &attrs); + void setAttributes(const RCSResourceAttributes &attrs); + + void setAttributes(const RCSResourceAttributes &attrs, bool notify); /** * Return the value of an attribute @@ -127,11 +131,36 @@ namespace OIC * * @param value Value of attribute to set * + * @param notify Flag to indicate if OIC clients should be notified about an update + * + * @return void + */ + void setAttribute(const std::string &key, RCSResourceAttributes::Value &value, + bool notify); + + /** + * Sets the value of an attribute + * + * @param key Name of attribute to set + * + * @param value Value of attribute to set + * * @return void */ void setAttribute(const std::string &key, RCSResourceAttributes::Value &&value); /** + * Sets the value of an attribute + * + * @param key Name of attribute to set + * + * @param value Value of attribute to set + * + * @return void + */ + void setAttribute(const std::string &key, RCSResourceAttributes::Value &value); + + /** * 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 @@ -141,7 +170,7 @@ namespace OIC * * @return All attributes */ - virtual RCSResourceAttributes &handleGetAttributesRequest() = 0; + virtual RCSResourceAttributes handleGetAttributesRequest() = 0; /** * This function should be implemented by the according bundle resource @@ -159,18 +188,21 @@ namespace OIC * * @return void */ - virtual void handleSetAttributesRequest(RCSResourceAttributes &attrs) = 0; + virtual void handleSetAttributesRequest(const RCSResourceAttributes &attrs) = 0; + private: + void sendNotification(NotificationReceiver *notficiationRecevier, std::string uri); public: std::string m_bundleId; - std::string m_name, m_uri, m_resourceType, m_address; + std::string m_name, m_uri, m_resourceType, m_interface, m_address; std::map< std::string, - std::vector< std::map< std::string, std::string > > > m_mapResourceProperty; + std::vector< std::map< std::string, std::string > > > m_mapResourceProperty; private: - NotificationReceiver *m_pNotiReceiver; + NotificationReceiver* m_pNotiReceiver; RCSResourceAttributes m_resourceAttributes; + std::mutex m_resourceAttributes_mutex; }; } }