mqtt specific components for the impact mbed endpoint library

Dependents:   mbed_mqtt_endpoint_ublox_ethernet mbed_mqtt_endpoint_ublox_cellular mbed_mqtt_endpoint_nxp

Revision:
13:66f6cf705184
Parent:
12:0114a6493457
Child:
14:717372430717
--- a/MBEDEndpoint.cpp	Mon Mar 31 05:45:59 2014 +0000
+++ b/MBEDEndpoint.cpp	Mon Mar 31 18:14:23 2014 +0000
@@ -37,7 +37,7 @@
  extern void closedown(int code);
   
  // default constructor
- MBEDEndpoint::MBEDEndpoint(ErrorHandler *error_handler,EthernetInterface *ethernet) : BaseClass(error_handler,new IOCEndpoint(error_handler,(void *)this)) {
+ MBEDEndpoint::MBEDEndpoint(ErrorHandler *error_handler,EthernetInterface *ethernet) : BaseClass(error_handler,new IOCEndpoint(error_handler,NULL)) {
      bool success = true;
      this->m_instance_id = 0;
      this->m_preferences = NULL;
@@ -45,6 +45,7 @@
      memset(this->m_gw_address,0,PREFERENCE_VALUE_LEN+1);
      for(int i=0;i<NUM_TRANSPORTS;++i) this->m_transports[i] = NULL;
      this->logger()->setEndpoint((void *)this);
+     this->setEndpoint(new IOCEndpoint(this->logger(),(void *)this));
      if (success) this->initPreferences();
      if (success) this->initEndpointName();
      if (success) this->logger()->turnLEDBlue();
@@ -76,6 +77,7 @@
      if (success) success = this->closeEthernet();
      if (success) this->logger()->turnLEDBlue();
      if (this->m_map != NULL) delete this->m_map;
+     if (this->getEndpoint() != NULL) delete (IOCEndpoint *)this->getEndpoint();
  }
   
  // get the IOC <--> MBED resource map
@@ -201,12 +203,12 @@
       
       if (success == true) {
         // MQTT Initialization
-        success = this->initializeTransport(MQTT_TRANSPORT,"MQTT",new MQTTTransport(this->m_error_handler,this,this->getMap()));
+        success = this->initializeTransport(MQTT_TRANSPORT,"MQTT",new MQTTTransport(this->logger(),this,this->getMap()));
       }
       
       if (success == true) {
           // HTTP Initialization
-          success = this->initializeTransport(HTTP_TRANSPORT,"HTTP",new IOCHTTPTransport(this->m_error_handler,this));
+          success = this->initializeTransport(HTTP_TRANSPORT,"HTTP",new IOCHTTPTransport(this->logger(),this));
       }
       return success;
  }