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" 51 #include "system/LoRaWANTimer.h" 53 #include "LoRaRadio.h" 243 int16_t
handle_tx(uint8_t port,
const uint8_t *data,
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;
lorawan_status_t stop_sending(void)
Stops sending.
LoRaWANStack Class A controller layer for LoRaWAN MAC and PHY.
enum lora_events lorawan_event_t
Events needed to announce stack operation results.
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.
lorawan_status_t set_channel_data_rate(uint8_t data_rate)
Sets up the data rate.
void remove_link_check_request()
Removes link check request sticky MAC command.
RAII-style mechanism for owning a lock of Lockable object for the duration of a scoped block...
lorawan_status_t remove_a_channel(uint8_t channel_id)
Removes a channel from the list.
LoRaMac Class Implementation of LoRaWAN MAC layer.
lorawan_status_t enable_adaptive_datarate(bool adr_enabled)
Enables ADR.
device_class_t
LoRaWAN device classes definition.
Stack level TX message structure.
LoRa MAC layer implementation.
A lock-free, primitive atomic flag.
Prevents generation of copy constructor and copy assignment operator in derived classes.
uint32_t lorawan_time_t
Timer time variable definition.
lorawan_status_t add_channels(const lorawan_channelplan_t &channel_plan)
Adds channels to use.
lorawan_status_t acquire_tx_metadata(lorawan_tx_metadata &metadata)
Acquire TX meta-data.
LoRaPHY Class Parent class for LoRa regional PHY implementations.
lorawan_status_t shutdown()
Shuts down the LoRaWAN protocol.
#define LORAMAC_PHY_MAXPAYLOAD
Maximum PHY layer payload size for reception.
enum device_states device_states_t
End-device states.
lorawan_status_t get_enabled_channels(lorawan_channelplan_t &channel_plan)
Gets a list of currently enabled channels .
Stack level callback functions.
enum lorawan_status lorawan_status_t
lorawan_status_t contains status codes in response to stack operations
lorawan_connect_t structure
lorawan_status_t set_lora_callbacks(const lorawan_app_callbacks_t *callbacks)
Sets all callbacks for the application.
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.
Reporting functions for upper layers.
void lock(void)
These locks trample through to the upper layers and make the stack thread safe.
DO NOT MODIFY, WILL BREAK THE API!
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.
lorawan_status_t set_confirmed_msg_retry(uint8_t count)
Sets up a retry counter for confirmed messages.
mcps_type_t
LoRaMAC data services.
Contains common data structures used by Mbed-OS LoRaWAN mplementation.
lorawan_status_t set_link_check_request()
Send Link Check Request MAC command.
lorawan_status_t initialize_mac_layer(events::EventQueue *queue)
End device initialization.
lorawan_status_t drop_channel_list()
Removes a previously set channel plan.
Interface for the radios, containing the main functions that a radio needs, and five callback functio...
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.