SmartREST client reference implementation for the u-blox C027 mbed compatible device.

Dependencies:   C027 C027_Support mbed mbed-rtos MbedSmartRest LM75B MMA7660 C12832

Fork of MbedSmartRestTest by Vincent Wochnik

Revision:
32:56804dd00193
Parent:
31:912c140ee050
Child:
33:b7d7e6fc421e
--- a/program.cpp	Mon May 26 08:26:01 2014 +0000
+++ b/program.cpp	Wed May 28 17:51:12 2014 +0000
@@ -17,8 +17,7 @@
 void analogMeasurement(long deviceId, Aggregator& aggr);
 void motionMeasurement(long deviceId, Aggregator& aggr);
 
-char cUsername[48];
-char cPassword[48];
+credentials_t credentials = {};
 char cDeviceIdentifier[48];
 
 const char *srtplIdentifier = "com_u-blox_C027_REV-A_0.10_Test1233123";
@@ -57,7 +56,7 @@
 
 float interval = 120.0; // send measurements every two minutes
 
-MbedSmartRest client("developer.cumulocity.com", 80, cUsername, cPassword, cDeviceIdentifier);
+MbedSmartRest client("developer.cumulocity.com", 80, credentials.username, credentials.password, cDeviceIdentifier);
 
 int program(void)
 {
@@ -65,11 +64,14 @@
 
     // copy credentials and identifier into fields
     //TODO: implement bootstrap process
-    strcpy(cUsername, "vaillant/admin");
-    strcpy(cPassword, "klanpi");
+    if (!credentials_read(&credentials)) {
+        puts("Could not read credentials. Stop.");
+        return 1;
+    }
+
     strcpy(cDeviceIdentifier, srtplIdentifier);
 
-    lcd_tenant(cUsername);
+    lcd_tenant(credentials.username);
     puts("Hello!");
     
     puts("Bootstrapping");