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_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed
Fork of MbedSmartRestMain by
Diff: measurement/LocationUpdate.cpp
- Revision:
- 72:c5709ae7b193
- Parent:
- 71:063c45e99578
- Child:
- 73:313975bfec96
--- a/measurement/LocationUpdate.cpp Mon Feb 16 09:17:30 2015 +0000
+++ b/measurement/LocationUpdate.cpp Mon Feb 16 13:15:52 2015 +0000
@@ -4,6 +4,7 @@
#include "CharValue.h"
#include "IntegerValue.h"
#include "FloatValue.h"
+#include "logging.h"
#define THRESHOLD_PERCENT_LOC 0.05 // Percentage cut-off for avoiding sending similar acceleration sensor data.
#define TIME_LIMIT_LOC 900 // Time interval for forcing a sending even if acceleration sensor readings are constantly similar.
@@ -45,7 +46,7 @@
GPSTracker::Position position;
if (!_gpsTracker.position(&position)) {
- puts("No GPS data available.");
+ aError("No GPS data available.\r\n");
return true;
}
float data[3] = { 0.0, 0.0, 0.0 };
@@ -56,14 +57,13 @@
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) {
- printf("Similar location readings found, no sending!\r\n");
+ aInfo("Similar location readings found, no sending!\r\n");
return true;
} else {
- printf("Sending timer of location sensor timed out at %f s, a sending is forced.\r\n", sendingTimer.read());
+ aInfo("Sending timer of location sensor timed out at %f s, a sending is forced.\r\n", sendingTimer.read());
}
}
- puts("Starting measurement sending.");
Aggregator aggregator;
ComposedRecord record1, record2;
IntegerValue msgId1(108);
@@ -79,9 +79,8 @@
if ((!aggregator.add(record1)) || (!aggregator.add(record2)))
return false;
- puts("Sending GPS measurement.");
if (_client.send(aggregator) != SMARTREST_SUCCESS) {
- puts("Signal measurement failed.");
+ aError("Signal measurement failed.\r\n");
_client.stop();
return false;
}
@@ -91,6 +90,6 @@
oldValues[1] = data[1];
oldValues[2] = data[2];
sendingTimer.reset();
- printf("Location readings sent.\r\n");
+ aInfo("Location readings sent.\r\n");
return true;
}

Cumulocity