From e6b5f2f0d5a0a2b64dd8c9da8cd04ca6777e0228 Mon Sep 17 00:00:00 2001 From: Manuel Bleichenbacher Date: Sat, 21 Jul 2018 18:07:36 +0200 Subject: [PATCH] Rename sendBytes to transmitMessage --- examples/hello_world/main/main.cpp | 2 +- examples/send_recv/main/main.cpp | 2 +- include/TheThingsNetwork.h | 36 +++++++++++++++--------------- src/TheThingsNetwork.cpp | 2 +- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/examples/hello_world/main/main.cpp b/examples/hello_world/main/main.cpp index 2c6647b..6ee9bc2 100644 --- a/examples/hello_world/main/main.cpp +++ b/examples/hello_world/main/main.cpp @@ -49,7 +49,7 @@ void sendMessages(void* pvParameter) { while (1) { printf("Sending message...\n"); - TTNResponseCode res = ttn.transmitBytes(msgData, sizeof(msgData) - 1); + TTNResponseCode res = ttn.transmitMessage(msgData, sizeof(msgData) - 1); printf(res == kTTNSuccessfulTransmission ? "Message sent.\n" : "Transmission failed.\n"); vTaskDelay(TX_INTERVAL * 1000 / portTICK_PERIOD_MS); diff --git a/examples/send_recv/main/main.cpp b/examples/send_recv/main/main.cpp index e2ae407..b6b9e6d 100644 --- a/examples/send_recv/main/main.cpp +++ b/examples/send_recv/main/main.cpp @@ -49,7 +49,7 @@ void sendMessages(void* pvParameter) { while (1) { printf("Sending message...\n"); - TTNResponseCode res = ttn.transmitBytes(msgData, sizeof(msgData) - 1); + TTNResponseCode res = ttn.transmitMessage(msgData, sizeof(msgData) - 1); printf(res == kTTNSuccessfulTransmission ? "Message sent.\n" : "Transmission failed.\n"); vTaskDelay(TX_INTERVAL * 1000 / portTICK_PERIOD_MS); diff --git a/include/TheThingsNetwork.h b/include/TheThingsNetwork.h index 49b8b26..5413634 100644 --- a/include/TheThingsNetwork.h +++ b/include/TheThingsNetwork.h @@ -55,12 +55,12 @@ class TheThingsNetwork { public: /** - * @brief Construct a new The Things Network device + * @brief Construct a new The Things Network device instance. */ TheThingsNetwork(); /** - * @brief Destroy the The Things Network device. + * @brief Destroy the The Things Network device instance. */ ~TheThingsNetwork(); @@ -103,7 +103,20 @@ public: */ bool provision(const char *devEui, const char *appEui, const char *appKey); - /** + /** + * @brief Activate the device via OTAA. + * + * The app EUI, app key and dev EUI must already have been provisioned by a call to 'provision()'. + * Before this function is called, 'nvs_flash_init' must have been called once. + * + * The function blocks until the activation has completed or failed. + * + * @return true if the activation was succeful + * @return false if the activation failed + */ + bool join(); + + /** * @brief Set the device EUI, app EUI and app key and activate the device via OTAA. * * The device EUI, app EUI and app key are NOT saved in non-volatile memory. @@ -118,19 +131,6 @@ public: */ bool join(const char *devEui, const char *appEui, const char *appKey); - /** - * @brief Activate the device via OTAA. - * - * The app EUI, app key and dev EUI must already have been provisioned by a call to 'provision()'. - * Before this function is called, 'nvs_flash_init' must have been called once. - * - * The function blocks until the activation has completed or failed. - * - * @return true if the activation was succeful - * @return false if the activation failed - */ - bool join(); - /** * @brief Transmit a message * @@ -146,7 +146,7 @@ public: * @return kTTNErrorTransmissionFailed Transmission failed * @return TkTTNErrorUnexpected Unexpected error */ - TTNResponseCode transmitBytes(const uint8_t *payload, size_t length, port_t port = 1, bool confirm = false); + TTNResponseCode transmitMessage(const uint8_t *payload, size_t length, port_t port = 1, bool confirm = false); /** * @brief Set the function to be called when a message is received @@ -156,7 +156,7 @@ public: * parameters. The values are only valid during the duration of the * callback. So they must be immediately processed or copied. * - * Messages are received as a result of 'transmitBytes' or 'poll'. The callback is called + * Messages are received as a result of 'transmitMessage' or 'poll'. The callback is called * in the task that called any of these functions and it occurs before these functions * return control to the caller. * diff --git a/src/TheThingsNetwork.cpp b/src/TheThingsNetwork.cpp index 52e8169..a56b5c0 100644 --- a/src/TheThingsNetwork.cpp +++ b/src/TheThingsNetwork.cpp @@ -162,7 +162,7 @@ bool TheThingsNetwork::joinCore() return result == EV_JOINED; } -TTNResponseCode TheThingsNetwork::transmitBytes(const uint8_t *payload, size_t length, port_t port, bool confirm) +TTNResponseCode TheThingsNetwork::transmitMessage(const uint8_t *payload, size_t length, port_t port, bool confirm) { hal_enterCriticalSection(); if (LMIC.opmode & OP_TXRXPEND)