Core Base Classes for the Light Endpoints

Dependencies:   BufferedSerial

Dependents:   mbed_mqtt_endpoint_ublox_ethernet mbed_mqtt_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_ethernet ... more

Revision:
57:da85ca0fbbf9
Parent:
56:604a75f111fd
Child:
58:1552dd51615b
--- a/Resource.cpp	Sun Mar 02 21:41:27 2014 +0000
+++ b/Resource.cpp	Sun Mar 02 23:37:47 2014 +0000
@@ -45,12 +45,13 @@
     if (name != NULL) {
         memset(this->m_name,0,RESOURCE_NAME_LEN+1);
         strncpy(this->m_name,name,this->min(RESOURCE_NAME_LEN,strlen(name))); 
+        this->logger()->log("SET: Name: %s Value: %s",this->getName(),this->getValuePointer()); 
     }
  }
  
  // get the value of the resource
  char *Resource::getValue() { this->extract(this->getName()); return this->getValuePointer(); }
- char *Resource::getValuePointer() { return this->m_value; }
+ char *Resource::getValuePointer() { this->logger()->log("GET: Name: %s Value: %s",this->getName(),this->getValuePointer()); return this->m_value; }
  
  // set the value of the resource
  void Resource::setValue(char *value) { this->setValue(value,strlen(value)); }
@@ -62,11 +63,13 @@
  }
  
  // plumb the resource (base class does nothing other than save the endpoint_name)
- void Resource::plumb(char *endpoint_name,char *name) { 
+ void Resource::plumb(char *ep_name,char *name) { 
+    // DEBUG
+    this->logger()->log("Plumbing Resource - Endpoint: %s Resource: %s",ep_name,name);
     memset(this->m_endpoint_name,0,LIGHT_NAME_LEN+1);
-    if (endpoint_name != NULL) {
+    if (ep_name != NULL) {
         memset(this->m_endpoint_name,0,LIGHT_NAME_LEN+1);
-        strncpy(this->m_endpoint_name,endpoint_name,this->min(LIGHT_NAME_LEN,strlen(endpoint_name))); 
+        strncpy(this->m_endpoint_name,ep_name,this->min(LIGHT_NAME_LEN,strlen(ep_name))); 
     }
  }