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      */
00058     void activate_channelplan_subsystem(LoRaPHY *phy);
00059 
00060     /** Set a given channel plan
00061      *
00062      * Used to set application provided channel plan. This API can be used to
00063      * set a single channel as well to the existing channel plan.
00064      *
00065      * @param plan    a reference to application channel plan. PHY layer takes a
00066      *                copy of the channel parameters provided within.
00067      *
00068      * @return        LORAWAN_STATUS_OK if everything goes well otherwise
00069      *                a negative error code is returned.
00070      */
00071     lorawan_status_t set_plan(const lorawan_channelplan_t& plan);
00072 
00073     /** Access the active channel plan
00074      *
00075      * Used to get active channel plan.
00076      *
00077      * @param plan          a reference to application provided channel plan structure
00078      *                      which gets filled in with active channel plan data.
00079      *
00080      * @param mib_confirm   pointer to MIB request structure containing channel information
00081      *
00082      * @return              LORAWAN_STATUS_OK if everything goes well otherwise
00083      *                      a negative error code is returned.
00084      */
00085     lorawan_status_t get_plan(lorawan_channelplan_t& plan, const loramac_mib_req_confirm_t  *mib_confirm);
00086 
00087     /** Remove the active channel plan
00088      *
00089      * Drops the whole channel list except the 'Default Channels' ofcourse.
00090      *
00091      * @return        LORAWAN_STATUS_OK if everything goes well otherwise
00092      *                a negative error code is returned.
00093      */
00094     lorawan_status_t remove_plan();
00095 
00096     /** Remove a single channel from the plan
00097      *
00098      * @param id    the channel id which needs to be removed
00099      *
00100      * @return      LORAWAN_STATUS_OK if everything goes well otherwise
00101      *              a negative error code is returned.
00102      */
00103     lorawan_status_t remove_single_channel(uint8_t id);
00104 
00105 private:
00106 
00107     /**
00108      * Local handles
00109      */
00110     LoRaPHY *_lora_phy;
00111 };
00112 
00113 
00114 
00115 #endif /* MBED_LORAWAN_LORAMACCHANNELPLAN_H_ */