Zephyr Project API 4.0.0
A Scalable Open Source RTOS
|
Data Structures | |
struct | lorawan_join_otaa |
LoRaWAN join parameters for over-the-Air activation (OTAA) More... | |
struct | lorawan_join_abp |
LoRaWAN join parameters for activation by personalization (ABP) More... | |
struct | lorawan_join_config |
LoRaWAN join parameters. More... | |
struct | lorawan_downlink_cb |
LoRaWAN downlink callback parameters. More... | |
Macros | |
#define | LW_RECV_PORT_ANY UINT16_MAX |
Flag to indicate receiving on any port. | |
Typedefs | |
typedef uint8_t(* | lorawan_battery_level_cb_t) (void) |
Defines the battery level callback handler function signature. | |
typedef void(* | lorawan_dr_changed_cb_t) (enum lorawan_datarate dr) |
Defines the datarate changed callback handler function signature. | |
Functions | |
void | lorawan_register_battery_level_callback (lorawan_battery_level_cb_t cb) |
Register a battery level callback function. | |
void | lorawan_register_downlink_callback (struct lorawan_downlink_cb *cb) |
Register a callback to be run on downlink packets. | |
void | lorawan_register_dr_changed_callback (lorawan_dr_changed_cb_t cb) |
Register a callback to be called when the datarate changes. | |
int | lorawan_join (const struct lorawan_join_config *config) |
Join the LoRaWAN network. | |
int | lorawan_start (void) |
Start the LoRaWAN stack. | |
int | lorawan_send (uint8_t port, uint8_t *data, uint8_t len, enum lorawan_message_type type) |
Send data to the LoRaWAN network. | |
int | lorawan_set_class (enum lorawan_class dev_class) |
Set the current device class. | |
int | lorawan_set_conf_msg_tries (uint8_t tries) |
Set the number of tries used for transmissions. | |
void | lorawan_enable_adr (bool enable) |
Enable Adaptive Data Rate (ADR) | |
int | lorawan_set_channels_mask (uint16_t *channels_mask, size_t channels_mask_size) |
Set the channels mask. | |
int | lorawan_set_datarate (enum lorawan_datarate dr) |
Set the default data rate. | |
enum lorawan_datarate | lorawan_get_min_datarate (void) |
Get the minimum possible datarate. | |
void | lorawan_get_payload_sizes (uint8_t *max_next_payload_size, uint8_t *max_payload_size) |
Get the current payload sizes. | |
int | lorawan_set_region (enum lorawan_region region) |
Set the region and frequency to be used. | |
#define LW_RECV_PORT_ANY UINT16_MAX |
#include <include/zephyr/lorawan/lorawan.h>
Flag to indicate receiving on any port.
typedef uint8_t(* lorawan_battery_level_cb_t) (void) |
#include <include/zephyr/lorawan/lorawan.h>
Defines the battery level callback handler function signature.
0 | if the node is connected to an external power source |
1..254 | battery level, where 1 is the minimum and 254 is the maximum value |
255 | if the node was not able to measure the battery level |
typedef void(* lorawan_dr_changed_cb_t) (enum lorawan_datarate dr) |
#include <include/zephyr/lorawan/lorawan.h>
Defines the datarate changed callback handler function signature.
dr | Updated datarate. |
enum lorawan_act_type |
#include <include/zephyr/lorawan/lorawan.h>
LoRaWAN activation types.
Enumerator | |
---|---|
LORAWAN_ACT_OTAA | Over-the-Air Activation (OTAA) |
LORAWAN_ACT_ABP | Activation by Personalization (ABP) |
#include <include/zephyr/lorawan/lorawan.h>
LoRaWAN channels mask sizes.
enum lorawan_class |
#include <include/zephyr/lorawan/lorawan.h>
LoRaWAN class types.
Enumerator | |
---|---|
LORAWAN_CLASS_A | Class A device. |
LORAWAN_CLASS_B | Class B device. |
LORAWAN_CLASS_C | Class C device. |
enum lorawan_datarate |
#include <include/zephyr/lorawan/lorawan.h>
LoRaWAN datarate types.
enum lorawan_message_type |
#include <include/zephyr/lorawan/lorawan.h>
LoRaWAN message types.
Enumerator | |
---|---|
LORAWAN_MSG_UNCONFIRMED | Unconfirmed message. |
LORAWAN_MSG_CONFIRMED | Confirmed message. |
enum lorawan_region |
#include <include/zephyr/lorawan/lorawan.h>
LoRaWAN region types.
void lorawan_enable_adr | ( | bool | enable | ) |
#include <include/zephyr/lorawan/lorawan.h>
Enable Adaptive Data Rate (ADR)
Control whether adaptive data rate (ADR) is enabled. When ADR is enabled, the data rate is treated as a default data rate that will be used if the ADR algorithm has not established a data rate. ADR should normally only be enabled for devices with stable RF conditions (i.e., devices in a mostly static location).
enable | Enable or Disable adaptive data rate. |
enum lorawan_datarate lorawan_get_min_datarate | ( | void | ) |
#include <include/zephyr/lorawan/lorawan.h>
Get the minimum possible datarate.
The minimum possible datarate may change in response to a TxParamSetupReq command from the network server.
#include <include/zephyr/lorawan/lorawan.h>
Get the current payload sizes.
Query the current payload sizes. The maximum payload size varies with datarate, while the current payload size can be less due to MAC layer commands which are inserted into uplink packets.
max_next_payload_size | Maximum payload size for the next transmission |
max_payload_size | Maximum payload size for this datarate |
int lorawan_join | ( | const struct lorawan_join_config * | config | ) |
#include <include/zephyr/lorawan/lorawan.h>
Join the LoRaWAN network.
Join the LoRaWAN network using OTAA or AWB.
config | Configuration to be used |
void lorawan_register_battery_level_callback | ( | lorawan_battery_level_cb_t | cb | ) |
#include <include/zephyr/lorawan/lorawan.h>
Register a battery level callback function.
Provide the LoRaWAN stack with a function to be called whenever a battery level needs to be read.
Should no callback be provided the lorawan backend will report 255.
cb | Pointer to the battery level function |
void lorawan_register_downlink_callback | ( | struct lorawan_downlink_cb * | cb | ) |
#include <include/zephyr/lorawan/lorawan.h>
Register a callback to be run on downlink packets.
cb | Pointer to structure containing callback parameters |
void lorawan_register_dr_changed_callback | ( | lorawan_dr_changed_cb_t | cb | ) |
#include <include/zephyr/lorawan/lorawan.h>
Register a callback to be called when the datarate changes.
The callback is called once upon successfully joining a network and again each time the datarate changes due to ADR.
cb | Pointer to datarate update callback |
int lorawan_send | ( | uint8_t | port, |
uint8_t * | data, | ||
uint8_t | len, | ||
enum lorawan_message_type | type | ||
) |
#include <include/zephyr/lorawan/lorawan.h>
Send data to the LoRaWAN network.
Send data to the connected LoRaWAN network.
port | Port to be used for sending data. Must be set if the payload is not empty. |
data | Data buffer to be sent |
len | Length of the buffer to be sent. Maximum length of this buffer is 255 bytes but the actual payload size varies with region and datarate. |
type | Specifies if the message shall be confirmed or unconfirmed. Must be one of lorawan_message_type. |
#include <include/zephyr/lorawan/lorawan.h>
Set the channels mask.
Change the default channels mask. When mask is not changed, all the channels can be used for data transmission. Some Network Servers don't use all the channels, in this case, the channels mask must be provided.
channels_mask | Buffer with channels mask to be used. |
channels_mask_size | Size of channels mask buffer. |
0 | successful |
-EINVAL | channels mask or channels mask size is wrong |
int lorawan_set_class | ( | enum lorawan_class | dev_class | ) |
#include <include/zephyr/lorawan/lorawan.h>
Set the current device class.
Change the current device class. This function may be called before or after a network connection has been established.
dev_class | New device class |
int lorawan_set_conf_msg_tries | ( | uint8_t | tries | ) |
#include <include/zephyr/lorawan/lorawan.h>
Set the number of tries used for transmissions.
tries | Number of tries to be used |
int lorawan_set_datarate | ( | enum lorawan_datarate | dr | ) |
#include <include/zephyr/lorawan/lorawan.h>
Set the default data rate.
Change the default data rate.
dr | Data rate used for transmissions |
int lorawan_set_region | ( | enum lorawan_region | region | ) |
#include <include/zephyr/lorawan/lorawan.h>
Set the region and frequency to be used.
Control the LoRa region and frequency settings. This should be called before lorawan_start(). If you only have support for a single region selected via Kconfig, this function does not need to be called at all.
region | The region to be selected |
int lorawan_start | ( | void | ) |
#include <include/zephyr/lorawan/lorawan.h>
Start the LoRaWAN stack.
This function need to be called before joining the network.