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

« Back to documentation index

Show/hide line numbers LoRaMacMcps.h Source File

LoRaMacMcps.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_MCPS_H_
00027 #define MBED_OS_LORAWAN_MAC_MCPS_H_
00028 
00029 #include "lorawan/system/lorawan_data_structures.h"
00030 #include "lorastack/phy/LoRaPHY.h"
00031 
00032 // forward declaration
00033 class LoRaMac;
00034 
00035 class LoRaMacMcps {
00036 
00037 public:
00038 
00039     /** Constructor
00040      *
00041      * Sets local handles to NULL. These handles will be set when the subsystem
00042      * is activated by the MAC layer.
00043      */
00044     LoRaMacMcps();
00045 
00046     /** Destructor
00047      *
00048      * Does nothing
00049      */
00050     ~LoRaMacMcps();
00051 
00052     /** Activating MCPS subsystem
00053      *
00054      * Stores pointers to MAC and PHY layer handles
00055      *
00056      * @param mac    pointer to MAC layer
00057      * @param phy    pointer to PHY layer
00058      */
00059     void activate_mcps_subsystem(LoRaMac *mac, LoRaPHY *phy);
00060 
00061     /** Sets up an MCPS Request
00062      *
00063      * Sets up an MCPS request and sends it through to the central MAC control.
00064      * It also modifies or uses protocol information provided in the MAC
00065      * protocol data structure.
00066      *
00067      * @param mcpsRequest    pointer to MCPS request structure
00068      * @param params         pointer to MAC protocol parameters
00069      *
00070      * @return               LORAWAN_STATUS_OK if everything goes well otherwise
00071      *                       a negative error code is returned.
00072      */
00073     lorawan_status_t set_request(loramac_mcps_req_t  *mcpsRequest, loramac_protocol_params *params);
00074 
00075     /** Grants access to MCPS confirmation data
00076      *
00077      * @return               a reference to MCPS confirm data structure
00078      */
00079     inline loramac_mcps_confirm_t & get_confirmation()
00080     {
00081         return confirmation;
00082     }
00083 
00084     /** Grants access to MCPS indication data
00085      *
00086      * @return               a reference to MCPS indication data structure
00087      */
00088     inline loramac_mcps_indication_t & get_indication()
00089     {
00090         return indication;
00091     }
00092 
00093 
00094 private:
00095 
00096     /**
00097      * Pointers to MAC and PHY handles
00098      */
00099     LoRaMac *_lora_mac;
00100     LoRaPHY *_lora_phy;
00101 
00102     /**
00103      * Structure to hold MCPS indication data.
00104      */
00105     loramac_mcps_indication_t  indication;
00106 
00107     /**
00108      * Structure to hold MCPS confirm data.
00109      */
00110     loramac_mcps_confirm_t  confirmation;
00111 };
00112 
00113 #endif /* MBED_OS_LORAWAN_MAC_MCPS_H_ */