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.
Diff: sensor_board.cpp
- Revision:
- 37:1251e35fe43e
- Parent:
- 29:c2838405fa5c
- Child:
- 47:9e21b199c679
--- a/sensor_board.cpp Tue Jan 17 11:44:16 2017 +0100
+++ b/sensor_board.cpp Tue Jan 17 12:00:43 2017 +0100
@@ -34,7 +34,7 @@
sensor->updateState();
if (*should_send_data) {
Data data_to_send = sensor->dataToSend();
- if (send(data_to_send)) {
+ if (send(sensor->getId(), data_to_send)) {
*should_send_data = false;
sensor->resetState();
}
@@ -74,15 +74,18 @@
}
retry_counter++;
}
+ pc_.printf("sending failed\r\n");
return false;
}
-bool Board::send(Data data) {
+bool Board::send(int id, Data data) {
std::string serialized_data = data.serialize();
- pc_.printf("string data '%s', len %d\r\n", serialized_data.c_str(), serialized_data.size());
+
+ std::string output = str_hex(serialized_data.c_str(), serialized_data.size());
+ pc_.printf("id %d string data '%s', len %d\r\n", id, output.c_str(), serialized_data.size());
char message[TRANSFER_SIZE];
memset(message, 0, sizeof(message));
memcpy(message, serialized_data.c_str(), serialized_data.length());
return sendByRadio(message);
-}
\ No newline at end of file
+}