custom for >5 resources
Fork of mbedConnectorInterface by
Diff: api/DynamicResource.h
- Revision:
- 24:a6915e19814e
- Parent:
- 23:caa0260acc21
- Child:
- 30:113c2a1d8db2
--- a/api/DynamicResource.h Thu Mar 19 04:05:08 2015 +0000 +++ b/api/DynamicResource.h Fri Mar 20 04:08:59 2015 +0000 @@ -29,6 +29,9 @@ // NSDL Support #include "nsdl_support.h" +// DataWrapper support +#include "DataWrapper.h" + /** DynamicResource class */ class DynamicResource : public Resource<string> @@ -129,17 +132,25 @@ */ bool isObservable() { return this->m_observable; } + /** + Set the data wrapper + @param data_wrapper input the data wrapper instance + */ + void setDataWrapper(DataWrapper *data_wrapper) { this->m_data_wrapper = data_wrapper; } + protected: int notify(uint8_t *data,int data_length); + DataWrapper *getDataWrapper() { return this->m_data_wrapper; } private: - string m_res_type; - uint8_t m_res_mask; - bool m_observable; - uint8_t m_obs_number; - uint8_t *m_obs_token_ptr; - uint8_t m_obs_token_len; + string m_res_type; + uint8_t m_res_mask; + bool m_observable; + uint8_t m_obs_number; + uint8_t *m_obs_token_ptr; + uint8_t m_obs_token_len; + DataWrapper *m_data_wrapper; // convenience method to create a string from the NSDL CoAP data buffers... string coapDataToString(uint8_t *coap_data_ptr,int coap_data_ptr_length);