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
Diff: battery.cpp
- Revision:
- 3:30c96bd77160
- Parent:
- 0:b26c3526ee89
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 */