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:
112:1fb53d4729af
Parent:
43:361a61395588
Child:
135:7f3f963cd159
--- a/MBEDgps.cpp	Mon Mar 17 16:56:41 2014 +0000
+++ b/MBEDgps.cpp	Tue Mar 18 21:46:48 2014 +0000
@@ -20,6 +20,8 @@
  
  #include "MBEDgps.h"
  
+ #include "MBEDEndpoint.h"
+ 
  // default constructor
  MBEDgps::MBEDgps(ErrorHandler *error_handler,Resource *resource) : MBEDio(error_handler,resource) {
  }
@@ -30,5 +32,9 @@
 
  // update our value
  void MBEDgps::update() {
-     if (this->m_resource != NULL && this->m_resource->getValuePointer() != NULL) strcpy(this->m_resource->getValuePointer(),ENDPOINT_GPS_COORDS); // fixed GPS for now...
+     MBEDEndpoint *endpoint = (MBEDEndpoint *)this->logger()->getEndpoint();
+     char buffer[PREFERENCE_VALUE_LEN+1];
+     memset(buffer,0,PREFERENCE_VALUE_LEN+1);
+     char *coords = endpoint->preferences()->getPreference("coords",buffer,PREFERENCE_VALUE_LEN,ENDPOINT_GPS_COORDS);
+     if (this->m_resource != NULL && this->m_resource->getValuePointer() != NULL) strcpy(this->m_resource->getValuePointer(),coords); // fixed GPS for now...
  }