MBED_DEMOS / Mbed 2 deprecated mbed_mqtt_endpoint_nxp

Dependencies:   C12832_lcd EthernetInterface StatusReporter LM75B MQTT-ansond endpoint_core endpoint_mqtt mbed-rtos mbed

Revision:
32:a7b3c285446c
Parent:
30:5c670ec5d203
Child:
33:8302b02413bd
--- a/MBEDEndpoint.cpp	Fri Feb 28 20:39:17 2014 +0000
+++ b/MBEDEndpoint.cpp	Fri Feb 28 21:12:16 2014 +0000
@@ -37,13 +37,14 @@
      bool success = true;
      for(int i=0;i<NUM_TRANSPORTS;++i) this->m_transports[i] = NULL;
      this->m_error_handler = error_handler;
+     if (success) this->initEndpointName();
      if (success) this->logger()->turnLEDBlue();
      if (success)this->logger()->log(ENDPOINT_VERSION_ANNOUNCE);
      if (success) success = this->initializeEthernet(ethernet);
      if (success) this->logger()->turnLEDYellow();
-     if (success)this->m_map = new MBEDToIOCResourceMap(error_handler);     
+     if (success)this->m_map = new MBEDToIOCResourceMap(error_handler);    
      if (success) success = this->initializeTransports();
-     if (success) success = this->initializeLights();
+     if (success) success = this->initializeLights(); 
      if (success) this->logger()->turnLEDGreen();
      if (!success) closedown(2);
  }
@@ -97,8 +98,14 @@
  // initialize our ResourceFactory
  ResourceFactory *MBEDEndpoint::initResourceFactory() { return new EmulatedResourceFactory(this->logger()); }
  
- // get our endpoint name (first light name)
- char *MBEDEndpoint::getEndpointName() { return this->m_lights[0]->getName(); }
+ // Initialize the Endpoint Name - will be the first Light resource name (and there must be one...)
+ void MBEDEndpoint::initEndpointName() {
+     memset(this->m_endpoint_name,0,LIGHT_NAME_LEN+1);
+     sprintf(this->m_endpoint_name,LIGHT_NAME,1);
+ }
+ 
+ // get our endpoint name
+ char *MBEDEndpoint::getEndpointName() { return this->m_endpoint_name; }
  
  // initialize a specific transport
  bool MBEDEndpoint::initializeTransport(int index,char *key,Transport *transport) {