Own fork of MbedSmartRestMain

Dependencies:   C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed

Fork of MbedSmartRestMain by Cumulocity Official

Revision:
105:c61f0d62b625
Parent:
100:dbcd3bc51758
Child:
106:fc5f25f0e0d5
diff -r fd3571349e5d -r c61f0d62b625 MbedAgent.cpp
--- a/MbedAgent.cpp	Fri May 08 14:50:43 2015 +0000
+++ b/MbedAgent.cpp	Mon May 11 18:10:44 2015 +0000
@@ -74,8 +74,10 @@
 int MbedAgent::run()
 {
     // device bootstrapping process
-    if (!_bootstrap.setUpCredentials())
+    if (!_bootstrap.setUpCredentials()) {
+        LCDDisplay::inst().setLines("Bootstrap error");
         return -1;
+    }
     setAuth(_bootstrap.username(), _bootstrap.password());
     aInfo("Set auth: %s:%s (%s)\n", srUsername, srPassword, srAuthStr);
 
@@ -83,6 +85,7 @@
 
     LCDDisplay::inst().setLines("Connect to Cloud", srHost);
     if (!_integration.integrate()) {
+        LCDDisplay::inst().setLines("Integrate failure");
         return -2;
     }
     setX_ID(_client.getIdentifier());
@@ -102,8 +105,8 @@
     wdt.kick(60.0);    // set a 60.0 seconds watchdog
     while (true) {
         for (size_t i = 0; i < N; ++i) {
-//            if (reporters[i] == &conf) {
-            size_t l = reporters[i]->read(buf2, SMARRESTBODY_SIZE, status, DISPLAY_LEN);
+//            if (reporters[i] == &acc) {
+            size_t l = reporters[i]->read(buf2, sizeof(buf2), status, DISPLAY_LEN);
             bool b = l;
             if (b) { // Refresh LCD display needed
                 LCDDisplay::inst().setThirdLine(status);
@@ -112,10 +115,10 @@
             }
             lcdThirdLineBlank = !b;
             if (b) {
-                int l2 = snprintf(buf, SMARTREST_SIZE, fmtSmartRest, "/s", l, buf2);
+                int l2 = snprintf(buf, sizeof(buf), fmtSmartRest, "/s", l, buf2);
                 l2 = sock.sendOnly(buf, l2);
                 if (l2 < 0)
-                    aError(status);
+                    aWarning("%s\n", status);
             }
 //            }
         }