mqtt specific components for the impact mbed endpoint library

Dependents:   mbed_mqtt_endpoint_ublox_ethernet mbed_mqtt_endpoint_ublox_cellular mbed_mqtt_endpoint_nxp

Revision:
29:ac6390032cec
Parent:
22:afb208d1d79e
Child:
55:7992e9582e2e
--- a/EmulatedLightResourceFactory.cpp	Thu Apr 03 01:55:19 2014 +0000
+++ b/EmulatedLightResourceFactory.cpp	Mon Apr 07 03:15:02 2014 +0000
@@ -77,7 +77,11 @@
  void EmulatedLightResourceFactory::initGPSCoords() {
      memset(this->m_gps_coords,0,PREFERENCE_VALUE_LEN+1);
      MBEDEndpoint *endpoint = (MBEDEndpoint *)this->getEndpoint();
-     endpoint->preferences()->getPreference("coords",this->m_gps_coords,PREFERENCE_VALUE_LEN,ENDPOINT_GPS_COORDS);
+     if (endpoint != NULL && endpoint->preferences() != NULL)
+        endpoint->preferences()->getPreference("coords",this->m_gps_coords,PREFERENCE_VALUE_LEN,ENDPOINT_GPS_COORDS);
+     else
+        strcpy(this->m_gps_coords,ENDPOINT_GPS_COORDS);
+     for(int i=0;i<strlen(this->m_gps_coords);++i) if (this->m_gps_coords[i] == ',') this->m_gps_coords[i] = ' ';
  }
  
  // get our GPS coords from preferences