Denislam Valeev / Mbed OS Nucleo_rtos_basic
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers LoRaMacMlme.h Source File

LoRaMacMlme.h

00001 /**
00002  / _____)             _              | |
00003 ( (____  _____ ____ _| |_ _____  ____| |__
00004  \____ \| ___ |    (_   _) ___ |/ ___)  _ \
00005  _____) ) ____| | | || |_| ____( (___| | | |
00006 (______/|_____)_|_|_| \__)_____)\____)_| |_|
00007     (C)2013 Semtech
00008  ___ _____ _   ___ _  _____ ___  ___  ___ ___
00009 / __|_   _/_\ / __| |/ / __/ _ \| _ \/ __| __|
00010 \__ \ | |/ _ \ (__| ' <| _| (_) |   / (__| _|
00011 |___/ |_/_/ \_\___|_|\_\_| \___/|_|_\\___|___|
00012 embedded.connectivity.solutions===============
00013 
00014 Description: LoRaWAN stack layer that controls both MAC and PHY underneath
00015 
00016 License: Revised BSD License, see LICENSE.TXT file include in the project
00017 
00018 Maintainer: Miguel Luis ( Semtech ), Gregory Cristian ( Semtech ) and Daniel Jaeckle ( STACKFORCE )
00019 
00020 
00021 Copyright (c) 2017, Arm Limited and affiliates.
00022 
00023 SPDX-License-Identifier: BSD-3-Clause
00024 */
00025 
00026 #ifndef MBED_OS_LORAWAN_MAC_MLME_H_
00027 #define MBED_OS_LORAWAN_MAC_MLME_H_
00028 
00029 #include "lorawan/system/lorawan_data_structures.h"
00030 #include "lorastack/phy/LoRaPHY.h"
00031 #include "lorastack/mac/LoRaMacCommand.h"
00032 
00033 // forward declaration
00034 class LoRaMac;
00035 
00036 class LoRaMacMlme {
00037 
00038 public:
00039 
00040     /** Constructor
00041      *
00042      * Sets local handles to NULL. These handles will be set when the subsystem
00043      * is activated by the MAC layer.
00044      */
00045     LoRaMacMlme();
00046 
00047     /** Destructor
00048      *
00049      * Does nothing
00050      */
00051     ~LoRaMacMlme();
00052 
00053     /** Activating MLME subsystem
00054      *
00055      * Stores pointers to MAC and PHY layer handles
00056      *
00057      * @param mac    pointer to MAC layer
00058      * @param phy    pointer to PHY layer
00059      * @param cmd    pointer to MAC commands
00060      */
00061     void activate_mlme_subsystem(LoRaMac *mac, LoRaPHY *phy, LoRaMacCommand *cmd);
00062 
00063     /** Sets up an MLME Request
00064      *
00065      * Sets up an MLME request, e.g., a Join Request and sends it through
00066      * to the central MAC control. It also modifies or uses protocol information
00067      * provided in the MAC protocol data structure.
00068      *
00069      * @param request        pointer to MLME request structure
00070      * @param params         pointer to MAC protocol parameters
00071      *
00072      * @return               LORAWAN_STATUS_OK if everything goes well otherwise
00073      *                       a negative error code is returned.
00074      */
00075     lorawan_status_t set_request(loramac_mlme_req_t  *request, loramac_protocol_params *params);
00076 
00077     /** Grants access to MLME confirmation data
00078      *
00079      * @return               a reference to MLME confirm data structure
00080      */
00081     inline loramac_mlme_confirm_t & get_confirmation()
00082     {
00083         return confirmation;
00084     }
00085 
00086     /** Grants access to MLME indication data
00087      *
00088      * @return               a reference to MLME indication data structure
00089      */
00090     inline loramac_mlme_indication_t & get_indication()
00091     {
00092         return indication;
00093     }
00094 
00095 private:
00096 
00097     /**
00098      * Pointers to MAC and PHY handles
00099      */
00100     LoRaMac *_lora_mac;
00101     LoRaPHY *_lora_phy;
00102     LoRaMacCommand *_mac_cmd;
00103 
00104     /**
00105      * Structure to hold MLME indication data.
00106      */
00107     loramac_mlme_indication_t  indication;
00108 
00109     /**
00110      * Structure to hold MLME confirm data.
00111      */
00112     loramac_mlme_confirm_t  confirmation;
00113 };
00114 
00115 #endif /* MBED_OS_LORAWAN_MAC_MLME_H_ */