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:
- 54:dfee8691c83a
- Parent:
- 35:782c99a7a290
- Child:
- 122:4072e03884e4
--- a/source/TickerResourceObserver.cpp Mon Aug 08 19:02:00 2016 +0000 +++ b/source/TickerResourceObserver.cpp Tue Aug 09 17:18:49 2016 +0000 @@ -29,8 +29,14 @@ TickerResourceObserver::TickerResourceObserver(DynamicResource *resource,int sleep_time) : ResourceObserver(resource,(int)(sleep_time/1000)) { this->setObserving(false); + // DEBUG - std::printf("TickerResourceObserver being used for %s (sleep_time=%d)\r\n",resource->getFullName().c_str(),sleep_time); + 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()); + } } // destructor @@ -57,5 +63,10 @@ void TickerResourceObserver::stopObservation() { this->setObserving(false); } + + // halt the underlying observer mechanism + void TickerResourceObserver::halt() { + this->m_ticker.detach(); + } #endif // CONNECTOR_USING_TICKER \ No newline at end of file