mbed Connector Interface simplification API on top of mbed-client

Fork of mbedConnectorInterfaceV3 by Doug Anson

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!

Revision:
126:f37e34daa100
Parent:
125:4bf229bf14a3
--- a/source/EventQueueResourceObserver.cpp	Thu Jul 13 19:21:28 2017 +0000
+++ b/source/EventQueueResourceObserver.cpp	Thu Jul 13 20:43:26 2017 +0000
@@ -25,6 +25,9 @@
  
  #ifdef CONNECTOR_USING_EVENT_QUEUES
  
+ // our instance
+ static void *_instance = NULL;
+ 
  // constructor
  EventQueueResourceObserver::EventQueueResourceObserver(DynamicResource *resource,int sleep_time) : ResourceObserver(resource,sleep_time), m_event_queue() {
         // default is not observing...
@@ -33,8 +36,11 @@
         // DEBUG
         this->logger()->log("EventQueueResourceObserver being used for %s (sleep_time: %d ms)",resource->getFullName().c_str(),sleep_time);
         
+        // our instance
+        _instance = (void *)this;
+        
         // start the thread by invoking the thread task...
-        this->m_id = this->m_event_queue.call_every(sleep_time,callback(this,&EventQueueResourceObserver::observation_task));
+        this->m_id = this->m_event_queue.call_every(sleep_time,EventQueueResourceObserver::observation_task);
  }
  
  // destructor
@@ -45,8 +51,9 @@
  
  // observation task method
  void EventQueueResourceObserver::observation_task() {
-     if (this->isObserving() == true && this->getResource() != NULL) {
-         DynamicResource *res = this->getResource();
+     EventQueueResourceObserver *me = (EventQueueResourceObserver *)_instance;
+     if (me != NULL && me->isObserving() == true && me->getResource() != NULL) {
+         DynamicResource *res = me->getResource();
          if (res != NULL && res->isRegistered() == true) {
              res->observe();
          }