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:
92:330746c526b7
Parent:
91:8732d54328ae
Child:
98:3ea8058f4c54
--- a/Light.cpp	Thu Mar 13 17:25:18 2014 +0000
+++ b/Light.cpp	Thu Mar 13 17:36:08 2014 +0000
@@ -55,14 +55,7 @@
      // DEBUG
      if (PL_ENABLE) this->logger()->log("Light name: %s (Philips Light %d)",this->getName(),PL_LIGHT_ID);   
      else this->logger()->log("Light name: %s", this->getName()); 
-     
-     // initialize the default light state
-     this->m_current_state = LIGHT_DEFAULT_STATE;
-     this->m_last_state = this->m_current_state;
-     if (this->m_current_state == 1) this->on();
-     if (this->m_current_state == 0) this->off();
-     if (this->m_current_state == 2) this->blink(); 
-     
+          
      // we are activated
      _instance = (void *)this;
  }
@@ -76,6 +69,12 @@
     this->stopBlinkingThread();
  }
  
+ // initialize the light
+ void Light::initLight() {
+     this->m_current_state = LIGHT_DEFAULT_STATE;
+     this->m_last_state = this->m_current_state;
+ }
+ 
  // get the resource factory
  ResourceFactory *Light::getResourceFactory() { return this->m_resources; }