Rename sendBytes to transmitMessage

This commit is contained in:
Manuel Bleichenbacher 2018-07-21 18:07:36 +02:00
parent c284eb841c
commit e6b5f2f0d5
4 changed files with 21 additions and 21 deletions

View File

@ -49,7 +49,7 @@ void sendMessages(void* pvParameter)
{ {
while (1) { while (1) {
printf("Sending message...\n"); 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"); printf(res == kTTNSuccessfulTransmission ? "Message sent.\n" : "Transmission failed.\n");
vTaskDelay(TX_INTERVAL * 1000 / portTICK_PERIOD_MS); vTaskDelay(TX_INTERVAL * 1000 / portTICK_PERIOD_MS);

View File

@ -49,7 +49,7 @@ void sendMessages(void* pvParameter)
{ {
while (1) { while (1) {
printf("Sending message...\n"); 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"); printf(res == kTTNSuccessfulTransmission ? "Message sent.\n" : "Transmission failed.\n");
vTaskDelay(TX_INTERVAL * 1000 / portTICK_PERIOD_MS); vTaskDelay(TX_INTERVAL * 1000 / portTICK_PERIOD_MS);

View File

@ -55,12 +55,12 @@ class TheThingsNetwork
{ {
public: public:
/** /**
* @brief Construct a new The Things Network device * @brief Construct a new The Things Network device instance.
*/ */
TheThingsNetwork(); TheThingsNetwork();
/** /**
* @brief Destroy the The Things Network device. * @brief Destroy the The Things Network device instance.
*/ */
~TheThingsNetwork(); ~TheThingsNetwork();
@ -103,6 +103,19 @@ public:
*/ */
bool provision(const char *devEui, const char *appEui, const char *appKey); 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. * @brief Set the device EUI, app EUI and app key and activate the device via OTAA.
* *
@ -118,19 +131,6 @@ public:
*/ */
bool join(const char *devEui, const char *appEui, const char *appKey); 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 * @brief Transmit a message
* *
@ -146,7 +146,7 @@ public:
* @return kTTNErrorTransmissionFailed Transmission failed * @return kTTNErrorTransmissionFailed Transmission failed
* @return TkTTNErrorUnexpected Unexpected error * @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 * @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 * parameters. The values are only valid during the duration of the
* callback. So they must be immediately processed or copied. * 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 * in the task that called any of these functions and it occurs before these functions
* return control to the caller. * return control to the caller.
* *

View File

@ -162,7 +162,7 @@ bool TheThingsNetwork::joinCore()
return result == EV_JOINED; 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(); hal_enterCriticalSection();
if (LMIC.opmode & OP_TXRXPEND) if (LMIC.opmode & OP_TXRXPEND)