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:
7:f570eb3f38cd
Parent:
6:34c07e145caa
Child:
8:45f9a920e82c
--- a/MBEDEndpoint.cpp	Wed Feb 26 07:22:34 2014 +0000
+++ b/MBEDEndpoint.cpp	Wed Feb 26 18:59:08 2014 +0000
@@ -28,6 +28,9 @@
  // Emulated Actions we can act on
  #include "EmulatedLightDimmerAction.h"
  #include "EmulatedLightSwitchAction.h"
+ 
+ // shutdown endpoint reference
+ extern void closedown(int code);
   
  // default constructor
  MBEDEndpoint::MBEDEndpoint(ErrorHandler *error_handler,EthernetInterface *ethernet) {
@@ -41,7 +44,7 @@
      if (success) success = this->initializeTransports();
      if (success) success = this->initializeLights();
      if (success) this->logger()->turnLEDGreen();
-     if (!success) this->logger()->turnLEDRed();
+     if (!success) closedown(2);
  }
  
  // default destructor
@@ -98,7 +101,6 @@
      if (this->m_transports[index] == NULL) {
           this->logger()->log("Initializing %s Transport...", key);
           this->m_transports[index] = transport;
-          transport->setEndpoint(this);
           if (this->m_transports[index] != NULL) success = this->m_transports[index]->connect();
       }
       else {
@@ -114,12 +116,12 @@
       
       if (success == true) {
         // MQTT Initialization
-        success = this->initializeTransport(MQTT_TRANSPORT,"MQTT",new MQTTTransport(this->m_error_handler));
+        success = this->initializeTransport(MQTT_TRANSPORT,"MQTT",new MQTTTransport(this->m_error_handler,this));
       }
       
       if (success == true) {
           // HTTP Initialization
-          success = this->initializeTransport(HTTP_TRANSPORT,"HTTP",new HTTPTransport(this->m_error_handler));
+          success = this->initializeTransport(HTTP_TRANSPORT,"HTTP",new HTTPTransport(this->m_error_handler,this));
       }
       return success;
  }