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:
114:bd38ad417d6a
--- a/MBEDLight.cpp	Thu Mar 13 17:25:18 2014 +0000
+++ b/MBEDLight.cpp	Thu Mar 13 17:36:08 2014 +0000
@@ -24,12 +24,22 @@
    
  // default constructor
  MBEDLight::MBEDLight(ErrorHandler *error_handler,Transport *transports[NUM_TRANSPORTS],int instance,void *endpoint) : Light(error_handler,transports,instance,endpoint) {
+     // initialize the default light state
+     this->initLight();
  }
  
  // destructor
  MBEDLight::~MBEDLight() {   
  }
  
+ // initialize the light
+ void MBEDLight::initLight() {
+     Light::initLight();
+     if (this->m_current_state == 1) this->on();
+     if (this->m_current_state == 0) this->off();
+     if (this->m_current_state == 2) this->blink(); 
+ }
+ 
  // turn ON 
  void MBEDLight::on() { this->logger()->led2On(); this->logger()->led3On(); Light::on(); this->logger()->dimRGB(1.0); }