nsp specific components for the NSP version of the impact endpoint
Dependents: mbed_nsp_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_ethernet mbed_nsp_endpoint_nxp
Diff: MBEDEndpoint.cpp
- Revision:
- 23:6f6e97a276b9
- Parent:
- 22:0f2a0269ce6d
- Child:
- 24:b62fec3ff73c
--- a/MBEDEndpoint.cpp Wed Jul 02 20:17:30 2014 +0000 +++ b/MBEDEndpoint.cpp Thu Aug 28 21:17:12 2014 +0000 @@ -29,14 +29,20 @@ #include "NSPLightDimmerAction.h" #include "NSPLightSwitchAction.h" + // Salesforce Status Reporting (if enabled) + #if SF_STATUS_REPORTING + #include "StatusReporter.h" + #endif + // shutdown endpoint reference extern void closedown(int code); // default constructor - MBEDEndpoint::MBEDEndpoint(ErrorHandler *error_handler,void *transport,void *extra) : BaseClass(error_handler,NULL) { + MBEDEndpoint::MBEDEndpoint(ErrorHandler *error_handler,void *transport,void *status_reporter,void *extra) : BaseClass(error_handler,NULL) { bool success = true; this->m_preferences = NULL; this->m_instance_id = 0; + this->m_status_reporter = status_reporter; memset(this->m_lcd_status,0,TEMP_BUFFER_LEN+1); memset(this->m_nsp_address,0,PREFERENCE_VALUE_LEN+1); memset(this->m_nsp_port_str_def,0,PREFERENCE_VALUE_LEN+1); @@ -329,5 +335,16 @@ void MBEDEndpoint::run() { this->logger()->log("Endpoint Main Loop"); this->m_transports[NSP_TRANSPORT]->checkAndProcess(); -} + } + + // do any extra work from within the event loop + void MBEDEndpoint::extraEventLoopWork() { + // check and send status reporting if enabled + #if SF_STATUS_REPORTING + if (this->m_status_reporter != NULL) { + StatusReporter *status_reporter = (StatusReporter *)this->m_status_reporter; + status_reporter->checkAndReportOnStatus(); + } + #endif + } \ No newline at end of file