Cumulocity Official / Mbed 2 deprecated MbedSmartRestMain Featured

Dependencies:   C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed

Fork of MbedSmartRestMain by Vincent Wochnik

Revision:
82:ca7430f50b2b
Parent:
77:f6717e4eccc4
Child:
84:3c8ceb12b773
diff -r 4a7761914901 -r ca7430f50b2b measurement/LocationUpdate.cpp
--- a/measurement/LocationUpdate.cpp	Wed Mar 04 14:02:39 2015 +0000
+++ b/measurement/LocationUpdate.cpp	Fri Mar 06 10:38:03 2015 +0000
@@ -11,14 +11,14 @@
 #define TIME_LIMIT_LOC 900               
 
 LocationUpdate::LocationUpdate(AbstractSmartRest& client, SmartRestTemplate& tpl, long& deviceId, GPSTracker& gpsTracker, 
-    DeviceIO& io, DeviceInfo& deviceInfo, DeviceBootstrap& bootstrap) :
+    DeviceIO& io, DeviceInfo& deviceInfo, DisplayInfo& displayInfo) :
     _client(client),
     _tpl(tpl),
     _deviceId(deviceId),
     _gpsTracker(gpsTracker),
     _io(io),
     _deviceInfo(deviceInfo),
-    _bootstrap(bootstrap)
+    _displayInfo(displayInfo)
 {
     _init = false;
     oldValues[0] = 0;
@@ -53,15 +53,6 @@
         aError("No GPS data available.\r\n");
         return false;
     }
-    static char tenant[25];
-    static bool firstTime = true;
-    if (firstTime) {
-        firstTime = false;
-        const char* user= _bootstrap.username();
-        int len = strchr(user, '/')-user+1+8;  // 8: length of "Tenant: "
-        len = len <= 25 ? len : 25;
-        snprintf(tenant, len, "Tenant: %s", user);
-    }
     float data[3] = { 0.0, 0.0, 0.0 };
     data[0] = position.altitude;
     data[1] = position.latitude;
@@ -77,7 +68,7 @@
         abs(oldValues[1]-data[1]) <= abs(oldValues[1])*THRESHOLD_PERCENT_LOC &&
         abs(oldValues[2]-data[2]) <= abs(oldValues[2])*THRESHOLD_PERCENT_LOC) {
         if (sendingTimer.read() < TIME_LIMIT_LOC) {
-            _io.lcdPrint(tenant, signal);
+            _io.lcdPrint(_displayInfo.getFirstLine(), signal);
             aDebug("Similar location readings found, no sending!\r\n");
             return true;
         } else {
@@ -86,7 +77,7 @@
     }
     char status[27] = {0};
     snprintf(status, 27, "Sending GPS %.1f,%.1f,%.1f", data[0], data[1], data[2]);
-    _io.lcdPrint(tenant, signal, status);
+    _io.lcdPrint(_displayInfo.getFirstLine(), signal, status);
         
     Aggregator aggregator;
     ComposedRecord record1, record2;