use TCP to connect to mbed connector

Fork of mbedConnectorInterfaceWithDM by Doug Anson

Revision:
27:b8aaf7dc7023
Parent:
15:c11dbe4d354c
Child:
28:cf32aa9842ce
--- a/mbed-connector-interface/DynamicResource.h	Sun Jun 12 03:18:25 2016 +0000
+++ b/mbed-connector-interface/DynamicResource.h	Tue Jun 14 04:01:34 2016 +0000
@@ -43,7 +43,7 @@
     @param res_mask input the resource enablement mask (GET, PUT, etc...)
     @param observable input the resource is Observable (default: FALSE)
     */
-    DynamicResource(const Logger *logger,const char *obj_name,const char *res_name,const char *res_type,uint8_t res_mask,const bool observable = false);
+    DynamicResource(const Logger *logger,const char *obj_name,const char *res_name,const char *res_type,uint8_t res_mask,const bool observable = false,const ResourceType type = STRING);
 
     /**
     Default constructor (char strings)
@@ -55,7 +55,7 @@
     @param res_mask input the resource enablement mask (GET, PUT, etc...)
     @param observable input the resource is Observable (default: FALSE)
     */
-    DynamicResource(const Logger *logger,const char *obj_name,const char *res_name,const char *res_type,const string value,uint8_t res_mask,const bool observable = false);
+    DynamicResource(const Logger *logger,const char *obj_name,const char *res_name,const char *res_type,const string value,uint8_t res_mask,const bool observable = false,const ResourceType type = STRING);
 
     /**
     constructor with string buffer for name
@@ -67,7 +67,7 @@
     @param res_mask input the resource enablement mask (GET, PUT, etc...)
     @param observable input the resource is Observable (default: FALSE)
     */
-    DynamicResource(const Logger *logger,const string obj_name,const string res_name,const string res_type,const string value,uint8_t res_mask,const bool observable = false);
+    DynamicResource(const Logger *logger,const string obj_name,const string res_name,const string res_type,const string value,uint8_t res_mask,const bool observable = false,const ResourceType type = STRING);
 
     /**
     Copy constructor
@@ -82,9 +82,9 @@
 
     /**
     Bind resource to endpoint
-    @param p input pointer to the endpoint resources necessary for binding
+    @param ep input endpoint instance pointer
     */
-    virtual M2MObject *bind(void *p);
+    virtual void bind(void *ep);
 
     /**
     Process the CoAP message
@@ -99,7 +99,7 @@
     Resource value getter (REQUIRED: must be implemented in derived class as all Binders MUST support and implement GET)
     @returns string value of the resource
     */
-    virtual string get() = 0;
+    virtual string get();
 
     /**
     Resource value setter (PUT) (OPTIONAL: defaulted noop if not derived. Binders MAY implement PUT if needed)
@@ -164,7 +164,7 @@
     /**
     get the base resource representation
     */
-    M2MBase *getResource();
+    M2MResource *getResource();
     
     /**
     Process a POST message for Resources
@@ -172,11 +172,6 @@
     void process_resource_post(void *args);
     
     /**
-    Process a DELETE message for Resources
-    */
-    void process_resource_delete(void *args);
-    
-    /**
     Determine if we are connected or not
     */
     bool isConnected();
@@ -187,26 +182,28 @@
     bool isRegistered();
 
 protected:
-    int notify(uint8_t *data,int data_length);
-    DataWrapper *getDataWrapper() { return this->m_data_wrapper; }
+    int               notify(uint8_t *data,int data_length);
+    DataWrapper      *getDataWrapper() { return this->m_data_wrapper; }
     bool              m_observable;
 
 private:
 
-    string                 			   m_res_type;
+    string                 			   m_res_type;			// a string description of our resource type (i.e. "Counter", etc...)  
+    ResourceType					   m_type;				// the core type of our resource (i.e. String, Integer, etc...) 
     uint8_t               			   m_res_mask;
     uint8_t               			   m_obs_number;
     DataWrapper   			  		  *m_data_wrapper;
     void                  		      *m_observer;
     uint8_t               			   m_maxage;
     uint8_t               			   m_content_format;
-    M2MObject      			   		  *m_object; 
-    M2MObjectInstance       		  *m_obj_instance;
     M2MResource				          *m_res;
-    void                              *m_op_processor;
+    void                              *m_ep;
 
     // convenience method to create a string from the NSDL CoAP data buffers...
     string coapDataToString(uint8_t *coap_data_ptr,int coap_data_ptr_length);
+    int coapDataToInteger(uint8_t *coap_data_ptr,int coap_data_ptr_length);
+    float coapDataToFloat(uint8_t *coap_data_ptr,int coap_data_ptr_length);
+    void *coapDataToOpaque(uint8_t *coap_data_ptr,int coap_data_ptr_length);
 };
 
 #endif // __DYNAMIC_RESOURCE_H__