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:
135:7f3f963cd159
Parent:
114:bd38ad417d6a
Child:
192:54b758a8eaaa
diff -r 58e7537a8c5f -r 7f3f963cd159 ResourceFactory.cpp
--- a/ResourceFactory.cpp	Fri Mar 28 16:24:12 2014 +0000
+++ b/ResourceFactory.cpp	Fri Mar 28 17:49:10 2014 +0000
@@ -20,9 +20,7 @@
  #include "MBEDEndpoint.h"
  
  // default constructor
- ResourceFactory::ResourceFactory(ErrorHandler *error_handler,void *endpoint) {
-     this->m_error_handler = error_handler;
-     this->m_endpoint = endpoint;
+ ResourceFactory::ResourceFactory(ErrorHandler *error_handler,void *endpoint) : BaseClass(error_handler,endpoint) {
      this->m_count = 0;
      for(int i=0;i<NUM_RESOURCES;++i) this->m_list[i] = NULL;
  }
@@ -37,16 +35,13 @@
  
  // get the ith resource
  Resource *ResourceFactory::getResource(int index) { if (index >= 0 && index < NUM_RESOURCES) return this->m_list[index]; return NULL;};
- 
- // get the error handler
- ErrorHandler *ResourceFactory::logger() { return this->m_error_handler; }
- 
+  
  // create resources (base class does nothing)
  void ResourceFactory::createResources(char *endpoint_name) { ; }
  
  // create a resource value
  void ResourceFactory::createResource(char *name,char *value) { 
-    MBEDEndpoint *endpoint = (MBEDEndpoint *)this->m_endpoint;
+    MBEDEndpoint *endpoint = (MBEDEndpoint *)this->getEndpoint();
     char *ep_name = NULL; if (endpoint != NULL) ep_name = endpoint->getEndpointName();
     this->createResource(ep_name,name,value,NULL); 
  }
@@ -107,9 +102,3 @@
     return cb;
 }
 
- // min function
- int ResourceFactory::min(int value1,int value2) {
-    if (value1 < value2) return value1;
-    return value2;
- }
-