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

« Back to documentation index

Show/hide line numbers LoRaMacChannelPlan.h Source File

LoRaMacChannelPlan.h

00001 /**
00002  \code
00003  / _____)             _              | |
00004 ( (____  _____ ____ _| |_ _____  ____| |__
00005  \____ \| ___ |    (_   _) ___ |/ ___)  _ \
00006  _____) ) ____| | | || |_| ____( (___| | | |
00007 (______/|_____)_|_|_| \__)_____)\____)_| |_|
00008     (C)2013 Semtech
00009  ___ _____ _   ___ _  _____ ___  ___  ___ ___
00010 / __|_   _/_\ / __| |/ / __/ _ \| _ \/ __| __|
00011 \__ \ | |/ _ \ (__| ' <| _| (_) |   / (__| _|
00012 |___/ |_/_/ \_\___|_|\_\_| \___/|_|_\\___|___|
00013 embedded.connectivity.solutions===============
00014 \endcode
00015 
00016 Description: LoRaWAN stack layer that controls both MAC and PHY underneath
00017 
00018 License: Revised BSD License, see LICENSE.TXT file include in the project
00019 
00020 Maintainer: Miguel Luis ( Semtech ), Gregory Cristian ( Semtech ) and Daniel Jaeckle ( STACKFORCE )
00021 
00022 
00023 Copyright (c) 2017, Arm Limited and affiliates.
00024 
00025 SPDX-License-Identifier: BSD-3-Clause
00026 */
00027 
00028 #ifndef MBED_LORAWAN_LORAMACCHANNELPLAN_H_
00029 #define MBED_LORAWAN_LORAMACCHANNELPLAN_H_
00030 
00031 #include "lorawan/system/lorawan_data_structures.h"
00032 #include "lorastack/phy/LoRaPHY.h"
00033 #include "lorastack/mac/LoRaMacMib.h"
00034 
00035 class LoRaMacChannelPlan {
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     LoRaMacChannelPlan();
00045 
00046     /** Destructor
00047      *
00048      * Does nothing
00049      */
00050     ~LoRaMacChannelPlan();
00051 
00052     /** Activates Channel Planning subsystem
00053      *
00054      * Stores pointers to PHY layer MIB subsystem
00055      *
00056      * @param phy    pointer to PHY layer
00057      * @param mib    pointer to MIB subsystem
00058      */
00059     void activate_channelplan_subsystem(LoRaPHY *phy,LoRaMacMib *mib);
00060 
00061     /** Set a given channel plan
00062      *
00063      * Used to set application provided channel plan. This API can be used to
00064      * set a single channel as well to the existing channel plan.
00065      *
00066      * @param plan    a reference to application channel plan. PHY layer takes a
00067      *                copy of the channel parameters provided within.
00068      *
00069      * @return        LORAWAN_STATUS_OK if everything goes well otherwise
00070      *                a negative error code is returned.
00071      */
00072     lorawan_status_t set_plan(const lorawan_channelplan_t& plan);
00073 
00074     /** Access the active channel plan
00075      *
00076      * Used to get active channel plan.
00077      *
00078      * @param plan      a reference to application provided channel plan structure
00079      *                  which gets filled in with active channel plan data.
00080      *
00081      * @param params    pointer to active MAC layer parameters.
00082      *
00083      * @return          LORAWAN_STATUS_OK if everything goes well otherwise
00084      *                  a negative error code is returned.
00085      */
00086     lorawan_status_t get_plan(lorawan_channelplan_t& plan, loramac_protocol_params *params);
00087 
00088     /** Remove the active channel plan
00089      *
00090      * Drops the whole channel list except the 'Default Channels' ofcourse.
00091      *
00092      * @return        LORAWAN_STATUS_OK if everything goes well otherwise
00093      *                a negative error code is returned.
00094      */
00095     lorawan_status_t remove_plan();
00096 
00097     /** Remove a single channel from the plan
00098      *
00099      * @param id    the channel id which needs to be removed
00100      *
00101      * @return      LORAWAN_STATUS_OK if everything goes well otherwise
00102      *              a negative error code is returned.
00103      */
00104     lorawan_status_t remove_single_channel(uint8_t id);
00105 
00106 private:
00107 
00108     /**
00109      * Local handles
00110      */
00111     LoRaPHY *_lora_phy;
00112     LoRaMacMib * _mib;
00113 };
00114 
00115 
00116 
00117 #endif /* MBED_LORAWAN_LORAMACCHANNELPLAN_H_ */