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:
31:bacc63106754
Parent:
30:113c2a1d8db2
Child:
35:f12e61aaf004
--- a/api/ThreadedResourceObserver.h	Tue Apr 07 21:30:03 2015 +0000
+++ b/api/ThreadedResourceObserver.h	Wed Apr 08 15:49:56 2015 +0000
@@ -23,9 +23,13 @@
 #ifndef __THREADED_RESOURCE_OBSERVER_H__
 #define __THREADED_RESOURCE_OBSERVER_H__
 
-// Thread support
+// mbed support
 #include "mbed.h"
-#include "rtos.h"
+
+// Thread support
+#ifdef CONNECTOR_USING_THREADS
+    #include "rtos.h"
+#endif
 
 // Base class support
 #include "ResourceObserver.h"
@@ -35,9 +39,9 @@
         /**
         Default Constructor
         @param resource input the resource to observe
-        @param sleep_time_ms input the time for the observation thread to sleep (in ms)
+        @param sleep_time input the time for the observation thread to sleep (in ms)
         */
-        ThreadedResourceObserver(DynamicResource *resource,int sleep_time_ms);
+        ThreadedResourceObserver(DynamicResource *resource,int sleep_time = NSP_RD_UPDATE_PERIOD);
                 
         /**
         Destructor
@@ -50,14 +54,19 @@
         virtual void beginObservation();
         
         /**
+        stop the observation
+        */
+        virtual void stopObservation();
+        
+        /**
         thread invoke function (static)
         */
-        static void _observation_notifier(void const *args);
+        static void _observation_notifier(void const *instance);
         
     private:
-        bool    m_begin_observation;  
+#ifdef CONNECTOR_USING_THREADS 
         Thread  m_observation_thread;
-        int     m_sleep_time_ms;
+#endif
 };
 
 #endif // __THREADED_RESOURCE_OBSERVER_H__
\ No newline at end of file