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:
134:58e7537a8c5f
Parent:
115:4e13cc450568
Child:
142:b7a75144b0f1
--- a/Light.cpp	Thu Mar 27 02:58:30 2014 +0000
+++ b/Light.cpp	Fri Mar 28 16:24:12 2014 +0000
@@ -35,17 +35,9 @@
  }
  
  // default constructor
- Light::Light(ErrorHandler *error_handler,Transport *transports[NUM_TRANSPORTS],int instance,void *endpoint) {
-     this->m_error_handler = error_handler;
-     this->m_resources = ((MBEDEndpoint *)endpoint)->initResourceFactory();
-     this->m_endpoint = endpoint;
-     this->m_ioc_id = 0;
+ Light::Light(ErrorHandler *error_handler,Transport *transports[NUM_TRANSPORTS],int instance,void *endpoint) : Personality(error_handler,transports,instance,endpoint,LIGHT_TYPE_STRING) {
      this->m_forward = true;
-     for(int i=0;i<NUM_TRANSPORTS;++i) this->m_transports[i] = transports[i];
-     memset(this->m_name,0,LIGHT_NAME_LEN+1);
-     sprintf(this->m_name,LIGHT_NAME,instance);
-     this->resources()->createResources(this->getName());
-     
+      
      // setup the blinking thread
      this->m_blinking_thread = NULL;
      this->m_is_blinking = false;
@@ -68,7 +60,6 @@
  
  // destructor
  Light::~Light() {   
-    if (this->m_resources != NULL) delete this->m_resources;
     if (this->m_dimmer_action != NULL) delete this->m_dimmer_action;
     if (this->m_switch_action != NULL) delete this->m_switch_action;
     if (this->m_pl != NULL) delete this->m_pl;
@@ -82,9 +73,6 @@
      this->m_last_state = this->m_current_state;
  }
  
- // get the resource factory
- ResourceFactory *Light::getResourceFactory() { return this->m_resources; }
- 
  // get the Philips light
  PhilipsLight *Light::pl() { return this->m_pl; }
  
@@ -102,19 +90,7 @@
  
  // get the switch action
  void *Light::getSwitchAction() { return this->m_switch_action; }
- 
- // get the requested transport
- Transport *Light::getTransport(int index) { return this->m_transports[index]; }
- 
- // get the light name
- char *Light::getName() { return this->m_name; }
-  
- // get the error handler
- ErrorHandler *Light::logger() { return this->m_error_handler; }
- 
- // get the resources factory
- ResourceFactory *Light::resources() { return this->m_resources; }
-  
+    
  // turn ON 
  void Light::on() { 
     this->m_current_state = 1; 
@@ -192,18 +168,5 @@
     if (EXT_LED_ENABLE && this->extled() != NULL) this->extled()->dim(value);
  }
  
- // set the IOC ID
- void Light::setIOCID(int ioc_id) { 
-    this->m_ioc_id = ioc_id; 
-    char buffer[PREFERENCE_VALUE_LEN+1];
-    memset(buffer,0,PREFERENCE_VALUE_LEN+1);
-    sprintf(buffer,"id:%d",ioc_id);
-    this->resources()->setResourceValue(IOC_LINKAGE_RESOURCE,buffer);
- }
- 
- // get the IOC ID
- int Light::getIOCID() { return this->m_ioc_id; }
-
- 
  
  
\ No newline at end of file