#include <map>
#include <vector>
#include <memory>
+#include <mutex>
+
#include "NotificationReceiver.h"
#include "RCSResourceAttributes.h"
*
* @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
*
* @return void
*/
- void setAttributes(RCSResourceAttributes &attrs);
+ void setAttributes(const RCSResourceAttributes &attrs);
- void setAttributes(RCSResourceAttributes &attrs, bool notify);
+ void setAttributes(const RCSResourceAttributes &attrs, bool notify);
/**
* Return the value of an attribute
*
* @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
*
* @return All attributes
*/
- virtual RCSResourceAttributes &handleGetAttributesRequest() = 0;
+ virtual RCSResourceAttributes handleGetAttributesRequest() = 0;
/**
* This function should be implemented by the according bundle resource
*
* @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;
private:
- NotificationReceiver *m_pNotiReceiver;
+ NotificationReceiver* m_pNotiReceiver;
RCSResourceAttributes m_resourceAttributes;
+ std::mutex m_resourceAttributes_mutex;
};
}
}