40 #ifndef MBED_LORAWAN_MAC_H__    41 #define MBED_LORAWAN_MAC_H__    43 #include "events/EventQueue.h"    47 #include "system/LoRaWANTimer.h"    50 #include "LoRaMacChannelPlan.h"    52 #include "LoRaMacCrypto.h"    53 #if MBED_CONF_RTOS_PRESENT    54 #include "rtos/Mutex.h"    57 #include "platform/ScopedLock.h"   221                           const void *fbuffer, uint16_t fbuffer_size);
   284                                uint16_t length, uint8_t flags, uint8_t num_retries);
   338                           int16_t rssi, int8_t snr);
   381     void post_process_mcps_ind(
void);
   382     void post_process_mlme_request(
void);
   383     void post_process_mlme_ind(
void);
   426 #if MBED_CONF_RTOS_PRESENT   437     void unlock(
void) { }
   453     uint8_t get_max_possible_tx_size(uint8_t fopts_len);
   459     void set_nwk_joined(
bool joined);
   465     void set_mlme_schedule_ul_indication(
void);
   470     void reset_mac_parameters(
void);
   475     void handle_join_accept_frame(
const uint8_t *payload, uint16_t size);
   480     void handle_data_frame(
const uint8_t *payload,  uint16_t size, uint8_t ptr_pos,
   481                            uint8_t msg_type, int16_t rssi, int8_t snr);
   496     void check_frame_size(uint16_t size);
   501     bool message_integrity_check(
const uint8_t *payload, uint16_t size,
   502                                  uint8_t *ptr_pos, uint32_t address,
   503                                  uint32_t *downlink_counter, 
const uint8_t *nwk_skey);
   509     void extract_data_and_mac_commands(
const uint8_t *payload, uint16_t size,
   510                                        uint8_t fopts_len, uint8_t *nwk_skey,
   511                                        uint8_t *app_skey, uint32_t address,
   512                                        uint32_t downlink_frame_counter,
   513                                        int16_t rssi, int8_t snr);
   518     void extract_mac_commands_only(
const uint8_t *payload, int8_t snr, uint8_t fopts_len);
   523     void on_backoff_timer_expiry(
void);
   528     void open_rx1_window(
void);
   533     void open_rx2_window(
void);
   539     void on_ack_timeout_timer_event(
void);
   551     void check_to_disable_ack_timeout(
bool node_ack_requested,
   554                                       uint8_t ack_timeout_retries_counter,
   555                                       uint8_t ack_timeout_retries);
   563     bool validate_payload_length(uint16_t length, int8_t datarate, uint8_t fopts_len);
   570                                    const void *fbuffer, uint16_t fbuffer_size);
   581     void calculate_backOff(uint8_t channel_id);
   591     void reset_mcps_confirmation(
void);
   592     void reset_mlme_confirmation(
void);
   593     void reset_mcps_indication(
void);
   604     void set_tx_continuous_wave(uint8_t channel, int8_t datarate, int8_t tx_power,
   605                                 float max_eirp, 
float antenna_gain, uint16_t timeout);
   609 #if MBED_CONF_RTOS_PRESENT   697     bool _continuous_rx2_window_open;
   701     uint8_t _prev_qos_level;
   706 #endif // MBED_LORAWAN_MAC_H__ device_class_t get_device_class() const 
device_class Returns active device class 
LoRa MAC layer implementation. 
bool continue_sending_process(void)
Checks if the CONFIRMED data can be sent again or not. 
void on_radio_rx_timeout(bool is_timeout)
MAC operations upon empty reception slots. 
lorawan_status_t get_channel_plan(lorawan_channelplan_t &plan)
Access active channel plan. 
void reset_ongoing_tx(bool reset_pending=false)
reset_ongoing_tx Resets _ongoing_tx_msg. 
bool continue_joining_process(void)
Handles retransmissions of Join requests if an Accept was not received. 
RAII-style mechanism for owning a lock of Lockable object for the duration of a scoped block...
An abstract class providing radio object to children and provide base for implementing LoRa PHY layer...
lorawan_status_t add_channel_plan(const lorawan_channelplan_t &plan)
Adds a channel plan to the system. 
LoRaMac Class Implementation of LoRaWAN MAC layer. 
device_class_t
LoRaWAN device classes definition. 
bool nwk_joined()
nwk_joined Checks if device has joined to network 
Stack level TX message structure. 
Timer object description. 
int16_t prepare_ongoing_tx(const uint8_t port, const uint8_t *data, uint16_t length, uint8_t flags, uint8_t num_retries)
prepare_ongoing_tx This will prepare (and override) ongoing_tx_msg. 
uint32_t lorawan_time_t
Timer time variable definition. 
lorawan_status_t join(bool is_otaa)
join Joins the network. 
lorawan_status_t multicast_channel_link(multicast_params_t *channel_param)
LoRaMAC multicast channel link service. 
lorawan_status_t remove_channel_plan()
Removes a channel plan from the system. 
uint8_t get_default_tx_datarate()
get_default_tx_datarate Gets the default TX datarate 
uint8_t get_prev_QOS_level(void)
Indicates level of QOS used for the previous outgoing message. 
LoRaPHY Class Parent class for LoRa regional PHY implementations. 
/ _____) _ | | ( (____ _____ ____ _| |_ _____ ____| |__ ____ | ___ | (_ _) ___ |/ ___) _ \ _____) ) _...
int get_backoff_timer_event_id(void)
Returns the event ID of backoff timer. 
lorawan_status_t set_channel_data_rate(uint8_t data_rate)
Sets up the data rate. 
bool tx_ongoing()
tx_ongoing Check whether a prepare is done or not. 
enum lorawan_status lorawan_status_t
lorawan_status_t contains status codes in response to stack operations 
lorawan_connect_t structure 
void on_radio_rx_done(const uint8_t *const payload, uint16_t size, int16_t rssi, int8_t snr)
MAC operations upon reception. 
lorawan_status_t clear_tx_pipe(void)
Clears out the TX pipe by discarding any outgoing message if the backoff timer is still running...
const loramac_mcps_confirm_t * get_mcps_confirmation() const 
Read-only access to MAC primitive blocks. 
lorawan_status_t send_ongoing_tx(void)
send_ongoing_tx Sends the ongoing_tx_msg 
void enable_adaptive_datarate(bool adr_enabled)
enable_adaptive_datarate Enables or disables adaptive datarate. 
lorawan_status_t prepare_join(const lorawan_connect_t *params, bool is_otaa)
prepare_join prepares arguments to be ready for join() call. 
void lock(void)
These locks trample through to the upper layers and make the stack thread safe. 
The Mutex class is used to synchronize the execution of threads. 
void setup_link_check_request()
setup_link_check_request Adds link check request command to be put on next outgoing message (when it ...
DO NOT MODIFY, WILL BREAK THE API! 
lorawan_status_t send(loramac_mhdr_t *mac_hdr, const uint8_t fport, const void *fbuffer, uint16_t fbuffer_size)
Schedules the frame for sending. 
void on_radio_tx_done(lorawan_time_t timestamp)
MAC operations upon successful transmission. 
void set_tx_ongoing(bool ongoing)
set_tx_ongoing Changes the ongoing status for prepared message. 
LoRaMacCommand Class Helper class for LoRaMac layer to handle any MAC commands. 
lorawan_status_t multicast_channel_unlink(multicast_params_t *channel_param)
LoRaMAC multicast channel unlink service. 
void bind_phy(LoRaPHY &phy)
Binds phy layer to MAC. 
uint8_t get_QOS_level(void)
Indicates what level of QOS is set by network server. 
lorawan_time_t get_current_time(void)
Gets the current time. 
lorawan_status_t initialize(events::EventQueue *queue, mbed::Callback< void(void)>scheduling_failure_handler)
LoRaMAC layer initialization. 
Contains common data structures used by Mbed-OS LoRaWAN mplementation. 
void on_radio_tx_timeout(void)
MAC operations upon transmission timeout. 
lorawan_status_t remove_single_channel(uint8_t id)
Remove a given channel from the active plan. 
rx_slot_t get_current_slot(void)
Gets the current receive slot. 
void disconnect(void)
Disconnect LoRaMac layer. 
void set_device_class(const device_class_t &device_class, mbed::Callback< void(void)>rx2_would_be_closure_handler)
set_device_class Sets active device class. 
Callback class based on template specialization. 
void set_batterylevel_callback(mbed::Callback< uint8_t(void)> battery_level)
Set battery level query callback. 
void post_process_mcps_req(void)
Post processing steps in response to actions carried out by controller layer and Mac.