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:
125:4bf229bf14a3
Parent:
54:dfee8691c83a
Child:
126:f37e34daa100
--- a/source/MinarResourceObserver.cpp	Mon Jun 05 21:28:42 2017 +0000
+++ b/source/MinarResourceObserver.cpp	Thu Jul 13 19:21:28 2017 +0000
@@ -23,19 +23,14 @@
 // class support
 #include "mbed-connector-interface/MinarResourceObserver.h"
 
-#if defined(MCI_MINAR_SCHEDULER)
+#if defined (MCI_MINAR_SCHEDULER)
 
  // constructor
  MinarResourceObserver::MinarResourceObserver(DynamicResource *resource,int sleep_time) : ResourceObserver(resource,sleep_time) {
      this->setObserving(false);
         
      // DEBUG
-     if (sleep_time > 0) {
-        this->logger()->log("MinarResourceObserver being used for %s (sleep_time: %d ms)",resource->getFullName().c_str(),sleep_time);
-     }
-     else {
-        this->logger()->log("MinarResourceObserver being used for %s",resource->getFullName().c_str());
-     }
+     this->logger()->log("MinarResourceObserver being used for %s (sleep_time: %d ms)",resource->getFullName().c_str(),sleep_time);
  }
 
  // destructor
@@ -43,10 +38,13 @@
      this->stopObservation();
  }
 
- // notifier
+ // observation task method
  void MinarResourceObserver::perform_observation() {
-     if (this->isObserving() == true && this->getResource() != NULL && this->getResource()->isConnected() == true) {
-             this->getResource()->observe();
+     if (this->isObserving() == true && this->getResource() != NULL) {
+         DynamicResource *res = this->getResource();
+         if (res != NULL && res->isRegistered() == true) {
+             res->observe();
+         }
      }
  }