Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: C027 C027_Support mbed mbed-rtos MbedSmartRest LM75B MMA7660 C12832
Fork of MbedSmartRestTest by
Diff: program.cpp
- Revision:
- 12:beb64aa0da86
- Parent:
- 11:6f8f70a6dd46
- Child:
- 13:4045b6ac448d
--- a/program.cpp Wed Feb 12 13:40:16 2014 +0000
+++ b/program.cpp Fri Feb 14 12:28:41 2014 +0000
@@ -1,4 +1,5 @@
#include "common.h"
+#include "io.h"
#include "StaticData.h"
#include "ComposedRecord.h"
#include "CharValue.h"
@@ -36,7 +37,6 @@
"10,104,POST,/measurement/measurements,application/vnd.com.nsn.cumulocity.measurement+json,application/vnd.com.nsn.cumulocity.measurement+json,%%,NOW UNSIGNED NUMBER UNSIGNED,\"{\"\"time\"\":\"\"%%\"\",\"\"source\"\":{\"\"id\"\":\"\"%%\"\"},\"\"type\"\":\"\"c8y_SignalStrength\"\",\"\"c8y_SignalStrength\"\":{\"\"rssi\"\":{\"\"value\"\":%%,\"\"unit\"\":\"\"dBm\"\"},\"\"ber\"\":{\"\"value\"\":%%,\"\"unit\"\":\"\"%\"\"}}}\"\r\n"
);
-const char * const serialNumber = "ublox-a123bd";
float interval = 120.0; // send measurements every two minutes
MbedSmartRest client("http://developer.cumulocity.com/s", "vaillant/admin", "klanpi", "com_u-blox_C027_REV-A_0.7");
//MbedSmartRest client("http://nocore.info:8888/", "vaillant/admin", "klanpi", "com_cumulocity_MbedTestDevice_2.0");
@@ -84,7 +84,7 @@
puts("Checking for device existance...");
- newMoRec.add(IntegerValue(100)).add(CharValue(serialNumber));
+ newMoRec.add(IntegerValue(100)).add(CharValue(imei()));
if (client.send(newMoRec) != SMARTREST_SUCCESS) {
puts("Send failed.");
@@ -126,7 +126,7 @@
puts("Creating device...");
- newMoRec.add(IntegerValue(101)).add(CharValue(serialNumber));
+ newMoRec.add(IntegerValue(101)).add(CharValue(imei()));
if (client.send(newMoRec) != SMARTREST_SUCCESS) {
puts("Send failed.");
@@ -163,7 +163,7 @@
puts("Adding global identifier...");
- newMoRec.add(IntegerValue(102)).add(IntegerValue(deviceId)).add(CharValue(serialNumber));
+ newMoRec.add(IntegerValue(102)).add(IntegerValue(deviceId)).add(CharValue(imei()));
if (client.send(newMoRec) != SMARTREST_SUCCESS) {
puts("Sending failed.");
