Own fork of MbedSmartRestMain

Dependencies:   C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed

Fork of MbedSmartRestMain by Cumulocity Official

Revision:
98:e369fc75c000
Parent:
97:9f2de96941c4
Child:
99:47ea098f8a47
diff -r 9f2de96941c4 -r e369fc75c000 MbedAgent.cpp
--- a/MbedAgent.cpp	Mon Apr 27 13:30:21 2015 +0000
+++ b/MbedAgent.cpp	Thu May 07 09:57:55 2015 +0000
@@ -1,20 +1,19 @@
 #include "MbedAgent.h"
-#include "rtos.h"
 #include "LCDDisplay.h"
 #include "logging.h"
 #include "watchdog.h"
 
-MbedAgent::MbedAgent(GPSI2C& gps, DeviceInfo& deviceInfo):
+MbedAgent::MbedAgent(DeviceInfo& deviceInfo):
     _deviceId(0),
     _client(),
     _bootstrap(_client, deviceInfo),
     _integration(_client, _tpl, _deviceId, deviceInfo),
-    _configurationSynchronization(_client, _tpl, _deviceId),
+    _configSync(_client, _tpl, _deviceId),
     _signalQualityMeasurement(_client, _tpl, _deviceId, deviceInfo),
     _temperatureMeasurement(_client, _tpl, _deviceId, deviceInfo),
     _accelerationMeasurement(_client, _tpl, _deviceId, deviceInfo),
     _analogMeasurement(_client, _tpl, _deviceId, deviceInfo),
-    _locationUpdate(_client, _tpl, _deviceId, gps, deviceInfo),
+    _locationUpdate(_client, _tpl, _deviceId, deviceInfo),
     pool(),
     _operationSupport(_client, _tpl, _deviceId, pool)
 {
@@ -27,7 +26,7 @@
         LCDDisplay::inst().setLines("Integrate init fail");
         flag = false;
     }
-    if (!_configurationSynchronization.init()) {
+    if (!_configSync.init()) {
         LCDDisplay::inst().setLines("ConfigSync init fail");
         flag = false;
     }
@@ -64,18 +63,18 @@
     if (!_bootstrap.setUpCredentials())
         return -1;
     setAuth(_bootstrap.username(), _bootstrap.password());
-    aInfo("Set auth: %s:%s (%s)\n", getUsername(), getPassword(), getAuthStr());
+    aInfo("Set auth: %s:%s (%s)\n", srUsername, srPassword, srAuthStr);
 
-    Thread::wait(5000);
+    Thread::wait(2000);
 
-    LCDDisplay::inst().setLines("Connect to Cloud", getHost());
+    LCDDisplay::inst().setLines("Connect to Cloud", srHost);
     if (!_integration.integrate()) {
         return -2;
     }
-    setIdentifier(_client.getIdentifier());
-    aInfo("Set id: %s\n", getIdentifier());
+    setX_ID(_client.getIdentifier());
+    aInfo("Set id: %s\n", srX_ID);
 
-    if (!_configurationSynchronization.integrate()) {
+    if (!_configSync.integrate()) {
         return -3;
     }
     return 0;
@@ -83,20 +82,20 @@
 
 void MbedAgent::loop()
 {
-    ReportThread reportThread(pool);
+//    ReportThread reportThread(pool);
     _operationSupport.run();
-    PollThread pollThread(pool, _configurationSynchronization);
-    pollThread.setChannel(_deviceId);
+//    PollThread pollThread(pool, _configSync);
+//    pollThread.setChannel(_deviceId);
 
     Watchdog wdt;
     wdt.kick(60.0);    // set a 60.0 seconds timeout on watchdog hardware timer
     while (true) {
-        _configurationSynchronization.run();
-        _analogMeasurement.run();
-        _signalQualityMeasurement.run();
-        _temperatureMeasurement.run();
-        _accelerationMeasurement.run();
-        _locationUpdate.run();
+        _configSync.run();
+//        _analogMeasurement.run();
+//        _signalQualityMeasurement.run();
+//        _temperatureMeasurement.run();
+//        _accelerationMeasurement.run();
+//        _locationUpdate.run();
 //        Thread::wait(30000);
         wdt.kick();    // reset watchdog timer
     }