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/ThreadedResourceObserver.cpp
- Revision:
- 67:0c130dc6b489
- Parent:
- 66:764ec3dd205a
- Child:
- 68:d016acf33ab4
diff -r 764ec3dd205a -r 0c130dc6b489 source/ThreadedResourceObserver.cpp --- a/source/ThreadedResourceObserver.cpp Mon Aug 22 18:18:23 2016 +0000 +++ b/source/ThreadedResourceObserver.cpp Mon Aug 22 19:36:45 2016 +0000 @@ -49,13 +49,22 @@ } // thread task method - void ThreadedResourceObserver::observation_task() { - while(true) { - Thread::wait(this->getSleepTime()); - if (this->isObserving() == true && this->getResource() != NULL && this->getResource()->isRegistered() == true) { - this->getResource()->observe(); + void ThreadedResourceObserver::observation_task(ThreadedResourceObserver *me) { + if (me != NULL) { + while(true) { + Thread::wait(me->getSleepTime()); + if (me->isObserving() == true && me->getResource() != NULL && me->getResource()->isRegistered() == true) { + Resource *res = me->getResource(); + if (res != NULL) { + res->observe(); + } + } } } + else { + // instance pointer is NULL + printf("ThreadedResourceObserver::observation_task(): ERROR: Instance pointer is NULL\r\n"); + } } // begin observing...