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:
192:54b758a8eaaa
Parent:
186:66814abc02a2
diff -r c83c1c5010ed -r 54b758a8eaaa main.cpp
--- a/main.cpp	Wed Sep 24 19:12:35 2014 +0000
+++ b/main.cpp	Fri Sep 26 05:16:07 2014 +0000
@@ -67,7 +67,7 @@
 #endif
  
  // Instances for the Endpoint
- ErrorHandler *error_handler = NULL;
+ Logger *m_logger = NULL;
  MBEDEndpoint *endpoint = NULL;
  
  // HTTP support
@@ -85,8 +85,8 @@
  char fmt_mac[RESOURCE_VALUE_LEN+1];
  #endif
  
- // ErrorHandler (logger)
- ErrorHandler *logger() { return error_handler; }    
+ // Logger (logger)
+ Logger *logger() { return m_logger; }    
  
  // translate a closedown code to a string
  char str_code[16];
@@ -101,12 +101,12 @@
  void closedown(int code) {
      if (endpoint != NULL) {
 #ifdef EH_USE_MUTEXES  
-         error_handler->releaseMutexes();
+         m_logger->releaseMutexes();
 #endif
-         error_handler->log("Closing down Endpoint...");
+         m_logger->log("Closing down Endpoint...");
          delete endpoint;
      }
-     if (error_handler != NULL) delete error_handler;
+     if (m_logger != NULL) delete m_logger;
 #ifndef _ENDPOINT_UBLOX_PLATFORM
      pc.printf("Exiting...\r\n");
 #endif
@@ -141,10 +141,10 @@
     memset(fmt_mac,0,RESOURCE_VALUE_LEN+1);
     sprintf(fmt_mac,"%02x:%02x:%02x:%02x:%02x:%02x",mac[0],mac[1],mac[2],mac[3],mac[4],mac[5]);
 #endif
-    error_handler = new ErrorHandler(&pc,&lcd);
+    m_logger = new Logger(&pc,&lcd);
     
 #if SF_STATUS_REPORTING
-    StatusReporter status_reporter(error_handler,(void *)&_http);
+    StatusReporter status_reporter(&_http,m_logger);
     sf_status_reporter = (void *)&status_reporter;
 #endif
 
@@ -154,9 +154,9 @@
     #else
         MDMSerial modem;
     #endif
-    endpoint = new MBEDEndpoint(error_handler,&modem,sf_status_reporter,NULL);
+    endpoint = new MBEDEndpoint(m_logger,&modem,sf_status_reporter,NULL);
 #else
-    endpoint = new MBEDEndpoint(error_handler,&ethernet,sf_status_reporter,NULL);
+    endpoint = new MBEDEndpoint(m_logger,&ethernet,sf_status_reporter,NULL);
 #endif
     if (endpoint != NULL) endpoint->run();
  }