nsp resources for the mbed nsp lighting endpoint

Dependencies:   nsdl_lib

Dependents:   mbed_nsp_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_ethernet mbed_nsp_endpoint_nxp

Files at this revision

API Documentation at this revision

Comitter:
ansond
Date:
Fri Sep 26 05:55:55 2014 +0000
Parent:
2:5b294040c3e0
Commit message:
updates for new logger

Changed in this revision

addldata.cpp Show annotated file Show diff for this revision Revisions of this file
battery.cpp Show annotated file Show diff for this revision Revisions of this file
current.cpp Show annotated file Show diff for this revision Revisions of this file
dimmer.cpp Show annotated file Show diff for this revision Revisions of this file
gps.cpp Show annotated file Show diff for this revision Revisions of this file
locationtext.cpp Show annotated file Show diff for this revision Revisions of this file
mdltext.cpp Show annotated file Show diff for this revision Revisions of this file
mfgtext.cpp Show annotated file Show diff for this revision Revisions of this file
nsdl_support.cpp Show annotated file Show diff for this revision Revisions of this file
nsdl_support.h Show annotated file Show diff for this revision Revisions of this file
nsp_get.cpp Show annotated file Show diff for this revision Revisions of this file
nsp_getput.cpp Show annotated file Show diff for this revision Revisions of this file
rssi.cpp Show annotated file Show diff for this revision Revisions of this file
switch.cpp Show annotated file Show diff for this revision Revisions of this file
temperature.cpp Show annotated file Show diff for this revision Revisions of this file
voltage.cpp Show annotated file Show diff for this revision Revisions of this file
wattage.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 5b294040c3e0 -r 30c96bd77160 addldata.cpp
--- a/addldata.cpp	Fri Sep 19 05:24:41 2014 +0000
+++ b/addldata.cpp	Fri Sep 26 05:55:55 2014 +0000
@@ -5,7 +5,7 @@
 #include "addldata.h"
 #include "NSPio.h"
 
-extern ErrorHandler *error_handler;
+extern Logger *logger;
 
 NSPio *addldata = NULL;
 
@@ -17,19 +17,19 @@
 // send our addldata observation
 void send_addldata_observation() {
     if (addldata_obs_token_ptr != NULL && addldata_obs_number != 0) {
-        //if (error_handler != NULL) error_handler->log("Sending Observation (addldata): %s",addldata->resource()->getValuePointer());
+        //if (m_logger != NULL) m_logger->log("Sending Observation (addldata): %s",addldata->resource()->getValuePointer());
         sn_nsdl_send_observation_notification(addldata_obs_token_ptr,addldata_obs_token_len,(uint8_t*)addldata->resource()->getValuePointer(),strlen(addldata->resource()->getValuePointer()),&addldata_obs_number,sizeof(addldata_obs_number),COAP_MSG_TYPE_NON_CONFIRMABLE, 0);
     }
 }
 
 // init addldata
 void init_addldata(Resource *resource) {
-    if (addldata == NULL && resource != NULL) addldata = new NSPio(error_handler,resource,&send_addldata_observation);
+    if (addldata == NULL && resource != NULL) addldata = new NSPio(m_logger,resource,&send_addldata_observation);
 }
 
 // update our addldata observation
 void update_addldata_observation(sn_coap_hdr_s *received_coap_ptr,sn_coap_hdr_s *coap_res_ptr) {
-    //if (error_handler != NULL) error_handler->log("Updating Observation (addldata)...starting");
+    //if (m_logger != NULL) m_logger->log("Updating Observation (addldata)...starting");
     if (received_coap_ptr->token_ptr != NULL) {
         if (addldata_obs_token_ptr != NULL) free(addldata_obs_token_ptr);
         addldata_obs_token_ptr = (uint8_t *)malloc(received_coap_ptr->token_len);
@@ -45,7 +45,7 @@
         coap_res_ptr->options_list_ptr->observe_len = 1;
         addldata_obs_number++;
     }
-    //if (error_handler != NULL) error_handler->log("Updating Observation (addldata)...done");
+    //if (m_logger != NULL) m_logger->log("Updating Observation (addldata)...done");
 }
 
 /* Only GET and PUT method allowed */
diff -r 5b294040c3e0 -r 30c96bd77160 battery.cpp
--- a/battery.cpp	Fri Sep 19 05:24:41 2014 +0000
+++ b/battery.cpp	Fri Sep 26 05:55:55 2014 +0000
@@ -5,7 +5,7 @@
 #include "NSPio.h"
 #include "MBEDBattery.h"
 
-extern ErrorHandler *error_handler;
+extern Logger *logger;
 NSPio *battery = NULL;
 
 // observation support
@@ -16,19 +16,19 @@
 // send our battery observation
 void send_battery_observation() {
     if (battery_obs_token_ptr != NULL && battery_obs_number != 0) {
-        //if (error_handler != NULL) error_handler->log("Sending Observation (battery): %s",battery->resource()->getValuePointer());
+        //if (m_logger != NULL) m_logger->log("Sending Observation (battery): %s",battery->resource()->getValuePointer());
         sn_nsdl_send_observation_notification(battery_obs_token_ptr,battery_obs_token_len,(uint8_t*)battery->resource()->getValuePointer(),strlen(battery->resource()->getValuePointer()),&battery_obs_number,sizeof(battery_obs_number),COAP_MSG_TYPE_NON_CONFIRMABLE, 0);
     }
 }
 
 // init battery
 void init_battery(Resource *resource) {
-    if (battery == NULL && resource != NULL) battery = new NSPio(new MBEDBattery(error_handler,resource),&send_battery_observation);
+    if (battery == NULL && resource != NULL) battery = new NSPio(new MBEDBattery(m_logger,resource),&send_battery_observation);
 }
 
 // update our battery observation
 void update_battery_observation(sn_coap_hdr_s *received_coap_ptr,sn_coap_hdr_s *coap_res_ptr) {
-    //if (error_handler != NULL) error_handler->log("Updating Observation (batter)...starting");
+    //if (m_logger != NULL) m_logger->log("Updating Observation (batter)...starting");
     if (received_coap_ptr->token_ptr != NULL) {
         if (battery_obs_token_ptr != NULL) free(battery_obs_token_ptr);
         battery_obs_token_ptr = (uint8_t *)malloc(received_coap_ptr->token_len);
@@ -44,7 +44,7 @@
         coap_res_ptr->options_list_ptr->observe_len = 1;
         battery_obs_number++;
     }
-    //if (error_handler != NULL) error_handler->log("Updating Observation (battery)...done");
+    //if (m_logger != NULL) m_logger->log("Updating Observation (battery)...done");
 }
 
 /* Only GET method allowed */
diff -r 5b294040c3e0 -r 30c96bd77160 current.cpp
--- a/current.cpp	Fri Sep 19 05:24:41 2014 +0000
+++ b/current.cpp	Fri Sep 26 05:55:55 2014 +0000
@@ -5,7 +5,7 @@
 #include "NSPio.h"
 #include "MBEDCurrent.h"
 
-extern ErrorHandler *error_handler;
+extern Logger *logger;
 NSPio *current = NULL;
 
 // observation support
@@ -16,19 +16,19 @@
 // send our current observation
 void send_current_observation() {
     if (current_obs_token_ptr != NULL && current_obs_number != 0) {
-        //if (error_handler != NULL) error_handler->log("Sending Observation (current): %s",current->resource()->getValuePointer());
+        //if (m_logger != NULL) m_logger->log("Sending Observation (current): %s",current->resource()->getValuePointer());
         sn_nsdl_send_observation_notification(current_obs_token_ptr,current_obs_token_len,(uint8_t*)current->resource()->getValuePointer(),strlen(current->resource()->getValuePointer()),&current_obs_number,sizeof(current_obs_number),COAP_MSG_TYPE_NON_CONFIRMABLE, 0);
     }
 }
 
 // init current
 void init_current(Resource *resource) {
-    if (current == NULL && resource != NULL) current = new NSPio(new MBEDCurrent(error_handler,resource),&send_current_observation);
+    if (current == NULL && resource != NULL) current = new NSPio(new MBEDCurrent(m_logger,resource),&send_current_observation);
 }
 
 // update our current observation
 void update_current_observation(sn_coap_hdr_s *received_coap_ptr,sn_coap_hdr_s *coap_res_ptr) {
-    //if (error_handler != NULL) error_handler->log("Updating Observation (current)...starting");
+    //if (m_logger != NULL) m_logger->log("Updating Observation (current)...starting");
     if (received_coap_ptr->token_ptr != NULL) {
         if (current_obs_token_ptr != NULL) free(current_obs_token_ptr);
         current_obs_token_ptr = (uint8_t *)malloc(received_coap_ptr->token_len);
@@ -44,7 +44,7 @@
         coap_res_ptr->options_list_ptr->observe_len = 1;
         current_obs_number++;
     }
-    //if (error_handler != NULL) error_handler->log("Updating Observation (current)...done");
+    //if (m_logger != NULL) m_logger->log("Updating Observation (current)...done");
 }
 
 /* Only GET method allowed */
diff -r 5b294040c3e0 -r 30c96bd77160 dimmer.cpp
--- a/dimmer.cpp	Fri Sep 19 05:24:41 2014 +0000
+++ b/dimmer.cpp	Fri Sep 26 05:55:55 2014 +0000
@@ -6,7 +6,7 @@
 #include "NSPLightDimmerAction.h"
 #include "NSPio.h"
 
-extern ErrorHandler *error_handler;
+extern Logger *logger;
 extern NSPLightDimmerAction *_dimmerAction;
 
 NSPio *dimmer = NULL;
@@ -19,19 +19,19 @@
 // send our dimmer observation
 void send_dimmer_observation() {
     if (dimmer_obs_token_ptr != NULL && dimmer_obs_number != 0) {
-        //if (error_handler != NULL) error_handler->log("Sending Observation (dimmer): %s",dimmer->resource()->getValuePointer());
+        //if (m_logger != NULL) m_logger->log("Sending Observation (dimmer): %s",dimmer->resource()->getValuePointer());
         sn_nsdl_send_observation_notification(dimmer_obs_token_ptr,dimmer_obs_token_len,(uint8_t*)dimmer->resource()->getValuePointer(),strlen(dimmer->resource()->getValuePointer()),&dimmer_obs_number,sizeof(dimmer_obs_number),COAP_MSG_TYPE_NON_CONFIRMABLE, 0);
     }
 }
 
 // init dimmer
 void init_dimmer(Resource *resource) {
-    if (dimmer == NULL && resource != NULL) dimmer = new NSPio(error_handler,resource,&send_dimmer_observation);
+    if (dimmer == NULL && resource != NULL) dimmer = new NSPio(m_logger,resource,&send_dimmer_observation);
 }
 
 // update our dimmer observation
 void update_dimmer_observation(sn_coap_hdr_s *received_coap_ptr,sn_coap_hdr_s *coap_res_ptr) {
-    //if (error_handler != NULL) error_handler->log("Updating Observation (dimmer)...starting");
+    //if (m_logger != NULL) m_logger->log("Updating Observation (dimmer)...starting");
     if (received_coap_ptr->token_ptr != NULL) {
         if (dimmer_obs_token_ptr != NULL) free(dimmer_obs_token_ptr);
         dimmer_obs_token_ptr = (uint8_t *)malloc(received_coap_ptr->token_len);
@@ -47,7 +47,7 @@
         coap_res_ptr->options_list_ptr->observe_len = 1;
         dimmer_obs_number++;
     }
-    //if (error_handler != NULL) error_handler->log("Updating Observation (dimmer)...done");
+    //if (m_logger != NULL) m_logger->log("Updating Observation (dimmer)...done");
 }
 
 /* Only GET and PUT method allowed */
diff -r 5b294040c3e0 -r 30c96bd77160 gps.cpp
--- a/gps.cpp	Fri Sep 19 05:24:41 2014 +0000
+++ b/gps.cpp	Fri Sep 26 05:55:55 2014 +0000
@@ -5,7 +5,7 @@
 #include "NSPio.h"
 #include "MBEDgps.h"
 
-extern ErrorHandler *error_handler;
+extern Logger *logger;
 NSPio *nsp_gps = NULL;
 
 // observation support
@@ -16,19 +16,19 @@
 // send our gps observation
 void send_gps_observation() {
     if (gps_obs_token_ptr != NULL && gps_obs_number != 0) {
-        //if (error_handler != NULL) error_handler->log("Sending Observation (gps): %s",gps->resource()->getValuePointer());
+        //if (m_logger != NULL) m_logger->log("Sending Observation (gps): %s",gps->resource()->getValuePointer());
         sn_nsdl_send_observation_notification(gps_obs_token_ptr,gps_obs_token_len,(uint8_t*)nsp_gps->resource()->getValuePointer(),strlen(nsp_gps->resource()->getValuePointer()),&gps_obs_number,sizeof(gps_obs_number),COAP_MSG_TYPE_NON_CONFIRMABLE, 0);
     }
 }
 
 // init gps
 void init_gps(Resource *resource) {
-    if (nsp_gps == NULL && resource != NULL) nsp_gps = new NSPio(new MBEDgps(error_handler,resource),&send_gps_observation);
+    if (nsp_gps == NULL && resource != NULL) nsp_gps = new NSPio(new MBEDgps(m_logger,resource),&send_gps_observation);
 }
 
 // update our gps observation
 void update_gps_observation(sn_coap_hdr_s *received_coap_ptr,sn_coap_hdr_s *coap_res_ptr) {
-    //if (error_handler != NULL) error_handler->log("Updating Observation (gps)...starting");
+    //if (m_logger != NULL) m_logger->log("Updating Observation (gps)...starting");
     if (received_coap_ptr->token_ptr != NULL) {
         if (gps_obs_token_ptr != NULL) free(gps_obs_token_ptr);
         gps_obs_token_ptr = (uint8_t *)malloc(received_coap_ptr->token_len);
@@ -44,7 +44,7 @@
         coap_res_ptr->options_list_ptr->observe_len = 1;
         gps_obs_number++;
     }
-    //if (error_handler != NULL) error_handler->log("Updating Observation (gps)...done");
+    //if (m_logger != NULL) m_logger->log("Updating Observation (gps)...done");
 }
 
 /* Only GET method allowed */
diff -r 5b294040c3e0 -r 30c96bd77160 locationtext.cpp
--- a/locationtext.cpp	Fri Sep 19 05:24:41 2014 +0000
+++ b/locationtext.cpp	Fri Sep 26 05:55:55 2014 +0000
@@ -4,7 +4,7 @@
 
 #include "NSPio.h"
 
-extern ErrorHandler *error_handler;
+extern Logger *logger;
 NSPio *locationtext = NULL;
 
 // observation support
@@ -15,19 +15,19 @@
 // send our locationtext observation
 void send_locationtext_observation() {
     if (locationtext_obs_token_ptr != NULL && locationtext_obs_number != 0) {
-        //if (error_handler != NULL) error_handler->log("Sending Observation (locationtext): %s",locationtext->resource()->getValuePointer());
+        //if (m_logger != NULL) m_logger->log("Sending Observation (locationtext): %s",locationtext->resource()->getValuePointer());
         sn_nsdl_send_observation_notification(locationtext_obs_token_ptr,locationtext_obs_token_len,(uint8_t*)locationtext->resource()->getValuePointer(),strlen(locationtext->resource()->getValuePointer()),&locationtext_obs_number,sizeof(locationtext_obs_number),COAP_MSG_TYPE_NON_CONFIRMABLE, 0);
     }
 }
 
 // init locationtext
 void init_locationtext(Resource *resource) {
-    if (locationtext == NULL && resource != NULL) locationtext = new NSPio(error_handler,resource,&send_locationtext_observation);
+    if (locationtext == NULL && resource != NULL) locationtext = new NSPio(m_logger,resource,&send_locationtext_observation);
 }
 
 // update our locationtext observation
 void update_locationtext_observation(sn_coap_hdr_s *received_coap_ptr,sn_coap_hdr_s *coap_res_ptr) {
-    //if (error_handler != NULL) error_handler->log("Updating Observation (locationtext)...starting");
+    //if (m_logger != NULL) m_logger->log("Updating Observation (locationtext)...starting");
     if (received_coap_ptr->token_ptr != NULL) {
         if (locationtext_obs_token_ptr != NULL) free(locationtext_obs_token_ptr);
         locationtext_obs_token_ptr = (uint8_t *)malloc(received_coap_ptr->token_len);
@@ -43,7 +43,7 @@
         coap_res_ptr->options_list_ptr->observe_len = 1;
         locationtext_obs_number++;
     }
-    //if (error_handler != NULL) error_handler->log("Updating Observation (locationtext)...done");
+    //if (m_logger != NULL) m_logger->log("Updating Observation (locationtext)...done");
 }
 
 /* Only GET method allowed */
diff -r 5b294040c3e0 -r 30c96bd77160 mdltext.cpp
--- a/mdltext.cpp	Fri Sep 19 05:24:41 2014 +0000
+++ b/mdltext.cpp	Fri Sep 26 05:55:55 2014 +0000
@@ -4,7 +4,7 @@
 
 #include "NSPio.h"
 
-extern ErrorHandler *error_handler;
+extern Logger *logger;
 NSPio *mdltext = NULL;
 
 // observation support
@@ -15,19 +15,19 @@
 // send our mdltext observation
 void send_mdltext_observation() {
     if (mdltext_obs_token_ptr != NULL && mdltext_obs_number != 0) {
-        //if (error_handler != NULL) error_handler->log("Sending Observation (mdltext): %s",mdltext->resource()->getValuePointer());
+        //if (m_logger != NULL) m_logger->log("Sending Observation (mdltext): %s",mdltext->resource()->getValuePointer());
         sn_nsdl_send_observation_notification(mdltext_obs_token_ptr,mdltext_obs_token_len,(uint8_t*)mdltext->resource()->getValuePointer(),strlen(mdltext->resource()->getValuePointer()),&mdltext_obs_number,sizeof(mdltext_obs_number),COAP_MSG_TYPE_NON_CONFIRMABLE, 0);
     }
 }
 
 // init mdltext
 void init_mdltext(Resource *resource) {
-    if (mdltext == NULL && resource != NULL) mdltext = new NSPio(error_handler,resource,&send_mdltext_observation);
+    if (mdltext == NULL && resource != NULL) mdltext = new NSPio(m_logger,resource,&send_mdltext_observation);
 }
 
 // update our mdltext observation
 void update_mdltext_observation(sn_coap_hdr_s *received_coap_ptr,sn_coap_hdr_s *coap_res_ptr) {
-    //if (error_handler != NULL) error_handler->log("Updating Observation (mdltext)...starting");
+    //if (m_logger != NULL) m_logger->log("Updating Observation (mdltext)...starting");
     if (received_coap_ptr->token_ptr != NULL) {
         if (mdltext_obs_token_ptr != NULL) free(mdltext_obs_token_ptr);
         mdltext_obs_token_ptr = (uint8_t *)malloc(received_coap_ptr->token_len);
@@ -43,7 +43,7 @@
         coap_res_ptr->options_list_ptr->observe_len = 1;
         mdltext_obs_number++;
     }
-    //if (error_handler != NULL) error_handler->log("Updating Observation (mdltext)...done");
+    //if (m_logger != NULL) m_logger->log("Updating Observation (mdltext)...done");
 }
 
 /* Only GET method allowed */
diff -r 5b294040c3e0 -r 30c96bd77160 mfgtext.cpp
--- a/mfgtext.cpp	Fri Sep 19 05:24:41 2014 +0000
+++ b/mfgtext.cpp	Fri Sep 26 05:55:55 2014 +0000
@@ -4,7 +4,7 @@
 
 #include "NSPio.h"
 
-extern ErrorHandler *error_handler;
+extern Logger *logger;
 NSPio *mfgtext = NULL;
 
 // observation support
@@ -15,19 +15,19 @@
 // send our mfgtext observation
 void send_mfgtext_observation() {
     if (mfgtext_obs_token_ptr != NULL && mfgtext_obs_number != 0) {
-        //if (error_handler != NULL) error_handler->log("Sending Observation (mfgtext): %s",mfgtext->resource()->getValuePointer());
+        //if (m_logger != NULL) m_logger->log("Sending Observation (mfgtext): %s",mfgtext->resource()->getValuePointer());
         sn_nsdl_send_observation_notification(mfgtext_obs_token_ptr,mfgtext_obs_token_len,(uint8_t*)mfgtext->resource()->getValuePointer(),strlen(mfgtext->resource()->getValuePointer()),&mfgtext_obs_number,sizeof(mfgtext_obs_number),COAP_MSG_TYPE_NON_CONFIRMABLE, 0);
     }
 }
 
 // init mfgtext
 void init_mfgtext(Resource *resource) {
-    if (mfgtext == NULL && resource != NULL) mfgtext = new NSPio(error_handler,resource,&send_mfgtext_observation);
+    if (mfgtext == NULL && resource != NULL) mfgtext = new NSPio(m_logger,resource,&send_mfgtext_observation);
 }
 
 // update our mfgtext observation
 void update_mfgtext_observation(sn_coap_hdr_s *received_coap_ptr,sn_coap_hdr_s *coap_res_ptr) {
-    //if (error_handler != NULL) error_handler->log("Updating Observation (mfgtext)...starting");
+    //if (m_logger != NULL) m_logger->log("Updating Observation (mfgtext)...starting");
     if (received_coap_ptr->token_ptr != NULL) {
         if (mfgtext_obs_token_ptr != NULL) free(mfgtext_obs_token_ptr);
         mfgtext_obs_token_ptr = (uint8_t *)malloc(received_coap_ptr->token_len);
@@ -43,7 +43,7 @@
         coap_res_ptr->options_list_ptr->observe_len = 1;
         mfgtext_obs_number++;
     }
-    //if (error_handler != NULL) error_handler->log("Updating Observation (mfgtext)...done");
+    //if (m_logger != NULL) m_logger->log("Updating Observation (mfgtext)...done");
 }
 
 /* Only GET method allowed */
diff -r 5b294040c3e0 -r 30c96bd77160 nsdl_support.cpp
--- a/nsdl_support.cpp	Fri Sep 19 05:24:41 2014 +0000
+++ b/nsdl_support.cpp	Fri Sep 26 05:55:55 2014 +0000
@@ -2,9 +2,9 @@
 
 #include "mbed.h"
 #include "nsdl_support.h"
-#include "ErrorHandler.h"
+#include "Logger.h"
 
-extern ErrorHandler *error_handler;
+extern Logger *m_logger;
 #ifdef NETWORK_MUTEX
 extern Mutex *network_mutex;
 #endif
@@ -94,15 +94,15 @@
 }
 
 static uint8_t tx_cb(sn_nsdl_capab_e protocol, uint8_t *data_ptr, uint16_t data_len, sn_nsdl_addr_s *address_ptr) {
-    //if (error_handler != NULL) error_handler->log("NSP: sending %d bytes...",data_len);
+    //if (m_logger != NULL) m_logger->log("NSP: sending %d bytes...",data_len);
     int sent = server.sendTo(nsp, (char*)data_ptr, data_len);
 
-    //if (error_handler != NULL) error_handler->log("NSP: send done. sent %d bytes...",sent);
+    //if (m_logger != NULL) m_logger->log("NSP: send done. sent %d bytes...",sent);
     if (sent != data_len) {
-       if (error_handler != NULL) error_handler->log("NSP: send failed!! Attempted: %d Sent: %d", data_len, sent);
+       if (m_logger != NULL) m_logger->log("NSP: send failed!! Attempted: %d Sent: %d", data_len, sent);
     }
     else {
-       if (error_handler != NULL) error_handler->blinkTransportTxLED();
+       if (m_logger != NULL) m_logger->blinkTransportTxLED();
     }
 
     return 1;
@@ -110,7 +110,7 @@
 
 static uint8_t rx_cb(sn_coap_hdr_s *coap_packet_ptr, sn_nsdl_addr_s *address_ptr) {
     // Rx callback process it...
-    if (error_handler != NULL) error_handler->blinkTransportRxLED();
+    if (m_logger != NULL) m_logger->blinkTransportRxLED();
     return 0;
 }
 
@@ -135,19 +135,19 @@
         if (count%registration_time == 0) {
             // re-registration time!
             count = 0;
-            if (error_handler != NULL) error_handler->log("NSP: (re)registering...");
+            if (m_logger != NULL) m_logger->log("NSP: (re)registering...");
             register_endpoint(false);
-            if (error_handler != NULL) error_handler->log("NSP: (re)registering complete.");
+            if (m_logger != NULL) m_logger->log("NSP: (re)registering complete.");
         }
         else {
             if (count%RD_UPDATE_PERIOD == 0) {
                 if (endpoint != NULL) endpoint->sendObservations();
             }
-            if (error_handler != NULL) {
-                 error_handler->checkForExit();
+            if (m_logger != NULL) {
+                 m_logger->checkForExit();
             }
         }
-        if (error_handler != NULL) error_handler->blinkTransportRxLED();
+        if (m_logger != NULL) m_logger->blinkTransportRxLED();
     }
 }
 
@@ -161,10 +161,10 @@
     memory_cbs.sn_nsdl_alloc = &nsdl_alloc;
     memory_cbs.sn_nsdl_free = &nsdl_free;
     if(sn_nsdl_init(&tx_cb, &rx_cb, &memory_cbs) == -1) {
-        if (error_handler != NULL) error_handler->log("NSP: libNsdl init failed");
+        if (m_logger != NULL) m_logger->log("NSP: libNsdl init failed");
     }
     else {
-        if (error_handler != NULL) error_handler->log("NSP: libNsdl init successful");
+        if (m_logger != NULL) m_logger->log("NSP: libNsdl init successful");
     }
 
     /* Set nsp address for library */
@@ -189,14 +189,14 @@
     
     // FOREVER: main loop for event processing  
     while(true) {        
-        //if (error_handler != NULL) error_handler->log("NSP: waiting for data...");
+        //if (m_logger != NULL) m_logger->log("NSP: waiting for data...");
         int n = server.receiveFrom(from,nsp_buffer,sizeof(nsp_buffer));
 
-        //if (error_handler != NULL) error_handler->log("NSP: received %d bytes... processing...",n);
+        //if (m_logger != NULL) m_logger->log("NSP: received %d bytes... processing...",n);
         if (n >= 0) sn_nsdl_process_coap((uint8_t*)nsp_buffer,n,&received_packet_address);
         
-        //if (error_handler != NULL) error_handler->log("NSP: done processing %d bytes...",n);
-        if (error_handler != NULL) error_handler->blinkTransportRxLED();
+        //if (m_logger != NULL) m_logger->log("NSP: done processing %d bytes...",n);
+        if (m_logger != NULL) m_logger->blinkTransportRxLED();
 
         // perform any extra event loop work
         if (endpoint != NULL) endpoint->extraEventLoopWork();
diff -r 5b294040c3e0 -r 30c96bd77160 nsdl_support.h
--- a/nsdl_support.h	Fri Sep 19 05:24:41 2014 +0000
+++ b/nsdl_support.h	Fri Sep 26 05:55:55 2014 +0000
@@ -3,7 +3,7 @@
 #ifndef NSDL_SUPPORT_H
 #define NSDL_SUPPORT_H
 
-#include "ErrorHandler.h"
+#include "Logger.h"
 
 #ifndef CELLULAR_NETWORK
 #include "EthernetInterface.h"
@@ -47,6 +47,6 @@
     #include "EthernetInterface.h"
     extern EthernetInterface ethernet;
 #endif
-extern ErrorHandler *error_handler;
+extern Logger *m_logger;
 
 #endif // NSDL_SUPPORT_H
diff -r 5b294040c3e0 -r 30c96bd77160 nsp_get.cpp
--- a/nsp_get.cpp	Fri Sep 19 05:24:41 2014 +0000
+++ b/nsp_get.cpp	Fri Sep 26 05:55:55 2014 +0000
@@ -5,33 +5,33 @@
 // NSP Get Method
 uint8_t nsp_get(char *tag,MBEDio *io,sn_coap_hdr_s *received_coap_ptr, sn_nsdl_addr_s *address, sn_proto_info_s *proto) { return nsp_get(tag,io,received_coap_ptr,address,proto,NULL); }
 uint8_t nsp_get(char *tag,MBEDio *io,sn_coap_hdr_s *received_coap_ptr, sn_nsdl_addr_s *address, sn_proto_info_s *proto,sn_update_observation_t observer) {
-if (error_handler != NULL) error_handler->log_memory("NSP GET MEMORY CHECK(begin)");
+if (m_logger != NULL) m_logger->log_memory("NSP GET MEMORY CHECK(begin)");
 #ifdef NSP_ENABLE_GET
-    //if (error_handler != NULL) error_handler->log("NSP: %s requested",tag);
+    //if (m_logger != NULL) m_logger->log("NSP: %s requested",tag);
     sn_coap_hdr_s *coap_res_ptr = NULL;
     coap_res_ptr = sn_coap_build_response(received_coap_ptr,COAP_MSG_CODE_RESPONSE_CONTENT);
     if (coap_res_ptr != NULL && io != NULL && io->stringValue() != NULL) {      // io->stringValue() refreshes the value
         coap_res_ptr->msg_type = COAP_MSG_TYPE_CONFIRMABLE;
         coap_res_ptr->payload_len = strlen(io->resource()->getValuePointer());
         coap_res_ptr->payload_ptr = (uint8_t*)io->resource()->getValuePointer();
-        //if (error_handler != NULL) error_handler->log("NSP: Sending %s = %s...",tag,io->resource()->getValuePointer());
+        //if (m_logger != NULL) m_logger->log("NSP: Sending %s = %s...",tag,io->resource()->getValuePointer());
         if (observer != NULL) (observer)(received_coap_ptr,coap_res_ptr);
         sn_nsdl_send_coap_message(address, coap_res_ptr);
-        if (error_handler != NULL) error_handler->log("NSP: Sent %s = %s...",tag,io->resource()->getValuePointer());
+        if (m_logger != NULL) m_logger->log("NSP: Sent %s = %s...",tag,io->resource()->getValuePointer());
     }
     else if (coap_res_ptr == NULL) {
-        if (error_handler != NULL) error_handler->log("NSP: %s request: coap_res_ptr is NULL!",tag);
+        if (m_logger != NULL) m_logger->log("NSP: %s request: coap_res_ptr is NULL!",tag);
     }
     else {
-        if (error_handler != NULL) error_handler->log("NSP: %s request: MBEDio is NULL!",tag);
+        if (m_logger != NULL) m_logger->log("NSP: %s request: MBEDio is NULL!",tag);
     }
     if (coap_res_ptr != NULL && coap_res_ptr->options_list_ptr != NULL) coap_res_ptr->options_list_ptr->observe_ptr = NULL;
     if (coap_res_ptr != NULL) sn_coap_parser_release_allocated_coap_msg_mem(coap_res_ptr);
-    if (error_handler != NULL) error_handler->log_memory("NSP GET MEMORY CHECK(done)");
+    if (m_logger != NULL) m_logger->log_memory("NSP GET MEMORY CHECK(done)");
     return 0;
 #else
-    if (error_handler != NULL) error_handler->log("NSP Get() functions disabled for %s",tag);
-    if (error_handler != NULL) error_handler->log_memory("NSP GET MEMORY CHECK(off)");
+    if (m_logger != NULL) m_logger->log("NSP Get() functions disabled for %s",tag);
+    if (m_logger != NULL) m_logger->log_memory("NSP GET MEMORY CHECK(off)");
     return 0;
 #endif
 }
\ No newline at end of file
diff -r 5b294040c3e0 -r 30c96bd77160 nsp_getput.cpp
--- a/nsp_getput.cpp	Fri Sep 19 05:24:41 2014 +0000
+++ b/nsp_getput.cpp	Fri Sep 26 05:55:55 2014 +0000
@@ -5,41 +5,41 @@
 // NSP Get/Put Method
 uint8_t nsp_getput(char *tag,NSPio *io,sn_coap_hdr_s *received_coap_ptr, sn_nsdl_addr_s *address, sn_proto_info_s *proto) { return nsp_getput(tag,io,received_coap_ptr,address,proto,NULL); }
 uint8_t nsp_getput(char *tag,NSPio *io,sn_coap_hdr_s *received_coap_ptr, sn_nsdl_addr_s *address, sn_proto_info_s *proto,sn_update_observation_t observer) {
-if (error_handler != NULL) error_handler->log_memory("NSP GETPUT MEMORY CHECK(begin)");
+if (m_logger != NULL) m_logger->log_memory("NSP GETPUT MEMORY CHECK(begin)");
 #ifdef NSP_ENABLE_GETPUT
     sn_coap_hdr_s *coap_res_ptr = NULL;
     bool is_get = false;
 
     if(received_coap_ptr->msg_code == COAP_MSG_CODE_REQUEST_GET)
     {
-        //if (error_handler != NULL) error_handler->log("NSP: %s requested",tag);
+        //if (m_logger != NULL) m_logger->log("NSP: %s requested",tag);
         coap_res_ptr = sn_coap_build_response(received_coap_ptr, COAP_MSG_CODE_RESPONSE_CONTENT);
         if (coap_res_ptr != NULL && io != NULL && io->stringValue() != NULL) {      // io->stringValue() refreshes the value
             coap_res_ptr->msg_type = COAP_MSG_TYPE_CONFIRMABLE;
             coap_res_ptr->payload_len = strlen(io->resource()->getValuePointer());
             coap_res_ptr->payload_ptr = (uint8_t*)io->resource()->getValuePointer();
-            //if (error_handler != NULL) error_handler->log("NSP: Sending %s = %s...",tag,io->resource()->getValuePointer());
+            //if (m_logger != NULL) m_logger->log("NSP: Sending %s = %s...",tag,io->resource()->getValuePointer());
             if (observer != NULL) (observer)(received_coap_ptr,coap_res_ptr);
             sn_nsdl_send_coap_message(address, coap_res_ptr);
-            if (error_handler != NULL) error_handler->log("NSP: Sent %s = %s...",tag,io->resource()->getValuePointer());
+            if (m_logger != NULL) m_logger->log("NSP: Sent %s = %s...",tag,io->resource()->getValuePointer());
         }
         else if (coap_res_ptr == NULL) {
-            if (error_handler != NULL) error_handler->log("NSP: %s location request: coap_res_ptr is NULL!",tag);
+            if (m_logger != NULL) m_logger->log("NSP: %s location request: coap_res_ptr is NULL!",tag);
         }
         else {
-            if (error_handler != NULL) error_handler->log("NSP: %s location request: NSPio is NULL!",tag);
+            if (m_logger != NULL) m_logger->log("NSP: %s location request: NSPio is NULL!",tag);
         }
         is_get = true;
     }
     else if(received_coap_ptr->msg_code == COAP_MSG_CODE_REQUEST_PUT)
-    {   //if (error_handler != NULL) error_handler->log("NSP: setting %s",tag);
+    {   //if (m_logger != NULL) m_logger->log("NSP: setting %s",tag);
         // copy the new value
         if (io->resource() != NULL && received_coap_ptr->payload_ptr != NULL && received_coap_ptr->payload_len > 0) {
             io->resource()->setValue((char *)received_coap_ptr->payload_ptr,received_coap_ptr->payload_len);
-            if (error_handler != NULL) error_handler->log("NSP: set %s to %s...",tag,io->resource()->getValuePointer());
+            if (m_logger != NULL) m_logger->log("NSP: set %s to %s...",tag,io->resource()->getValuePointer());
         }
         else {
-            if (error_handler != NULL) error_handler->log("NSP: %s resource pointer is NULL",tag);
+            if (m_logger != NULL) m_logger->log("NSP: %s resource pointer is NULL",tag);
         }
         
         // response back
@@ -48,11 +48,11 @@
     }
     if (is_get && coap_res_ptr != NULL && coap_res_ptr->options_list_ptr != NULL) coap_res_ptr->options_list_ptr->observe_ptr = NULL;
     if (coap_res_ptr != NULL) sn_coap_parser_release_allocated_coap_msg_mem(coap_res_ptr);
-    if (error_handler != NULL) error_handler->log_memory("NSP GETPUT MEMORY CHECK(done)");
+    if (m_logger != NULL) m_logger->log_memory("NSP GETPUT MEMORY CHECK(done)");
     return 0;
 #else
-    if (error_handler != NULL) error_handler->log("NSP GetPut() functions disabled for %s",tag);
-    if (error_handler != NULL) error_handler->log_memory("NSP GETPUT MEMORY CHECK(off)");
+    if (m_logger != NULL) m_logger->log("NSP GetPut() functions disabled for %s",tag);
+    if (m_logger != NULL) m_logger->log_memory("NSP GETPUT MEMORY CHECK(off)");
     return 0;
 #endif
 }
\ No newline at end of file
diff -r 5b294040c3e0 -r 30c96bd77160 rssi.cpp
--- a/rssi.cpp	Fri Sep 19 05:24:41 2014 +0000
+++ b/rssi.cpp	Fri Sep 26 05:55:55 2014 +0000
@@ -5,7 +5,7 @@
 #include "NSPio.h"
 #include "MBEDrssi.h"
 
-extern ErrorHandler *error_handler;
+extern Logger *logger;
 NSPio *rssi = NULL;
 
 // observation support
@@ -16,19 +16,19 @@
 // send our rssi observation
 void send_rssi_observation() {
     if (rssi_obs_token_ptr != NULL && rssi_obs_number != 0) {
-        //if (error_handler != NULL) error_handler->log("Sending Observation (rssi): %s",rssi->resource()->getValuePointer());
+        //if (m_logger != NULL) m_logger->log("Sending Observation (rssi): %s",rssi->resource()->getValuePointer());
         sn_nsdl_send_observation_notification(rssi_obs_token_ptr,rssi_obs_token_len,(uint8_t*)rssi->resource()->getValuePointer(),strlen(rssi->resource()->getValuePointer()),&rssi_obs_number,sizeof(rssi_obs_number),COAP_MSG_TYPE_NON_CONFIRMABLE, 0);
     }
 }
 
 // init rssi
 void init_rssi(Resource *resource) {
-    if (rssi == NULL && resource != NULL) rssi = new NSPio(new MBEDrssi(error_handler,resource),&send_rssi_observation);
+    if (rssi == NULL && resource != NULL) rssi = new NSPio(new MBEDrssi(m_logger,resource),&send_rssi_observation);
 }
 
 // update our rssi observation
 void update_rssi_observation(sn_coap_hdr_s *received_coap_ptr,sn_coap_hdr_s *coap_res_ptr) {
-    //if (error_handler != NULL) error_handler->log("Updating Observation (rssi)...starting");
+    //if (m_logger != NULL) m_logger->log("Updating Observation (rssi)...starting");
     if (received_coap_ptr->token_ptr != NULL) {
         if (rssi_obs_token_ptr != NULL) free(rssi_obs_token_ptr);
         rssi_obs_token_ptr = (uint8_t *)malloc(received_coap_ptr->token_len);
@@ -44,7 +44,7 @@
         coap_res_ptr->options_list_ptr->observe_len = 1;
         rssi_obs_number++;
     }
-    //if (error_handler != NULL) error_handler->log("Updating Observation (rssi)...done");
+    //if (m_logger != NULL) m_logger->log("Updating Observation (rssi)...done");
 }
 
 /* Only GET method allowed */
diff -r 5b294040c3e0 -r 30c96bd77160 switch.cpp
--- a/switch.cpp	Fri Sep 19 05:24:41 2014 +0000
+++ b/switch.cpp	Fri Sep 26 05:55:55 2014 +0000
@@ -6,7 +6,7 @@
 #include "NSPLightSwitchAction.h"
 #include "NSPio.h"
 
-extern ErrorHandler *error_handler;
+extern Logger *logger;
 extern NSPLightSwitchAction *_switchAction;
 
 NSPio *light_sw = NULL;
@@ -19,20 +19,20 @@
 // send our light_sw observation
 void send_light_sw_observation() {
     if (light_sw_obs_token_ptr != NULL && light_sw_obs_number != 0) {
-        //if (error_handler != NULL) error_handler->log("Sending Observation (switch): %s",light_sw->resource()->getValuePointer());
+        //if (m_logger != NULL) m_logger->log("Sending Observation (switch): %s",light_sw->resource()->getValuePointer());
         sn_nsdl_send_observation_notification(light_sw_obs_token_ptr,light_sw_obs_token_len,(uint8_t*)light_sw->resource()->getValuePointer(),strlen(light_sw->resource()->getValuePointer()),&light_sw_obs_number,sizeof(light_sw_obs_number),COAP_MSG_TYPE_NON_CONFIRMABLE, 0);
     }
 }
 
 // init light switch
 void init_switch(Resource *resource) {
-    if (light_sw == NULL && resource != NULL) light_sw = new NSPio(error_handler,resource,&send_light_sw_observation);
+    if (light_sw == NULL && resource != NULL) light_sw = new NSPio(m_logger,resource,&send_light_sw_observation);
 }
 
 
 // update our light_sw observation
 void update_light_sw_observation(sn_coap_hdr_s *received_coap_ptr,sn_coap_hdr_s *coap_res_ptr) {
-    //if (error_handler != NULL) error_handler->log("Updating Observation (switch)...starting");
+    //if (m_logger != NULL) m_logger->log("Updating Observation (switch)...starting");
     if (received_coap_ptr->token_ptr != NULL) {
         if (light_sw_obs_token_ptr != NULL) free(light_sw_obs_token_ptr);
         light_sw_obs_token_ptr = (uint8_t *)malloc(received_coap_ptr->token_len);
@@ -48,7 +48,7 @@
         coap_res_ptr->options_list_ptr->observe_len = 1;
         light_sw_obs_number++;
     }
-    //if (error_handler != NULL) error_handler->log("Updating Observation (switch)...done");
+    //if (m_logger != NULL) m_logger->log("Updating Observation (switch)...done");
 }
 
 /* Only GET and PUT method allowed */
diff -r 5b294040c3e0 -r 30c96bd77160 temperature.cpp
--- a/temperature.cpp	Fri Sep 19 05:24:41 2014 +0000
+++ b/temperature.cpp	Fri Sep 26 05:55:55 2014 +0000
@@ -5,7 +5,7 @@
 #include "NSPio.h"
 #include "MBEDTemperature.h"
 
-extern ErrorHandler *error_handler;
+extern Logger *logger;
 
 NSPio *temp = NULL;
 
@@ -17,19 +17,19 @@
 // send our temp observation
 void send_temp_observation() {
     if (temp_obs_token_ptr != NULL && temp_obs_number != 0) {
-        //if (error_handler != NULL) error_handler->log("Sending Observation (temp): %s",temp->resource()->getValuePointer());
+        //if (m_logger != NULL) m_logger->log("Sending Observation (temp): %s",temp->resource()->getValuePointer());
         sn_nsdl_send_observation_notification(temp_obs_token_ptr,temp_obs_token_len,(uint8_t*)temp->resource()->getValuePointer(),strlen(temp->resource()->getValuePointer()),&temp_obs_number,sizeof(temp_obs_number),COAP_MSG_TYPE_NON_CONFIRMABLE, 0);
     }
 }
 
 // init temp
 void init_temp(Resource *resource) {
-    if (temp == NULL && resource != NULL) temp = new NSPio(new MBEDTemperature(error_handler,resource),&send_temp_observation);
+    if (temp == NULL && resource != NULL) temp = new NSPio(new MBEDTemperature(m_logger,resource),&send_temp_observation);
 }
 
 // update our temp observation
 void update_temp_observation(sn_coap_hdr_s *received_coap_ptr,sn_coap_hdr_s *coap_res_ptr) {
-    //if (error_handler != NULL) error_handler->log("Updating Observation (temp)...starting");
+    //if (m_logger != NULL) m_logger->log("Updating Observation (temp)...starting");
     if (received_coap_ptr->token_ptr != NULL) {
         if (temp_obs_token_ptr != NULL) free(temp_obs_token_ptr);
         temp_obs_token_ptr = (uint8_t *)malloc(received_coap_ptr->token_len);
@@ -45,7 +45,7 @@
         coap_res_ptr->options_list_ptr->observe_len = 1;
         temp_obs_number++;
     }
-    //if (error_handler != NULL) error_handler->log("Updating Observation (temp)...done");
+    //if (m_logger != NULL) m_logger->log("Updating Observation (temp)...done");
 }
 
 /* Only GET method allowed */
diff -r 5b294040c3e0 -r 30c96bd77160 voltage.cpp
--- a/voltage.cpp	Fri Sep 19 05:24:41 2014 +0000
+++ b/voltage.cpp	Fri Sep 26 05:55:55 2014 +0000
@@ -5,7 +5,7 @@
 #include "NSPio.h"
 #include "MBEDVoltage.h"
 
-extern ErrorHandler *error_handler;
+extern Logger *logger;
 
 NSPio *voltage = NULL;
 
@@ -17,19 +17,19 @@
 // send our voltage observation
 void send_voltage_observation() {
     if (voltage_obs_token_ptr != NULL && voltage_obs_number != 0) {
-        //if (error_handler != NULL) error_handler->log("Sending Observation (voltage): %s",voltage->resource()->getValuePointer());
+        //if (m_logger != NULL) m_logger->log("Sending Observation (voltage): %s",voltage->resource()->getValuePointer());
         sn_nsdl_send_observation_notification(voltage_obs_token_ptr,voltage_obs_token_len,(uint8_t*)voltage->resource()->getValuePointer(),strlen(voltage->resource()->getValuePointer()),&voltage_obs_number,sizeof(voltage_obs_number),COAP_MSG_TYPE_NON_CONFIRMABLE, 0);
     }
 }
 
 // init voltage
 void init_voltage(Resource *resource) {
-    if (voltage == NULL && resource != NULL) voltage = new NSPio(new MBEDVoltage(error_handler,resource),&send_voltage_observation);
+    if (voltage == NULL && resource != NULL) voltage = new NSPio(new MBEDVoltage(m_logger,resource),&send_voltage_observation);
 }
 
 // update our voltage observation
 void update_voltage_observation(sn_coap_hdr_s *received_coap_ptr,sn_coap_hdr_s *coap_res_ptr) {
-    //if (error_handler != NULL) error_handler->log("Updating Observation (voltage)...starting");
+    //if (m_logger != NULL) m_logger->log("Updating Observation (voltage)...starting");
     if (received_coap_ptr->token_ptr != NULL) {
         if (voltage_obs_token_ptr != NULL) free(voltage_obs_token_ptr);
         voltage_obs_token_ptr = (uint8_t *)malloc(received_coap_ptr->token_len);
@@ -45,7 +45,7 @@
         coap_res_ptr->options_list_ptr->observe_len = 1;
         voltage_obs_number++;
     }
-    //if (error_handler != NULL) error_handler->log("Updating Observation (voltage)...done");
+    //if (m_logger != NULL) m_logger->log("Updating Observation (voltage)...done");
 }
 
 /* Only GET method allowed */
diff -r 5b294040c3e0 -r 30c96bd77160 wattage.cpp
--- a/wattage.cpp	Fri Sep 19 05:24:41 2014 +0000
+++ b/wattage.cpp	Fri Sep 26 05:55:55 2014 +0000
@@ -5,7 +5,7 @@
 #include "NSPio.h"
 #include "MBEDWattage.h"
 
-extern ErrorHandler *error_handler;
+extern Logger *logger;
 
 NSPio *wattage = NULL;
 
@@ -17,19 +17,19 @@
 // send our wattage observation
 void send_wattage_observation() {
     if (wattage_obs_token_ptr != NULL && wattage_obs_number != 0) {
-        //if (error_handler != NULL) error_handler->log("Sending Observation (wattage): %s",wattage->resource()->getValuePointer());
+        //if (m_logger != NULL) logger->log("Sending Observation (wattage): %s",wattage->resource()->getValuePointer());
         sn_nsdl_send_observation_notification(wattage_obs_token_ptr,wattage_obs_token_len,(uint8_t*)wattage->resource()->getValuePointer(),strlen(wattage->resource()->getValuePointer()),&wattage_obs_number,sizeof(wattage_obs_number),COAP_MSG_TYPE_NON_CONFIRMABLE, 0);
     }
 }
 
 // init wattage
 void init_wattage(Resource *resource) {
-    if (wattage == NULL && resource != NULL) wattage = new NSPio(new MBEDWattage(error_handler,resource),&send_wattage_observation);
+    if (wattage == NULL && resource != NULL) wattage = new NSPio(new MBEDWattage(m_logger,resource),&send_wattage_observation);
 }
 
 // update our wattage observation
 void update_wattage_observation(sn_coap_hdr_s *received_coap_ptr,sn_coap_hdr_s *coap_res_ptr) {
-    //if (error_handler != NULL) error_handler->log("Updating Observation (wattage)...starting");
+    //if (m_logger != NULL) logger->log("Updating Observation (wattage)...starting");
     if (received_coap_ptr->token_ptr != NULL) {
         if (wattage_obs_token_ptr != NULL) free(wattage_obs_token_ptr);
         wattage_obs_token_ptr = (uint8_t *)malloc(received_coap_ptr->token_len);
@@ -45,7 +45,7 @@
         coap_res_ptr->options_list_ptr->observe_len = 1;
         wattage_obs_number++;
     }
-    //if (error_handler != NULL) error_handler->log("Updating Observation (wattage)...done");
+    //if (m_logger != NULL) logger->log("Updating Observation (wattage)...done");
 }
 
 /* Only GET method allowed */