LoRaWAN Muxer (lwmux)¶
The lwmux module arbitrates access to the LoRaWAN uplink layer for multiple independent modules. Further, it provides hooks for LoRaWAN layer events and a higher-lever API for accessing basic network functions.
The lwmux module provides the following hooks:
The API for the lwmux module is defined in the followig header file:
Sets the current operation mode of the LoRaWAN layer:
lwm_request_send(lwm_job* job, unsigned int priority, lwm_tx txfunc)¶
Requests a message transmission opportunity.
- job – Pointer to a LWM job structure. This structure must be allocated by the caller and is used by the LWM module to keep the state of the transmission request.
- priority – The priority level of the job. The LWM module uses this value to arbitrate conflicts: If a transmission opportunity arises while there are multiple transmission requests pending, the one with the highest priority is selected.
- txfunc –
Pointer to the transmission callback function. This function will be called by the LWM module when a transmission opportunity arises and this request was selected.
To send a message, the callback function shall place the necessary information into the txinfo structure and return
If the callback function decides that it does not wish to transmit at this time, it shall return
The lwm_txinfo structure has the following fields:
Pointer to payload data. The application can either copy the data it wants to transmit to this buffer, or change the pointer to point to its own buffer.
Length of payload data. This value is initialized to the current maximum payload length. It must be set to the actual payload length by the callback function.
The port on which to send the message on.
To send a confirmed message (ACK bit set), the application must set this field to a non-zero value.
- unsigned char*
Cancel a previous request for a message transmission opportunity.
- job – Pointer to the LWM job structure.