Core Base Classes for the Light Endpoints

Dependencies:   BufferedSerial

Dependents:   mbed_mqtt_endpoint_ublox_ethernet mbed_mqtt_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_ethernet ... more

Revision:
40:eae89a487d86
Parent:
26:791d22d43cb4
Child:
41:e54e5888c49e
--- a/Resource.cpp	Sat Mar 01 06:15:18 2014 +0000
+++ b/Resource.cpp	Sat Mar 01 07:16:47 2014 +0000
@@ -17,6 +17,7 @@
  */
  
  #include "Resource.h"
+ #include "MBEDio.h"
     
  // default constructor
  Resource::Resource(ErrorHandler *error_handler,char *endpoint_name,char *name,char *value,void *cb) {
@@ -47,12 +48,20 @@
  // plumb the resource (base class does nothing other than save the endpoint_name)
  void Resource::plumb(char *endpoint_name,char *name) { this->m_endpoint_name = endpoint_name; }
  
- // extract the resource value (base class does nothing)
- void Resource::extract(char *name) { ; }
+ // extract the resource value 
+ void Resource::extract(char *name) { 
+    if (this->m_io != NULL) {
+        MBEDio *io = (MBED *)this->io;
+        io->update();
+    }
+ }
  
  // get the endpoint anme
  char *Resource::endpoint() { return this->m_endpoint_name; }
  
+ // set the base I/O
+ void Resource::setIO(void *io) { this->m_io = io; }
+ 
  // set the internal resource linkage
  void  Resource::setCallbackPointer(void *cb) { this->m_cb = cb; }
  void *Resource::getCallbackPointer() { return this->m_cb; }