example for iot course
Revision 47:b6d132f1079f, committed 2019-01-27
- Comitter:
- mbed_official
- Date:
- Sun Jan 27 21:45:34 2019 +0000
- Parent:
- 46:a124538e2891
- Child:
- 48:dfce67eca082
- Commit message:
- Updating mbed-os to mbed-os-5.11.2
.
Commit copied from https://github.com/ARMmbed/mbed-os-example-lorawan
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| mbed-os.lib | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Jan 10 12:15:30 2019 +0000
+++ b/main.cpp Sun Jan 27 21:45:34 2019 +0000
@@ -168,7 +168,7 @@
sensor_value);
retcode = lorawan.send(MBED_CONF_LORA_APP_PORT, tx_buffer, packet_len,
- MSG_CONFIRMED_FLAG);
+ MSG_UNCONFIRMED_FLAG);
if (retcode < 0) {
retcode == LORAWAN_STATUS_WOULD_BLOCK ? printf("send - WOULD BLOCK\r\n")
@@ -192,24 +192,21 @@
*/
static void receive_message()
{
- int16_t retcode;
- retcode = lorawan.receive(MBED_CONF_LORA_APP_PORT, rx_buffer,
- sizeof(rx_buffer),
- MSG_CONFIRMED_FLAG | MSG_UNCONFIRMED_FLAG);
+ uint8_t port;
+ int flags;
+ int16_t retcode = lorawan.receive(rx_buffer, sizeof(rx_buffer), port, flags);
if (retcode < 0) {
printf("\r\n receive() - Error code %d \r\n", retcode);
return;
}
- printf(" Data:");
-
+ printf(" RX Data on port %u (%d bytes): ", port, retcode);
for (uint8_t i = 0; i < retcode; i++) {
- printf("%x", rx_buffer[i]);
+ printf("%02x ", rx_buffer[i]);
}
-
- printf("\r\n Data Length: %d\r\n", retcode);
-
+ printf("\r\n");
+
memset(rx_buffer, 0, sizeof(rx_buffer));
}
--- a/mbed-os.lib Thu Jan 10 12:15:30 2019 +0000 +++ b/mbed-os.lib Sun Jan 27 21:45:34 2019 +0000 @@ -1,1 +1,1 @@ -https://github.com/ARMmbed/mbed-os/#c966348d3f9ca80843be7cdc9b748f06ea73ced0 +https://github.com/ARMmbed/mbed-os/#a8f0c33eaa2c52babff9655417c36f4b5edd54d7