mqtt specific components for the impact mbed endpoint library

Dependents:   mbed_mqtt_endpoint_ublox_ethernet mbed_mqtt_endpoint_ublox_cellular mbed_mqtt_endpoint_nxp

Files at this revision

API Documentation at this revision

Comitter:
ansond
Date:
Mon Mar 31 18:14:23 2014 +0000
Parent:
12:0114a6493457
Child:
14:717372430717
Commit message:
fixes and resync

Changed in this revision

MBEDEndpoint.cpp Show annotated file Show diff for this revision Revisions of this file
MBEDEndpoint.h Show annotated file Show diff for this revision Revisions of this file
--- 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;
  }
--- a/MBEDEndpoint.h	Mon Mar 31 05:45:59 2014 +0000
+++ b/MBEDEndpoint.h	Mon Mar 31 18:14:23 2014 +0000
@@ -47,8 +47,6 @@
 class MBEDEndpoint : public BaseClass {
     private:
         EthernetInterface    *m_ethernet;                                  // ethernet interface
-        ErrorHandler         *m_error_handler;                             // our error handler
-        IOCEndpoint          *m_ioc_endpoint;                              // IOC integration
         Transport            *m_transports[NUM_TRANSPORTS];                // our transport
         Personality          *m_personalities[NUM_PERSONALITY_INSTANCES];  // our personality instances (at least 1)
         char                  m_endpoint_name[PERSONALITY_NAME_LEN+1];     // our endpoint name (personality[0])