mirror of
https://github.com/manuelbl/ttn-esp32.git
synced 2025-06-15 04:14:28 +02:00
Rename sendBytes to transmitMessage
This commit is contained in:
parent
c284eb841c
commit
e6b5f2f0d5
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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.
|
||||
*
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user