State Machine rework

There had been essentially two state machines running in our stack
which was too cumbersome and was not alligned in any symmetry.

In this work we make sure that:
 * There are no callbacks from the MAC layer to Stack controller layer.
 * Primitives are made local to the mac layer and are presented as
   read-only to the stack controller layer.
 * Interrupt handling and processing is moved to the stack controller layer.
 * Reception is divided into smaller units, seperating handling of Join Accept
   and normal data frames. MIC gets its own unit.
 * Extraction of data and MAC commands from the payload is also being done now in
   its own method.
 * To ensure integrity of the stack, and sanctity of the radio payload, we copy the
   radio payload buffer immediately in the rx interrupt and hoist a flag that prevents
   another interrupt from happening for a short while when we are processing the previous
   packet.
 * If an automatic uplink is on going, we do not send a TX_DONE event to application
   anymore as that is logically incorrect.
 * state_controller() is the central engine for the state machine. To save code space and
   memory, we are not handling each and every state in the state_controller(). Some of the states
   which have no processing to be done, are explicitely set.
 * For all the states who need special processing, seperate methods are added.
 * Class A always run to completion to IDLE and CLass C always runs to completion as RECEIVING.
pull/6808/head
Hasnain Virk 2018-05-03 18:49:14 +03:00
parent a75af9799e
commit 9f36baab1b
5 changed files with 1713 additions and 1738 deletions

File diff suppressed because it is too large Load Diff

View File

@ -52,23 +52,6 @@
#include "LoRaRadio.h"
class LoRaWANStack: private mbed::NonCopyable<LoRaWANStack> {
private:
/** End-device states.
*
*/
typedef enum device_states {
DEVICE_STATE_NOT_INITIALIZED,
DEVICE_STATE_INIT,
DEVICE_STATE_JOINING,
DEVICE_STATE_ABP_CONNECTING,
DEVICE_STATE_JOINED,
DEVICE_STATE_SEND,
DEVICE_STATE_IDLE,
#if defined(LORAWAN_COMPLIANCE_TEST)
DEVICE_STATE_COMPLIANCE_TEST,
#endif
DEVICE_STATE_SHUTDOWN
} device_states_t;
public:
LoRaWANStack();
@ -86,6 +69,19 @@ public:
*/
void bind_radio_driver(LoRaRadio& radio);
/** End device initialization.
* @param queue A pointer to an EventQueue passed from the application.
* @return LORAWAN_STATUS_OK on success, a negative error code on failure.
*/
lorawan_status_t initialize_mac_layer(events::EventQueue *queue);
/** Sets all callbacks for the application.
*
* @param callbacks A pointer to the structure carrying callbacks.
* @return LORAWAN_STATUS_OK on success, a negative error code on failure.
*/
lorawan_status_t set_lora_callbacks(const lorawan_app_callbacks_t *callbacks);
/** Connect OTAA or ABP using Mbed-OS config system
*
* Connect by Over The Air Activation or Activation By Personalization.
@ -163,19 +159,6 @@ public:
*/
lorawan_status_t connect(const lorawan_connect_t &connect);
/** End device initialization.
* @param queue A pointer to an EventQueue passed from the application.
* @return LORAWAN_STATUS_OK on success, a negative error code on failure.
*/
lorawan_status_t initialize_mac_layer(events::EventQueue *queue);
/** Sets all callbacks for the application.
*
* @param callbacks A pointer to the structure carrying callbacks.
* @return LORAWAN_STATUS_OK on success, a negative error code on failure.
*/
lorawan_status_t set_lora_callbacks(lorawan_app_callbacks_t *callbacks);
/** Adds channels to use.
*
* You can provide a list of channels with appropriate parameters filled
@ -409,37 +392,40 @@ private:
/**
* State machine for stack controller layer.
*/
lorawan_status_t lora_state_machine(device_states_t new_state);
lorawan_status_t state_controller(device_states_t new_state);
/**
* Callback function for MLME indication. Mac layer calls this function once
* an MLME indication is received. This method translates Mac layer data
* structure into stack layer data structure.
* Helpers for state controller
*/
void mlme_indication_handler(loramac_mlme_indication_t *mlmeIndication);
void process_uninitialized_state(lorawan_status_t& op_status);
void process_idle_state(lorawan_status_t& op_status);
void process_connected_state();
void process_connecting_state(lorawan_status_t& op_status);
void process_joining_state(lorawan_status_t& op_status);
void process_scheduling_state(lorawan_status_t& op_status);
void process_status_check_state();
void process_shutdown_state(lorawan_status_t& op_status);
void state_machine_run_to_completion(void);
/**
* Handles an MLME confirmation coming from the Mac layer and uses it to
* update the state for example, a Join Accept triggers an MLME confirmation,
* that eventually comes here and we take necessary steps accordingly.
* Handles MLME indications
*/
void mlme_confirm_handler(loramac_mlme_confirm_t *mlme_confirm);
void mlme_indication_handler(void);
/**
* Handles an MCPS confirmation coming from the Mac layer in response to an
* MCPS request. We take appropriate actions in response to the confirmation,
* e.g., letting the application know that ack was not received in case of
* a CONFIRMED message or scheduling error etc.
* Handles an MLME confirmation
*/
void mcps_confirm_handler(loramac_mcps_confirm_t *mcps_confirm);
void mlme_confirm_handler(void);
/**
* Handles an MCPS indication coming from the Mac layer, e.g., once we
* receive a packet from the Network Server, it is indicated to this handler
* and consequently this handler posts an event to the application that
* there is something available to read.
* Handles an MCPS confirmation
*/
void mcps_indication_handler(loramac_mcps_indication_t *mcps_indication);
void mcps_confirm_handler(void);
/**
* Handles an MCPS indication
*/
void mcps_indication_handler(void);
/**
* Sets up user application port
@ -464,21 +450,44 @@ private:
*
* @param port The event to be sent.
*/
void send_automatic_uplink_message(const uint8_t port);
void send_automatic_uplink_message(uint8_t port);
/**
* TX interrupt handlers and corresponding processors
*/
void tx_interrupt_handler(void);
void tx_timeout_interrupt_handler(void);
void process_transmission(void);
void process_transmission_timeout(void);
/**
* RX interrupt handlers and corresponding processors
*/
void rx_interrupt_handler(const uint8_t *payload, uint16_t size, int16_t rssi,
int8_t snr);
void rx_timeout_interrupt_handler(void);
void rx_error_interrupt_handler(void);
void process_reception(const uint8_t *payload, uint16_t size, int16_t rssi,
int8_t snr);
void process_reception_timeout(bool is_timeout);
int convert_to_msg_flag(const mcps_type_t type);
private:
LoRaMac _loramac;
loramac_primitives_t LoRaMacPrimitives;
radio_events_t radio_events;
device_states_t _device_current_state;
lorawan_app_callbacks_t _callbacks;
lorawan_session_t _lw_session;
loramac_tx_message_t _tx_msg;
loramac_rx_message_t _rx_msg;
uint8_t _num_retry;
uint32_t _ctrl_flags;
uint8_t _app_port;
bool _link_check_requested;
bool _automatic_uplink_ongoing;
volatile bool _ready_for_rx;
uint8_t _rx_payload[LORAMAC_PHY_MAXPAYLOAD];
events::EventQueue *_queue;
#if defined(LORAWAN_COMPLIANCE_TEST)

File diff suppressed because it is too large Load Diff

View File

@ -74,13 +74,8 @@ public:
/**
* @brief LoRaMAC layer initialization
*
* @details In addition to the initialization of the LoRaMAC layer, this
* function initializes the callback primitives of the MCPS and
* MLME services. Every data field of \ref loramac_primitives_t must be
* set to a valid callback function.
* @details Initializes the LoRaMAC layer,
*
* @param primitives [in] A pointer to the structure defining the LoRaMAC
* event functions. Refer to \ref loramac_primitives_t.
*
* @param queue [in] A pointer to the application provided EventQueue.
*
@ -88,8 +83,7 @@ public:
* \ref LORAWAN_STATUS_OK
* \ref LORAWAN_STATUS_PARAMETER_INVALID
*/
lorawan_status_t initialize(loramac_primitives_t *primitives,
events::EventQueue *queue);
lorawan_status_t initialize(events::EventQueue *queue);
/**
* @brief Disconnect LoRaMac layer
@ -250,8 +244,8 @@ public:
* of success and a negative error code in case of
* failure.
*/
lorawan_status_t send(loramac_mhdr_t *mac_hdr, uint8_t fport, void *fbuffer,
uint16_t fbuffer_size);
lorawan_status_t send(loramac_mhdr_t *mac_hdr, const uint8_t fport,
const void *fbuffer, uint16_t fbuffer_size);
/**
* @brief Puts the system in continuous transmission mode
@ -284,12 +278,6 @@ public:
*/
void reset_mac_parameters(void);
/**
* @brief Opens up a continuous RX 2 window. This is used for
* class c devices.
*/
void open_continuous_rx2_window(void);
/**
* @brief get_default_tx_datarate Gets the default TX datarate
* @return default TX datarate.
@ -345,14 +333,14 @@ public:
* @param num_retries Number of retries for a confirmed type message
* @return The number of bytes prepared for sending.
*/
int16_t prepare_ongoing_tx(uint8_t port, const uint8_t* data,
int16_t prepare_ongoing_tx(const uint8_t port, const uint8_t* data,
uint16_t length, uint8_t flags, uint8_t num_retries);
/**
* @brief send_ongoing_tx Sends the ongoing_tx_msg
* @return LORAWAN_STATUS_OK or a negative error code on failure.
*/
lorawan_status_t send_ongoing_tx();
lorawan_status_t send_ongoing_tx(void);
/**
* @brief device_class Returns active device class
@ -366,6 +354,11 @@ public:
*/
void set_device_class(const device_class_t& device_class);
/**
* @brief opens a continuous RX2 window for Class C devices
*/
void open_continuous_rx_window(void);
/**
* @brief setup_link_check_request Adds link check request command
* to be put on next outgoing message (when it fits)
@ -388,43 +381,61 @@ public:
*/
lorawan_status_t join(bool is_otaa);
private:
/**
* Function to be executed on Radio Tx Done event
* MAC operations upon successful transmission
*/
void on_radio_tx_done(void);
/**
* This function prepares the MAC to abort the execution of function
* on_radio_rx_done() in case of a reception error.
* MAC operations upon reception
*/
void prepare_rx_done_abort(void);
void on_radio_rx_done(const uint8_t* const payload, uint16_t size,
int16_t rssi, int8_t snr);
/**
* Function to be executed on Radio Rx Done event
*/
void on_radio_rx_done(uint8_t *payload, uint16_t size, int16_t rssi,
int8_t snr);
/**
* Function executed on Radio Tx Timeout event
* MAC operations upon transmission timeout
*/
void on_radio_tx_timeout(void);
/**
* Function executed on Radio Rx error event
* MAC operations upon empty reception slots
*
* @param is_timeout false when radio encountered an error
* true when the an RX slot went empty
*
* @return current RX slot
*/
void on_radio_rx_error(void);
rx_slot_t on_radio_rx_timeout(bool is_timeout);
/**
* Function executed on Radio Rx Timeout event
* Handles retransmissions of Join requests if an Accept
* was not received.
*
* @returns true if a retry will be made
*/
void on_radio_rx_timeout(void);
bool continue_joining_process(void);
/**
*Function executed on Resend Frame timer event.
* Checks if the CONFIRMED data can be sent again or not.
*/
void on_mac_state_check_timer_event(void);
bool continue_sending_process(void);
/**
* Read-only access to MAC primitive blocks
*/
const loramac_mcps_confirm_t *get_mcps_confirmation() const;
const loramac_mcps_indication_t *get_mcps_indication() const;
const loramac_mlme_confirm_t *get_mlme_confirmation() const;
const loramac_mlme_indication_t *get_mlme_indication() const;
/**
* Post processing steps in response to actions carried out
* by controller layer and Mac
*/
void post_process_mcps_req(void);
void post_process_mcps_ind(void);
void post_process_mlme_request(void);
void post_process_mlme_ind(void);
/**
* These locks trample through to the upper layers and make
@ -445,20 +456,78 @@ private:
#endif
/**
* Function executed on duty cycle delayed Tx timer event
* Aborts reception
*/
void on_tx_delayed_timer_event(void);
void abort_rx(void);
/**
* Function executed on first Rx window timer event
* Handles a Join Accept frame
*/
void on_rx_window1_timer_event(void);
void handle_join_accept_frame(const uint8_t *payload, uint16_t size);
/**
* Function executed on second Rx window timer event
* Handles data frames
*/
void on_rx_window2_timer_event(void);
void handle_data_frame(const uint8_t *payload, uint16_t size, uint8_t ptr_pos,
uint8_t msg_type, int16_t rssi, int8_t snr);
/**
* Send a Join Request
*/
lorawan_status_t send_join_request();
/**
* Handles retransmissions
*/
lorawan_status_t handle_retransmission();
/**
* Checks if the frame is valid
*/
bool is_frame_size_valid(const uint16_t size);
/**
* Performs MIC
*/
bool message_integrity_check(const uint8_t *payload, uint16_t size,
uint8_t *ptr_pos, uint32_t address,
uint32_t *downlink_counter, const uint8_t *nwk_skey);
/**
* Decrypts and extracts data and MAC commands from the received encrypted
* payload
*/
void extract_data_and_mac_commands(const uint8_t *payload, uint16_t size,
uint8_t fopts_len, uint8_t *nwk_skey,
uint8_t *app_skey, uint32_t address,
uint32_t downlink_frame_counter,
int16_t rssi, int8_t snr);
/**
* Decrypts and extracts MAC commands from the received encrypted
* payload if there is no data
*/
void extract_mac_commands_only(const uint8_t *payload, int8_t snr, uint8_t fopts_len);
/**
* Callback function to be executed when the DC backoff timer expires
*/
void on_backoff_timer_expiry(void);
/**
* At the end of an RX1 window timer, an RX1 window is opened using this method.
*/
void open_rx1_window(void);
/**
* At the end of an RX2 window timer, an RX2 window is opened using this method.
*/
void open_rx2_window(void);
/**
* A method to retry a CONFIRMED message after a particular time period
* (ACK_TIMEOUT = TIME_IN_MS) if the ack was not received
*/
void on_ack_timeout_timer_event(void);
/*!
* \brief Check if the OnAckTimeoutTimer has do be disabled. If so, the
@ -476,30 +545,25 @@ private:
uint8_t ack_timeout_retries_counter,
uint8_t ack_timeout_retries);
/**
* Function executed on AckTimeout timer event
*/
void on_ack_timeout_timer_event(void);
/**
* Validates if the payload fits into the frame, taking the datarate
* into account.
*
* Please Refer to chapter 4.3.2 of the LoRaWAN specification, v1.0.2
*/
bool validate_payload_length(uint8_t length, int8_t datarate, uint8_t fopts_len);
bool validate_payload_length(uint16_t length, int8_t datarate, uint8_t fopts_len);
/**
* Prepares MAC frame on the behest of send() API.
*/
lorawan_status_t prepare_frame(loramac_mhdr_t *mac_hdr,
loramac_frame_ctrl_t *fctrl, uint8_t fport,
void *fbuffer, uint16_t fbuffer_size);
loramac_frame_ctrl_t *fctrl, const uint8_t fport,
const void *fbuffer, uint16_t fbuffer_size);
/**
* Schedules a transmission on the behest of send() API.
*/
lorawan_status_t schedule_tx(void);
lorawan_status_t schedule_tx();
/**
* Calculates the back-off time for the band of a channel.
@ -513,14 +577,11 @@ private:
lorawan_status_t send_frame_on_channel(uint8_t channel);
/**
* @brief reset_mcps_confirmation Resets the MCPS confirmation struct
* Resets MAC primitive blocks
*/
void reset_mcps_confirmation();
/**
* @brief reset_mlme_confirmation Resets the MLME confirmation struct
*/
void reset_mlme_confirmation();
void reset_mcps_confirmation(void);
void reset_mlme_confirmation(void);
void reset_mcps_indication(void);
/**
* @brief set_tx_continuous_wave Puts the system in continuous transmission mode
@ -534,17 +595,6 @@ private:
void set_tx_continuous_wave(uint8_t channel, int8_t datarate, int8_t tx_power,
float max_eirp, float antenna_gain, uint16_t timeout);
/**
* Prototypes for ISR handlers
*/
void handle_cad_done(bool cad);
void handle_tx_done(void);
void handle_rx_done(uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr);
void handle_rx_error(void);
void handle_rx_timeout(void);
void handle_tx_timeout(void);
void handle_fhss_change_channel(uint8_t cur_channel);
private:
/**
* Timer subsystem handle
@ -559,12 +609,12 @@ private:
/**
* MAC command handle
*/
LoRaMacCommand mac_commands;
LoRaMacCommand _mac_commands;
/**
* Channel planning subsystem
*/
LoRaMacChannelPlan channel_plan;
LoRaMacChannelPlan _channel_plan;
/**
* Crypto handling subsystem
@ -576,20 +626,10 @@ private:
*/
loramac_protocol_params _params;
/**
* Radio event callback handlers for MAC
*/
radio_events_t radio_events;
/**
* LoRaMac upper layer event functions
*/
loramac_primitives_t *mac_primitives;
/**
* EventQueue object storage
*/
events::EventQueue *ev_queue;
events::EventQueue *_ev_queue;
/**
* Structure to hold MCPS indication data.

View File

@ -570,7 +570,7 @@ typedef enum {
/*!
* The node has lost MAX_FCNT_GAP or more frames.
*/
LORAMAC_EVENT_INFO_STATUS_DOWNLINK_TOO_MANY_FRAMES_LOSS,
LORAMAC_EVENT_INFO_STATUS_DOWNLINK_TOO_MANY_FRAMES_LOST,
/*!
* An address error occurred.
*/
@ -585,46 +585,6 @@ typedef enum {
LORAMAC_EVENT_INFO_STATUS_CRYPTO_FAIL,
} loramac_event_info_status_t;
/*!
* LoRaMac service state flags.
*/
typedef union {
/*!
* Byte-access to the bits.
*/
uint8_t value;
/*!
* The structure containing single access to bits.
*/
struct mac_flag_bits_s
{
/*!
* MCPS-Req pending
*/
uint8_t mcps_req : 1;
/*!
* MCPS-Ind pending
*/
uint8_t mcps_ind : 1;
/*!
* MCPS-Ind pending. Skip indication to the application layer.
*/
uint8_t mcps_ind_skip : 1;
/*!
* MLME-Req pending
*/
uint8_t mlme_req : 1;
/*!
* MLME-Ind pending
*/
uint8_t mlme_ind : 1;
/*!
* MAC cycle done
*/
uint8_t mac_done : 1;
} bits;
} loramac_flags_t;
/*!
*
* \brief LoRaMAC data services
@ -639,14 +599,6 @@ typedef union {
* \ref MCPS_MULTICAST | NO | YES | NO | NO
* \ref MCPS_PROPRIETARY | YES | YES | NO | YES
*
* The following table provides links to the function implementations of the
* related MCPS primitives:
*
* Primitive | Function
* ---------------- | :---------------------:
* MCPS-Request | LoRaMacMlmeRequest
* MCPS-Confirm | MacMcpsConfirm in \ref loramac_primitives_t
* MCPS-Indication | MacMcpsIndication in \ref loramac_primitives_t
*/
typedef enum {
/*!
@ -714,6 +666,10 @@ typedef struct {
* LoRaMAC MCPS-Indication primitive.
*/
typedef struct {
/*!
* True if an MCPS indication was pending
*/
bool pending;
/*!
* MCPS-Indication type.
*/
@ -741,7 +697,7 @@ typedef struct {
/*!
* A pointer to the received data stream.
*/
uint8_t *buffer;
const uint8_t *buffer;
/*!
* The size of the received data stream.
*/
@ -787,14 +743,6 @@ typedef struct {
* \ref MLME_TXCW | YES | NO | NO | YES
* \ref MLME_SCHEDULE_UPLINK | NO | YES | NO | NO
*
* The following table provides links to the function implementations of the
* related MLME primitives.
*
* Primitive | Function
* ---------------- | :---------------------:
* MLME-Request | LoRaMacMlmeRequest
* MLME-Confirm | MacMlmeConfirm in \ref loramac_primitives_t
* MLME-Indication | MacMlmeIndication in \ref loramac_primitives_t
*/
typedef enum {
/*!
@ -879,6 +827,10 @@ typedef struct {
* LoRaMAC MLME-Confirm primitive.
*/
typedef struct {
/*!
* Indicates if a request is pending or not
*/
bool pending;
/*!
* The previously performed MLME-Request. i.e., the request type
* for which the confirmation is being generated
@ -915,41 +867,29 @@ typedef struct {
* MLME-Indication type
*/
mlme_type_t indication_type;
bool pending;
} loramac_mlme_indication_t;
/*!
* LoRaMAC events structure.
* Used to notify upper layers of MAC events.
/**
* End-device states.
*/
typedef struct {
/*!
* \brief MCPS-Confirm primitive.
*
* \param [OUT] MCPS-Confirm parameters.
*/
mbed::Callback<void(loramac_mcps_confirm_t*)> mcps_confirm;
/*!
* \brief MCPS-Indication primitive.
*
* \param [OUT] MCPS-Indication parameters.
*/
mbed::Callback<void(loramac_mcps_indication_t*)> mcps_indication;
/*!
* \brief MLME-Confirm primitive.
*
* \param [OUT] MLME-Confirm parameters.
*/
mbed::Callback<void(loramac_mlme_confirm_t*)> mlme_confirm;
/*!
* \brief MLME-Indication primitive
*
* \param [OUT] MLME-Indication parameters
*/
mbed::Callback<void(loramac_mlme_indication_t*)> mlme_indication;
}loramac_primitives_t;
typedef enum device_states {
DEVICE_STATE_NOT_INITIALIZED,
DEVICE_STATE_JOINING,
DEVICE_STATE_IDLE,
DEVICE_STATE_CONNECTING,
DEVICE_STATE_AWAITING_JOIN_ACCEPT,
DEVICE_STATE_RECEIVING,
DEVICE_STATE_CONNECTED,
DEVICE_STATE_SCHEDULING,
DEVICE_STATE_SENDING,
DEVICE_STATE_AWAITING_ACK,
DEVICE_STATE_STATUS_CHECK,
#if defined(LORAWAN_COMPLIANCE_TEST)
DEVICE_STATE_COMPLIANCE_TEST,
#endif
DEVICE_STATE_SHUTDOWN
} device_states_t;
/**
* Enumeration for LoRaWAN connection type.
@ -1090,70 +1030,6 @@ typedef struct lorawan_session {
uint32_t downlink_counter;
} lorawan_session_t;
/** Structure containing the uplink status
*
*/
typedef struct {
/** Is acked
*
*/
uint8_t acked;
/** Uplink data rate
*
*/
int8_t datarate;
/** Uplink counter
*
*/
uint16_t uplink_counter;
/** Port is used by application
*
*/
uint8_t port;
/** Payload
*
*/
uint8_t *buffer;
/** Payload size
*
*/
uint8_t buffer_size;
} loramac_uplink_status_t;
/** A structure containing the downlink status
*
*/
typedef struct {
/** RSSI of downlink
*
*/
int16_t rssi;
/** SNR of downlink
*
*/
int8_t snr;
/** Downlink counter
*
*/
uint16_t downlink_counter;
/** Is RX data received
*
*/
bool rx_data;
/** Port used by application
*
*/
uint8_t port;
/** Payload
*
*/
uint8_t *buffer;
/** Payload size
*
*/
uint8_t buffer_size;
} loramac_downlink_status_t;
/*!
* The parameter structure for the function for regional rx configuration.
*/
@ -1212,20 +1088,6 @@ typedef struct {
int timer_id;
} timer_event_t;
/*!
* LoRaMac internal states
*/
typedef enum {
LORAMAC_IDLE = 0x00000000,
LORAMAC_TX_RUNNING = 0x00000001,
LORAMAC_RX = 0x00000002,
LORAMAC_ACK_REQ = 0x00000004,
LORAMAC_ACK_RETRY = 0x00000008,
LORAMAC_TX_DELAYED = 0x00000010,
LORAMAC_TX_CONFIG = 0x00000020,
LORAMAC_RX_ABORT = 0x00000040,
} loramac_internal_state;
typedef struct {
/*!
* Device IEEE EUI
@ -1270,21 +1132,15 @@ typedef struct {
*/
lorawan_time_t mac_init_time;
/*!
* Last transmission time on air
*/
lorawan_time_t tx_toa;
/*!
* LoRaMac timer used to check the LoRaMacState (runs every second)
* LoRaMac duty cycle backoff timer
*/
timer_event_t mac_state_check_timer;
/*!
* LoRaMac duty cycle delayed Tx timer
*/
timer_event_t tx_delayed_timer;
timer_event_t backoff_timer;
/*!
* LoRaMac reception windows timers
@ -1375,24 +1231,24 @@ typedef struct {
uint8_t ul_nb_rep_counter;
/*!
* Buffer containing the data to be sent or received.
* TX buffer used for encrypted outgoing frames
*/
uint8_t buffer[LORAMAC_PHY_MAXPAYLOAD];
uint8_t tx_buffer[LORAMAC_PHY_MAXPAYLOAD];
/*!
* Length of packet in LoRaMacBuffer
* Length of TX buffer
*/
uint16_t buffer_pkt_len;
uint16_t tx_buffer_len;
/*!
* Buffer containing the upper layer data.
* Used for storing decrypted RX data.
*/
uint8_t payload[LORAMAC_PHY_MAXPAYLOAD];
uint8_t rx_buffer[LORAMAC_PHY_MAXPAYLOAD];
/*!
* Length of the payload in LoRaMacBuffer
* Length of the RX buffer
*/
uint8_t payload_length;
uint8_t rx_buffer_len;
/*!
* Number of trials to get a frame acknowledged
@ -1419,11 +1275,6 @@ typedef struct {
*/
loramac_keys keys;
/*!
* LoRaMac tx/rx operation state
*/
loramac_flags_t flags;
/*!
* Device nonce is a random value extracted by issuing a sequence of RSSI
* measurements
@ -1457,11 +1308,6 @@ typedef struct {
*/
uint32_t adr_ack_counter;
/*!
* LoRaMac internal state
*/
uint32_t mac_state;
/*!
* LoRaMac reception windows delay
* \remark normal frame: RxWindowXDelay = ReceiveDelayX - RADIO_WAKEUP_TIME