mbed Connector Endpoint interface. This interface permits a mbed endpoint to easily setup MDS resources and emit those resources to an MDS server.

Dependents:   IoT_LED_demo ServoTest uWater_Project hackathon ... more

Revision:
43:769d491a48c1
Parent:
41:fb12c88260ad
Child:
44:dac601597b0e
--- a/api/TickerResourceObserver.cpp	Sat Apr 11 21:14:28 2015 +0000
+++ b/api/TickerResourceObserver.cpp	Sat Apr 11 21:45:27 2015 +0000
@@ -22,6 +22,9 @@
  
  #include "TickerResourceObserver.h"
  
+ // DEBUG
+ DigitalOut __ticker_led(LED2);
+ 
  // determines whether the mDS endpoint has been registered or not...
  extern "C" bool nsdl_endpoint_is_registered(void);
  
@@ -29,6 +32,8 @@
  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->getName().c_str(),sleep_time);
  }
   
  // destructor
@@ -38,8 +43,9 @@
 
  // notifier
  void TickerResourceObserver::observationNotifier() {
-     if (this->isObserving() == true && this->getResource() != NULL) {
+     if (this->isObserving() == true && this->getResource() != NULL && nsdl_endpoint_is_registered() == true) {
          this->getResource()->observe();
+         __ticker_led = !__ticker_led;
      }
  }