40#ifndef LORAWANSTACK_H_
41#define LORAWANSTACK_H_
44#include "events/EventQueue.h"
45#include "platform/mbed_atomic.h"
46#include "platform/Callback.h"
47#include "platform/NonCopyable.h"
48#include "platform/ScopedLock.h"
50#include "lorastack/mac/LoRaMac.h"
51#include "system/LoRaWANTimer.h"
244 uint16_t length, uint8_t flags,
245 bool null_allowed =
false,
bool allow_port_0 =
false);
296 int16_t
handle_rx(uint8_t *data, uint16_t length, uint8_t &port,
int &flags,
bool validate_params);
401 bool is_port_valid(uint8_t port,
bool allow_port_0 =
false);
413 void process_connected_state();
417 void process_status_check_state();
419 void state_machine_run_to_completion(
void);
424 void mlme_indication_handler(
void);
429 void mlme_confirm_handler(
void);
434 void mcps_confirm_handler(
void);
439 void mcps_indication_handler(
void);
444 lorawan_status_t set_application_port(uint8_t port,
bool allow_port_0 =
false);
464 void send_automatic_uplink_message(uint8_t port);
469 void tx_interrupt_handler(
void);
470 void tx_timeout_interrupt_handler(
void);
471 void process_transmission(
void);
472 void process_transmission_timeout(
void);
477 void rx_interrupt_handler(
const uint8_t *payload, uint16_t size, int16_t rssi,
479 void rx_timeout_interrupt_handler(
void);
480 void rx_error_interrupt_handler(
void);
481 void process_reception(
const uint8_t *payload, uint16_t size, int16_t rssi,
483 void process_reception_timeout(
bool is_timeout);
487 void make_tx_metadata_available(
void);
488 void make_rx_metadata_available(
void);
490 void handle_scheduling_failure(
void);
492 void post_process_tx_with_reception(
void);
493 void post_process_tx_no_reception(
void);
507 uint32_t _ctrl_flags;
509 bool _link_check_requested;
510 bool _automatic_uplink_ongoing;
Interface for the radios, containing the main functions that a radio needs, and five callback functio...
LoRaWANStack Class A controller layer for LoRaWAN MAC and PHY.
lorawan_status_t stop_sending(void)
Stops sending.
lorawan_status_t remove_a_channel(uint8_t channel_id)
Removes a channel from the list.
lorawan_status_t drop_channel_list()
Removes a previously set channel plan.
lorawan_status_t set_channel_data_rate(uint8_t data_rate)
Sets up the data rate.
lorawan_status_t shutdown()
Shuts down the LoRaWAN protocol.
lorawan_status_t enable_adaptive_datarate(bool adr_enabled)
Enables ADR.
lorawan_status_t set_lora_callbacks(const lorawan_app_callbacks_t *callbacks)
Sets all callbacks for the application.
lorawan_status_t get_enabled_channels(lorawan_channelplan_t &channel_plan)
Gets a list of currently enabled channels .
int16_t handle_tx(uint8_t port, const uint8_t *data, uint16_t length, uint8_t flags, bool null_allowed=false, bool allow_port_0=false)
Send message to gateway.
lorawan_status_t acquire_rx_metadata(lorawan_rx_metadata &metadata)
Acquire RX meta-data.
void remove_link_check_request()
Removes link check request sticky MAC command.
lorawan_status_t set_link_check_request()
Send Link Check Request MAC command.
lorawan_status_t connect()
Connect OTAA or ABP using Mbed-OS config system.
void bind_phy_and_radio_driver(LoRaRadio &radio, LoRaPHY &phy)
Binds PHY layer and radio driver to stack.
int16_t handle_rx(uint8_t *data, uint16_t length, uint8_t &port, int &flags, bool validate_params)
Receives a message from the Network Server.
lorawan_status_t set_device_class(const device_class_t &device_class)
Change device class.
lorawan_status_t acquire_backoff_metadata(int &backoff)
Acquire backoff meta-data.
lorawan_status_t set_confirmed_msg_retry(uint8_t count)
Sets up a retry counter for confirmed messages.
lorawan_status_t acquire_tx_metadata(lorawan_tx_metadata &metadata)
Acquire TX meta-data.
lorawan_status_t add_channels(const lorawan_channelplan_t &channel_plan)
Adds channels to use.
lorawan_status_t initialize_mac_layer(events::EventQueue *queue)
End device initialization.
lorawan_status_t connect(const lorawan_connect_t &connect)
Connect OTAA or ABP with parameters.
Prevents generation of copy constructor and copy assignment operator in derived classes.
RAII-style mechanism for owning a lock of Lockable object for the duration of a scoped block.
Contains common data structures used by Mbed-OS LoRaWAN mplementation.
enum device_states device_states_t
End-device states.
#define LORAMAC_PHY_MAXPAYLOAD
Maximum PHY layer payload size for reception.
mcps_type_t
LoRaMAC data services.
uint32_t lorawan_time_t
Timer time variable definition.
enum lorawan_status lorawan_status_t
lorawan_status_t contains status codes in response to stack operations
enum lora_events lorawan_event_t
Events needed to announce stack operation results.
device_class_t
LoRaWAN device classes definition.
A lock-free, primitive atomic flag.
DO NOT MODIFY, WILL BREAK THE API!
Stack level TX message structure.
Stack level callback functions.
lorawan_connect_t structure
Reporting functions for upper layers.