mbed Connector Interface simplification API on top of mbed-client
Fork of mbedConnectorInterfaceV3 by
NOTE:
This repo has been replaced with https://github.com/ARMmbed/mbedConnectorInterface. No further updates will occur with this repo. Please use the github repo instead. Thanks!
Diff: source/TickerResourceObserver.cpp
- Revision:
- 122:4072e03884e4
- Parent:
- 54:dfee8691c83a
- Child:
- 126:f37e34daa100
--- a/source/TickerResourceObserver.cpp Fri Mar 31 06:21:29 2017 +0000 +++ b/source/TickerResourceObserver.cpp Thu Jul 13 18:48:54 2017 +0000 @@ -26,17 +26,11 @@ #ifdef CONNECTOR_USING_TICKER // constructor - TickerResourceObserver::TickerResourceObserver(DynamicResource *resource,int sleep_time) : - ResourceObserver(resource,(int)(sleep_time/1000)) { + TickerResourceObserver::TickerResourceObserver(DynamicResource *resource,int sleep_time) : ResourceObserver(resource,(int)(sleep_time/1000)) { this->setObserving(false); // DEBUG - if (sleep_time > 0) { - this->logger()->log("TickerResourceObserver being used for %s (sleep_time: %d ms)",resource->getFullName().c_str(),sleep_time); - } - else { - this->logger()->log("TickerResourceObserver being used for %s",resource->getFullName().c_str()); - } + this->logger()->log("TickerResourceObserver being used for %s (sleep_time: %d ms)",resource->getFullName().c_str(),sleep_time); } // destructor @@ -44,10 +38,13 @@ this->stopObservation(); } - // notifier - void TickerResourceObserver::observationNotifier() { - if (this->isObserving() == true && this->getResource() != NULL && this->getResource()->isRegistered() == true) { - this->getResource()->observe(); + // observation task method + void TickerResourceObserver::observation_task() { + if (this->isObserving() == true && this->getResource() != NULL) { + DynamicResource *res = this->getResource(); + if (res != NULL && res->isRegistered() == true) { + res->observe(); + } } }