Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers LoRaMac.h Source File

LoRaMac.h

Go to the documentation of this file.
00001 /**
00002  * \file      LoRaMac.h
00003  *
00004  * \brief     LoRa MAC layer implementation
00005  *
00006  * \copyright Revised BSD License, see LICENSE.TXT file include in the project
00007  *
00008  * \code
00009  *                ______                              _
00010  *               / _____)             _              | |
00011  *              ( (____  _____ ____ _| |_ _____  ____| |__
00012  *               \____ \| ___ |    (_   _) ___ |/ ___)  _ \
00013  *               _____) ) ____| | | || |_| ____( (___| | | |
00014  *              (______/|_____)_|_|_| \__)_____)\____)_| |_|
00015  *              (C)2013 Semtech
00016  *
00017  *               ___ _____ _   ___ _  _____ ___  ___  ___ ___
00018  *              / __|_   _/_\ / __| |/ / __/ _ \| _ \/ __| __|
00019  *              \__ \ | |/ _ \ (__| ' <| _| (_) |   / (__| _|
00020  *              |___/ |_/_/ \_\___|_|\_\_| \___/|_|_\\___|___|
00021  *              embedded.connectivity.solutions===============
00022  *
00023  * \endcode
00024  *
00025  * \author    Miguel Luis ( Semtech )
00026  *
00027  * \author    Gregory Cristian ( Semtech )
00028  *
00029  * \author    Daniel Jaeckle ( STACKFORCE )
00030  *
00031  * \defgroup  LORAMAC LoRa MAC layer implementation
00032  *            This module specifies the API implementation of the LoRaMAC layer.
00033  *            This is a placeholder for a detailed description of the LoRaMac
00034  *            layer and the supported features.
00035  *
00036  * Copyright (c) 2017, Arm Limited and affiliates.
00037  * SPDX-License-Identifier: BSD-3-Clause
00038  *
00039  */
00040 #ifndef MBED_LORAWAN_MAC_H__
00041 #define MBED_LORAWAN_MAC_H__
00042 
00043 #include "events/EventQueue.h"
00044 
00045 #include "lorastack/phy/LoRaPHY.h"
00046 
00047 #include "system/LoRaWANTimer.h"
00048 #include "system/lorawan_data_structures.h"
00049 
00050 #include "LoRaMacChannelPlan.h"
00051 #include "LoRaMacCommand.h"
00052 #include "LoRaMacCrypto.h"
00053 #if MBED_CONF_RTOS_PRESENT
00054 #include "rtos/Mutex.h"
00055 #endif
00056 
00057 #include "platform/ScopedLock.h"
00058 
00059 /** LoRaMac Class
00060  * Implementation of LoRaWAN MAC layer
00061  */
00062 class LoRaMac {
00063 
00064 public:
00065 
00066     /**
00067      * Constructor
00068      */
00069     LoRaMac();
00070 
00071     /**
00072      * Destructor
00073      */
00074     ~LoRaMac();
00075 
00076     /**
00077      * @brief   LoRaMAC layer initialization
00078      *
00079      * @details Initializes the LoRaMAC layer,
00080      *
00081      *
00082      * @param   queue [in]        A pointer to the application provided EventQueue.
00083      *
00084      * @param   scheduling_failure_handler    A callback to inform upper layer if a deferred
00085      *                                        transmission (after backoff or retry) fails to schedule.
00086      *
00087      * @return  `lorawan_status_t` The status of the operation. The possible values are:
00088      *          \ref LORAWAN_STATUS_OK
00089      *          \ref LORAWAN_STATUS_PARAMETER_INVALID
00090      */
00091     lorawan_status_t initialize(events::EventQueue *queue,
00092                                 mbed::Callback<void(void)>scheduling_failure_handler);
00093 
00094     /**
00095      * @brief   Disconnect LoRaMac layer
00096      *
00097      * @details Cancels all outstanding requests and sets LoRaMac's
00098      *          internal state to idle.
00099      */
00100     void disconnect(void);
00101 
00102     /**
00103      * @brief nwk_joined Checks if device has joined to network
00104      * @return True if joined to network, false otherwise
00105      */
00106     bool nwk_joined();
00107 
00108     /**
00109      * @brief   Adds a channel plan to the system.
00110      *
00111      * @details Adds a whole channel plan or a single new channel if the plan
00112      *          contains only one channel and 'plan.nb_channels' is set to 1.
00113      *          Please note that this functionality is not available in all regions.
00114      *          Information on the allowed ranges is available at the
00115      *          LoRaWAN Regional Parameters V1.0.2rB.
00116      *
00117      * @param   plan [in]    A reference to application provided channel plan.
00118      *
00119      * @return  `lorawan_status_t` The status of the operation. The possible values are:
00120      *          \ref LORAWAN_STATUS_OK
00121      *          \ref LORAWAN_STATUS_BUSY
00122      *          \ref LORAWAN_STATUS_PARAMETER_INVALID
00123      */
00124     lorawan_status_t add_channel_plan(const lorawan_channelplan_t &plan);
00125 
00126     /**
00127      * @brief   Removes a channel plan from the system.
00128      *
00129      * @details Removes the whole active channel plan except the 'Default Channels'.
00130      *          Please note that this functionality is not available in all regions.
00131      *          Information on the allowed ranges is available at the
00132      *          LoRaWAN Regional Parameters V1.0.2rB.
00133      *
00134      * @return  `lorawan_status_t` The status of the operation. The possible values are:
00135      *          \ref LORAWAN_STATUS_OK
00136      *          \ref LORAWAN_STATUS_BUSY
00137      *          \ref LORAWAN_STATUS_PARAMETER_INVALID
00138      */
00139     lorawan_status_t remove_channel_plan();
00140 
00141     /**
00142      * @brief   Access active channel plan.
00143      *
00144      * @details Provides access to the current active channel plan.
00145      *
00146      * @param   plan [out]    A reference to application provided channel plan data
00147      *                        structure which will be filled in with active channel
00148      *                        plan.
00149      *
00150      * @return  `lorawan_status_t` The status of the operation. The possible values are:
00151      *          \ref LORAWAN_STATUS_OK
00152      *          \ref LORAWAN_STATUS_BUSY
00153      *          \ref LORAWAN_STATUS_PARAMETER_INVALID
00154      */
00155     lorawan_status_t get_channel_plan(lorawan_channelplan_t &plan);
00156 
00157     /**
00158      * @brief   Remove a given channel from the active plan.
00159      *
00160      * @details Deactivates the given channel.
00161      *
00162      * @param id    Id of the channel.
00163      *
00164      * @return  `lorawan_status_t` The status of the operation. The possible values are:
00165      *          \ref LORAWAN_STATUS_OK
00166      *          \ref LORAWAN_STATUS_BUSY
00167      *          \ref LORAWAN_STATUS_PARAMETER_INVALID
00168      */
00169     lorawan_status_t remove_single_channel(uint8_t id);
00170 
00171     /**
00172      * @brief   LoRaMAC multicast channel link service.
00173      *
00174      * @details Links a multicast channel into the linked list.
00175      *
00176      * @param [in] channel_param    The multicast channel parameters to link.
00177      *
00178      * @return  `lorawan_status_t` The  status of the operation. The possible values are:
00179      *          \ref LORAWAN_STATUS_OK
00180      *          \ref LORAWAN_STATUS_BUSY
00181      *          \ref LORAWAN_STATUS_PARAMETER_INVALID
00182      */
00183     lorawan_status_t multicast_channel_link(multicast_params_t  *channel_param);
00184 
00185     /**
00186      * @brief   LoRaMAC multicast channel unlink service.
00187      *
00188      * @details Unlinks a multicast channel from the linked list.
00189      *
00190      * @param [in] channel_param    The multicast channel parameters to unlink.
00191      *
00192      * @return  `lorawan_status_t` The status of the operation. The possible values are:
00193      *          \ref LORAWAN_STATUS_OK
00194      *          \ref LORAWAN_STATUS_BUSY
00195      *          \ref LORAWAN_STATUS_PARAMETER_INVALID
00196      */
00197     lorawan_status_t multicast_channel_unlink(multicast_params_t  *channel_param);
00198 
00199     /** Binds phy layer to MAC.
00200      *
00201      * @param phy   LoRaPHY object
00202      */
00203     void bind_phy(LoRaPHY &phy);
00204 
00205     /**
00206      * @brief Schedules the frame for sending.
00207      *
00208      * @details Prepares a full MAC frame and schedules it for physical
00209      *          transmission.
00210      *
00211      * @param [in] mac_hdr      MAC frame header field
00212      * @param [in] fport        Payload port
00213      * @param [in] fbuffer      MAC frame data buffer to be sent
00214      * @param [in] fbuffer_size MAC frame data buffer size
00215      *
00216      * @return status          Status of the operation. LORAWAN_STATUS_OK in case
00217      *                         of success and a negative error code in case of
00218      *                         failure.
00219      */
00220     lorawan_status_t send(loramac_mhdr_t  *mac_hdr, const uint8_t fport,
00221                           const void *fbuffer, uint16_t fbuffer_size);
00222 
00223     /**
00224      * @brief get_default_tx_datarate Gets the default TX datarate
00225      * @return default TX datarate.
00226      */
00227     uint8_t get_default_tx_datarate();
00228 
00229     /**
00230      * @brief enable_adaptive_datarate Enables or disables adaptive datarate.
00231      * @param adr_enabled Flag indicating is adr enabled or disabled.
00232      */
00233     void enable_adaptive_datarate(bool adr_enabled);
00234 
00235     /** Sets up the data rate.
00236      *
00237      * `set_datarate()` first verifies whether the data rate given is valid or not.
00238      * If it is valid, the system sets the given data rate to the channel.
00239      *
00240      * @param data_rate   The intended data rate, for example DR_0 or DR_1.
00241      *                    Note that the macro DR_* can mean different
00242      *                    things in different regions.
00243      *
00244      * @return            LORAWAN_STATUS_OK if everything goes well, otherwise
00245      *                    a negative error code.
00246      */
00247     lorawan_status_t set_channel_data_rate(uint8_t data_rate);
00248 
00249     /**
00250      * @brief tx_ongoing Check whether a prepare is done or not.
00251      * @return True if prepare_ongoing_tx is called, false otherwise.
00252      */
00253     bool tx_ongoing();
00254 
00255     /**
00256      * @brief set_tx_ongoing Changes the ongoing status for prepared message.
00257      * @param ongoing The value indicating the status.
00258      */
00259     void set_tx_ongoing(bool ongoing);
00260 
00261     /**
00262      * @brief reset_ongoing_tx Resets _ongoing_tx_msg.
00263      * @param reset_pending If true resets pending size also.
00264      */
00265     void reset_ongoing_tx(bool reset_pending = false);
00266 
00267     /**
00268      * @brief prepare_ongoing_tx This will prepare (and override) ongoing_tx_msg.
00269      * @param port                          The application port number.
00270      *
00271      * @param data                          A pointer to the data being sent. The ownership of the
00272      *                                      buffer is not transferred.
00273      *
00274      * @param length                        The size of data in bytes.
00275      *
00276      * @param flags                         A flag used to determine what type of
00277      *                                      message is being sent.
00278      *
00279      * @param num_retries                   Number of retries for a confirmed type message
00280      *
00281      * @return The number of bytes prepared for sending.
00282      */
00283     int16_t prepare_ongoing_tx(const uint8_t port, const uint8_t *data,
00284                                uint16_t length, uint8_t flags, uint8_t num_retries);
00285 
00286     /**
00287      * @brief send_ongoing_tx Sends the ongoing_tx_msg
00288      * @return LORAWAN_STATUS_OK or a negative error code on failure.
00289      */
00290     lorawan_status_t send_ongoing_tx(void);
00291 
00292     /**
00293      * @brief device_class Returns active device class
00294      * @return Device class in use.
00295      */
00296     device_class_t get_device_class() const;
00297 
00298     /**
00299      * @brief set_device_class Sets active device class.
00300      * @param device_class Device class to use.
00301      * @param rx2_would_be_closure_handler callback function to inform about
00302      *        would be closure of RX2 window
00303      */
00304     void set_device_class(const device_class_t &device_class,
00305                           mbed::Callback<void(void)>rx2_would_be_closure_handler);
00306 
00307     /**
00308      * @brief setup_link_check_request Adds link check request command
00309      * to be put on next outgoing message (when it fits)
00310      */
00311     void setup_link_check_request();
00312 
00313     /**
00314      * @brief prepare_join prepares arguments to be ready for join() call.
00315      * @param params Join parameters to use, if NULL, the default will be used.
00316      * @param is_otaa True if joining is to be done using OTAA, false for ABP.
00317      *
00318      * @return LORAWAN_STATUS_OK or a negative error code on failure.
00319      */
00320     lorawan_status_t prepare_join(const lorawan_connect_t *params, bool is_otaa);
00321 
00322     /**
00323      * @brief join Joins the network.
00324      * @param is_otaa True if joining is to be done using OTAA, false for ABP.
00325      * @return LORAWAN_STATUS_OK or a negative error code on failure.
00326      */
00327     lorawan_status_t join(bool is_otaa);
00328 
00329     /**
00330      * MAC operations upon successful transmission
00331      */
00332     void on_radio_tx_done(lorawan_time_t timestamp);
00333 
00334     /**
00335      * MAC operations upon reception
00336      */
00337     void on_radio_rx_done(const uint8_t *const payload, uint16_t size,
00338                           int16_t rssi, int8_t snr);
00339 
00340     /**
00341      * MAC operations upon transmission timeout
00342      */
00343     void on_radio_tx_timeout(void);
00344 
00345     /**
00346      * MAC operations upon empty reception slots
00347      *
00348      * @param is_timeout false when radio encountered an error
00349      *                   true when the an RX slot went empty
00350      *
00351      * @return current RX slot
00352      */
00353     void on_radio_rx_timeout(bool is_timeout);
00354 
00355     /**
00356      * Handles retransmissions of Join requests if an Accept
00357      * was not received.
00358      *
00359      * @returns true if a retry will be made
00360      */
00361     bool continue_joining_process(void);
00362 
00363     /**
00364      * Checks if the CONFIRMED data can be sent again or not.
00365      */
00366     bool continue_sending_process(void);
00367 
00368     /**
00369      * Read-only access to MAC primitive blocks
00370      */
00371     const loramac_mcps_confirm_t  *get_mcps_confirmation() const;
00372     const loramac_mcps_indication_t  *get_mcps_indication() const;
00373     const loramac_mlme_confirm_t  *get_mlme_confirmation() const;
00374     const loramac_mlme_indication_t  *get_mlme_indication() const;
00375 
00376     /**
00377      * Post processing steps in response to actions carried out
00378      * by controller layer and Mac
00379      */
00380     void post_process_mcps_req(void);
00381     void post_process_mcps_ind(void);
00382     void post_process_mlme_request(void);
00383     void post_process_mlme_ind(void);
00384 
00385     /**
00386      * Set battery level query callback
00387      */
00388     void set_batterylevel_callback(mbed::Callback<uint8_t(void)> battery_level);
00389 
00390     /**
00391      * Returns the event ID of backoff timer.
00392      */
00393     int get_backoff_timer_event_id(void);
00394 
00395     /**
00396      * Clears out the TX pipe by discarding any outgoing message if the backoff
00397      * timer is still running.
00398      */
00399     lorawan_status_t clear_tx_pipe(void);
00400 
00401     /**
00402      * Gets the current time
00403      */
00404     lorawan_time_t get_current_time(void);
00405 
00406     /**
00407      * Gets the current receive slot
00408      */
00409     rx_slot_t  get_current_slot(void);
00410 
00411     /**
00412      * Indicates what level of QOS is set by network server. QOS level is set
00413      * in response to a LinkADRReq for UNCONFIRMED messages
00414      */
00415     uint8_t get_QOS_level(void);
00416 
00417     /**
00418      *Indicates level of QOS used for the previous outgoing message
00419      */
00420     uint8_t get_prev_QOS_level(void);
00421 
00422     /**
00423      * These locks trample through to the upper layers and make
00424      * the stack thread safe.
00425      */
00426 #if MBED_CONF_RTOS_PRESENT
00427     void lock(void)
00428     {
00429         _mutex.lock();
00430     }
00431     void unlock(void)
00432     {
00433         _mutex.unlock();
00434     }
00435 #else
00436     void lock(void) { }
00437     void unlock(void) { }
00438 #endif
00439 
00440 private:
00441     /**
00442      * @brief   Queries the LoRaMAC the maximum possible FRMPayload size to send.
00443      *          The LoRaMAC takes the scheduled MAC commands into account and returns
00444      *          corresponding value.
00445      *
00446      * @param   fopts_len     [in]    Number of mac commands in the queue pending.
00447      *
00448      * @return  Size of the biggest packet that can be sent.
00449      *          Please note that if the size of the MAC commands in the queue do
00450      *          not fit into the payload size on the related datarate, the LoRaMAC will
00451      *          omit the MAC commands.
00452      */
00453     uint8_t get_max_possible_tx_size(uint8_t fopts_len);
00454 
00455     /**
00456      * @brief set_nwk_joined This is used for ABP mode for which real joining does not happen
00457      * @param joined True if device has joined in network, false otherwise
00458      */
00459     void set_nwk_joined(bool joined);
00460 
00461     /**
00462      * @brief Configures the events to trigger an MLME-Indication with
00463      *        a MLME type of MLME_SCHEDULE_UPLINK.
00464      */
00465     void set_mlme_schedule_ul_indication(void);
00466 
00467     /**
00468      * @brief Resets MAC specific parameters to default
00469      */
00470     void reset_mac_parameters(void);
00471 
00472     /**
00473      * Handles a Join Accept frame
00474      */
00475     void handle_join_accept_frame(const uint8_t *payload, uint16_t size);
00476 
00477     /**
00478      * Handles data frames
00479      */
00480     void handle_data_frame(const uint8_t *payload,  uint16_t size, uint8_t ptr_pos,
00481                            uint8_t msg_type, int16_t rssi, int8_t snr);
00482 
00483     /**
00484      * Send a Join Request
00485      */
00486     lorawan_status_t send_join_request();
00487 
00488     /**
00489      * Handles retransmissions
00490      */
00491     lorawan_status_t handle_retransmission();
00492 
00493     /**
00494      * Checks if the frame is valid
00495      */
00496     void check_frame_size(uint16_t size);
00497 
00498     /**
00499      * Performs MIC
00500      */
00501     bool message_integrity_check(const uint8_t *payload, uint16_t size,
00502                                  uint8_t *ptr_pos, uint32_t address,
00503                                  uint32_t *downlink_counter, const uint8_t *nwk_skey);
00504 
00505     /**
00506      * Decrypts and extracts data and MAC commands from the received encrypted
00507      * payload
00508      */
00509     void extract_data_and_mac_commands(const uint8_t *payload, uint16_t size,
00510                                        uint8_t fopts_len, uint8_t *nwk_skey,
00511                                        uint8_t *app_skey, uint32_t address,
00512                                        uint32_t downlink_frame_counter,
00513                                        int16_t rssi, int8_t snr);
00514     /**
00515      * Decrypts and extracts MAC commands from the received encrypted
00516      * payload if there is no data
00517      */
00518     void extract_mac_commands_only(const uint8_t *payload, int8_t snr, uint8_t fopts_len);
00519 
00520     /**
00521      * Callback function to be executed when the DC backoff timer expires
00522      */
00523     void on_backoff_timer_expiry(void);
00524 
00525     /**
00526      * At the end of an RX1 window timer, an RX1 window is opened using this method.
00527      */
00528     void open_rx1_window(void);
00529 
00530     /**
00531      * At the end of an RX2 window timer, an RX2 window is opened using this method.
00532      */
00533     void open_rx2_window(void);
00534 
00535     /**
00536      * A method to retry a CONFIRMED message after a particular time period
00537      * (ACK_TIMEOUT = TIME_IN_MS) if the ack was not received
00538      */
00539     void on_ack_timeout_timer_event(void);
00540 
00541     /*!
00542      * \brief Check if the OnAckTimeoutTimer has do be disabled. If so, the
00543      *        function disables it.
00544      *
00545      * \param [in] node_ack_requested Set to true, if the node has requested an ACK
00546      * \param [in] dev_class The device class
00547      * \param [in] ack_received Set to true, if the node has received an ACK
00548      * \param [in] ack_timeout_retries_counter Retries counter for confirmed uplinks
00549      * \param [in] ack_timeout_retries Maximum retries for confirmed uplinks
00550      */
00551     void check_to_disable_ack_timeout(bool node_ack_requested,
00552                                       device_class_t dev_class,
00553                                       bool ack_received,
00554                                       uint8_t ack_timeout_retries_counter,
00555                                       uint8_t ack_timeout_retries);
00556 
00557     /**
00558      * Validates if the payload fits into the frame, taking the datarate
00559      * into account.
00560      *
00561      * Please Refer to chapter 4.3.2 of the LoRaWAN specification, v1.0.2
00562      */
00563     bool validate_payload_length(uint16_t length, int8_t datarate, uint8_t fopts_len);
00564 
00565     /**
00566      * Prepares MAC frame on the behest of send() API.
00567      */
00568     lorawan_status_t prepare_frame(loramac_mhdr_t  *mac_hdr,
00569                                    loramac_frame_ctrl_t  *fctrl, const uint8_t fport,
00570                                    const void *fbuffer, uint16_t fbuffer_size);
00571 
00572     /**
00573      * Schedules a transmission on the behest of send() API.
00574      */
00575     lorawan_status_t schedule_tx();
00576 
00577     /**
00578      * Calculates the back-off time for the band of a channel.
00579      * Takes in the last used channel id as a parameter.
00580      */
00581     void calculate_backOff(uint8_t channel_id);
00582 
00583     /**
00584      * Hands over the MAC frame to PHY layer.
00585      */
00586     lorawan_status_t send_frame_on_channel(uint8_t channel);
00587 
00588     /**
00589      * Resets MAC primitive blocks
00590      */
00591     void reset_mcps_confirmation(void);
00592     void reset_mlme_confirmation(void);
00593     void reset_mcps_indication(void);
00594 
00595     /**
00596      * @brief set_tx_continuous_wave Puts the system in continuous transmission mode
00597      * @param [in] channel A Channel to use
00598      * @param [in] datarate A datarate to use
00599      * @param [in] tx_power A RF output power to use
00600      * @param [in] max_eirp A maximum possible EIRP to use
00601      * @param [in] antenna_gain Antenna gain to use
00602      * @param [in] timeout Time in seconds while the radio is kept in continuous wave mode
00603      */
00604     void set_tx_continuous_wave(uint8_t channel, int8_t datarate, int8_t tx_power,
00605                                 float max_eirp, float antenna_gain, uint16_t timeout);
00606 
00607 private:
00608     typedef mbed::ScopedLock<LoRaMac> Lock;
00609 #if MBED_CONF_RTOS_PRESENT
00610     rtos::Mutex _mutex;
00611 #endif
00612 
00613     /**
00614      * Timer subsystem handle
00615      */
00616     LoRaWANTimeHandler _lora_time;
00617 
00618     /**
00619      * LoRa PHY layer object storage
00620      */
00621     LoRaPHY *_lora_phy;
00622 
00623     /**
00624      * MAC command handle
00625      */
00626     LoRaMacCommand _mac_commands;
00627 
00628     /**
00629      * Channel planning subsystem
00630      */
00631     LoRaMacChannelPlan _channel_plan;
00632 
00633     /**
00634      * Crypto handling subsystem
00635      */
00636     LoRaMacCrypto _lora_crypto;
00637 
00638     /**
00639      * Central MAC layer data storage
00640      */
00641     loramac_protocol_params  _params;
00642 
00643     /**
00644      * EventQueue object storage
00645      */
00646     events::EventQueue *_ev_queue;
00647 
00648     /**
00649      * Class C doesn't timeout in RX2 window as it is a continuous window.
00650      * We use this callback to inform the LoRaWANStack controller that we did
00651      * not receive a downlink in a time equal to normal Class A type RX2
00652      * window timeout. This marks a 'would-be' closure for RX2, actual RX2 is
00653      * not closed. Mostly network servers will send right at the beginning of
00654      * RX2 window if they have something to send. So if we didn't receive anything
00655      * in the time period equal to would be RX2 delay (which is a function of
00656      * uplink message length and data rate), we will invoke this callback to let
00657      * the upper layer know.
00658      */
00659     mbed::Callback<void(void)> _rx2_would_be_closure_for_class_c;
00660 
00661     /**
00662      * Transmission is async, i.e., a call to schedule_tx() may be deferred to
00663      * a time after a certain back off. We use this callback to inform the
00664      * controller layer that a specific TX transaction failed to schedule after
00665      * backoff or retry.
00666      */
00667     mbed::Callback<void(void)> _scheduling_failure_handler;
00668 
00669     timer_event_t _rx2_closure_timer_for_class_c;
00670 
00671     /**
00672      * Structure to hold MCPS indication data.
00673      */
00674     loramac_mcps_indication_t  _mcps_indication;
00675 
00676     /**
00677      * Structure to hold MCPS confirm data.
00678      */
00679     loramac_mcps_confirm_t  _mcps_confirmation;
00680 
00681     /**
00682      * Structure to hold MLME indication data.
00683      */
00684     loramac_mlme_indication_t  _mlme_indication;
00685 
00686     /**
00687      * Structure to hold MLME confirm data.
00688      */
00689     loramac_mlme_confirm_t  _mlme_confirmation;
00690 
00691     loramac_tx_message_t _ongoing_tx_msg;
00692 
00693     bool _is_nwk_joined;
00694 
00695     bool _can_cancel_tx;
00696 
00697     bool _continuous_rx2_window_open;
00698 
00699     device_class_t _device_class;
00700 
00701     uint8_t _prev_qos_level;
00702 
00703     bool _demod_ongoing;
00704 };
00705 
00706 #endif // MBED_LORAWAN_MAC_H__