MultiTech / mDot_Channel_Plans

The channel plans in this library can be used as starting points for new channel plans and used as a reference for implementation.

Information

To use source version of a channel plan, first remove the Channel Plans folder from libmDot-Custom library.

Not all plans are complete to LoRaWAN specifications.

AS923 and KR920 have the default channels defined and can accept in channels in the Join Accept message or from New Channel MAC commands.

Channel Set must match those expected by the network server in order for ADR to work

AS923 regional settings can be adjusted by the network server using Tx Param Setup MAC command to set max EIRP and dwell time for uplinks.

Committer:
jreiss
Date:
Wed Jan 18 13:33:36 2017 +0000
Revision:
11:829f8c2ec1c3
Child:
13:996f1663d12e
KR920: max DR 7; AS923: max tx power 36 max EIRP 20 defaults

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jreiss 11:829f8c2ec1c3 1 /** __ ___ ____ _ ______ __ ____ __ ____
jreiss 11:829f8c2ec1c3 2 * / |/ /_ __/ / /_(_)__/_ __/__ ____/ / / __/_ _____ / /____ __ _ ___ / _/__ ____
jreiss 11:829f8c2ec1c3 3 * / /|_/ / // / / __/ /___// / / -_) __/ _ \ _\ \/ // (_-</ __/ -_) ' \(_-< _/ // _ \/ __/ __
jreiss 11:829f8c2ec1c3 4 * /_/ /_/\_,_/_/\__/_/ /_/ \__/\__/_//_/ /___/\_, /___/\__/\__/_/_/_/___/ /___/_//_/\__/ /_/
jreiss 11:829f8c2ec1c3 5 * Copyright (C) 2015 by Multi-Tech Systems /___/
jreiss 11:829f8c2ec1c3 6 *
jreiss 11:829f8c2ec1c3 7 *
jreiss 11:829f8c2ec1c3 8 * @author Jason Reiss
jreiss 11:829f8c2ec1c3 9 * @date 10-31-2015
jreiss 11:829f8c2ec1c3 10 * @brief lora::ChannelPlan provides an interface for LoRaWAN channel schemes
jreiss 11:829f8c2ec1c3 11 *
jreiss 11:829f8c2ec1c3 12 * @details
jreiss 11:829f8c2ec1c3 13 *
jreiss 11:829f8c2ec1c3 14 */
jreiss 11:829f8c2ec1c3 15
jreiss 11:829f8c2ec1c3 16 #ifndef __CUSTOM_CHANNEL_PLAN_AU915_H__
jreiss 11:829f8c2ec1c3 17 #define __CUSTOM_CHANNEL_PLAN_AU915_H__
jreiss 11:829f8c2ec1c3 18
jreiss 11:829f8c2ec1c3 19 #include "Lora.h"
jreiss 11:829f8c2ec1c3 20 #include "SxRadio.h"
jreiss 11:829f8c2ec1c3 21 #include "ChannelPlan.h"
jreiss 11:829f8c2ec1c3 22 #include <vector>
jreiss 11:829f8c2ec1c3 23
jreiss 11:829f8c2ec1c3 24 namespace lora {
jreiss 11:829f8c2ec1c3 25
jreiss 11:829f8c2ec1c3 26 class CustomChannelPlan_AU915 : public lora::ChannelPlan {
jreiss 11:829f8c2ec1c3 27 public:
jreiss 11:829f8c2ec1c3 28
jreiss 11:829f8c2ec1c3 29 /**
jreiss 11:829f8c2ec1c3 30 * ChannelPlan constructor
jreiss 11:829f8c2ec1c3 31 * @param radio SxRadio object used to set Tx/Rx config
jreiss 11:829f8c2ec1c3 32 * @param settings Settings object
jreiss 11:829f8c2ec1c3 33 */
jreiss 11:829f8c2ec1c3 34 CustomChannelPlan_AU915(SxRadio& radio, Settings& settings);
jreiss 11:829f8c2ec1c3 35
jreiss 11:829f8c2ec1c3 36 /**
jreiss 11:829f8c2ec1c3 37 * ChannelPlan destructor
jreiss 11:829f8c2ec1c3 38 */
jreiss 11:829f8c2ec1c3 39 virtual ~CustomChannelPlan_AU915();
jreiss 11:829f8c2ec1c3 40
jreiss 11:829f8c2ec1c3 41 /**
jreiss 11:829f8c2ec1c3 42 * Initialize channels, datarates and duty cycle bands according to current channel plan in settings
jreiss 11:829f8c2ec1c3 43 */
jreiss 11:829f8c2ec1c3 44 virtual void Init();
jreiss 11:829f8c2ec1c3 45
jreiss 11:829f8c2ec1c3 46 /**
jreiss 11:829f8c2ec1c3 47 * Get the next channel to use to transmit
jreiss 11:829f8c2ec1c3 48 * @return LORA_OK if channel was found
jreiss 11:829f8c2ec1c3 49 * @return LORA_NO_CHANS_ENABLED
jreiss 11:829f8c2ec1c3 50 */
jreiss 11:829f8c2ec1c3 51 virtual uint8_t GetNextChannel();
jreiss 11:829f8c2ec1c3 52
jreiss 11:829f8c2ec1c3 53 /**
jreiss 11:829f8c2ec1c3 54 * Set the number of channels in the plan
jreiss 11:829f8c2ec1c3 55 */
jreiss 11:829f8c2ec1c3 56 virtual void SetNumberOfChannels(uint8_t channels, bool resize = true);
jreiss 11:829f8c2ec1c3 57
jreiss 11:829f8c2ec1c3 58 /**
jreiss 11:829f8c2ec1c3 59 * Check if channel is enabled
jreiss 11:829f8c2ec1c3 60 * @return true if enabled
jreiss 11:829f8c2ec1c3 61 */
jreiss 11:829f8c2ec1c3 62 virtual bool IsChannelEnabled(uint8_t channel);
jreiss 11:829f8c2ec1c3 63
jreiss 11:829f8c2ec1c3 64
jreiss 11:829f8c2ec1c3 65 /**
jreiss 11:829f8c2ec1c3 66 * Add a channel to the ChannelPlan
jreiss 11:829f8c2ec1c3 67 * @param index of channel, use -1 to add to end
jreiss 11:829f8c2ec1c3 68 * @param channel settings to add
jreiss 11:829f8c2ec1c3 69 */
jreiss 11:829f8c2ec1c3 70 virtual uint8_t AddChannel(int8_t index, Channel channel);
jreiss 11:829f8c2ec1c3 71
jreiss 11:829f8c2ec1c3 72 /**
jreiss 11:829f8c2ec1c3 73 * Get channel at index
jreiss 11:829f8c2ec1c3 74 * @return Channel
jreiss 11:829f8c2ec1c3 75 */
jreiss 11:829f8c2ec1c3 76 virtual Channel GetChannel(int8_t index);
jreiss 11:829f8c2ec1c3 77
jreiss 11:829f8c2ec1c3 78 /**
jreiss 11:829f8c2ec1c3 79 * Get rx window settings for requested window
jreiss 11:829f8c2ec1c3 80 * RX_1, RX_2, RX_BEACON, RX_SLOT
jreiss 11:829f8c2ec1c3 81 * @param window
jreiss 11:829f8c2ec1c3 82 * @return RxWindow
jreiss 11:829f8c2ec1c3 83 */
jreiss 11:829f8c2ec1c3 84 virtual RxWindow GetRxWindow(uint8_t window);
jreiss 11:829f8c2ec1c3 85
jreiss 11:829f8c2ec1c3 86 /**
jreiss 11:829f8c2ec1c3 87 * Get datarate to use on the join request
jreiss 11:829f8c2ec1c3 88 * @return datarate index
jreiss 11:829f8c2ec1c3 89 */
jreiss 11:829f8c2ec1c3 90 virtual uint8_t GetJoinDatarate();
jreiss 11:829f8c2ec1c3 91
jreiss 11:829f8c2ec1c3 92 /**
jreiss 11:829f8c2ec1c3 93 * Calculate the next time a join request is possible
jreiss 11:829f8c2ec1c3 94 * @param size of join frame
jreiss 11:829f8c2ec1c3 95 * @returns LORA_OK
jreiss 11:829f8c2ec1c3 96 */
jreiss 11:829f8c2ec1c3 97 virtual uint8_t CalculateJoinBackoff(uint8_t size);
jreiss 11:829f8c2ec1c3 98
jreiss 11:829f8c2ec1c3 99 /**
jreiss 11:829f8c2ec1c3 100 * Set the datarate offset used for first receive window
jreiss 11:829f8c2ec1c3 101 * @param offset
jreiss 11:829f8c2ec1c3 102 * @return LORA_OK
jreiss 11:829f8c2ec1c3 103 */
jreiss 11:829f8c2ec1c3 104 virtual uint8_t SetRx1Offset(uint8_t offset);
jreiss 11:829f8c2ec1c3 105
jreiss 11:829f8c2ec1c3 106 /**
jreiss 11:829f8c2ec1c3 107 * Set the frequency for second receive window
jreiss 11:829f8c2ec1c3 108 * @param freq
jreiss 11:829f8c2ec1c3 109 * @return LORA_OK
jreiss 11:829f8c2ec1c3 110 */
jreiss 11:829f8c2ec1c3 111 virtual uint8_t SetRx2Frequency(uint32_t freq);
jreiss 11:829f8c2ec1c3 112
jreiss 11:829f8c2ec1c3 113 /**
jreiss 11:829f8c2ec1c3 114 * Set the datarate index used for second receive window
jreiss 11:829f8c2ec1c3 115 * @param index
jreiss 11:829f8c2ec1c3 116 * @return LORA_OK
jreiss 11:829f8c2ec1c3 117 */
jreiss 11:829f8c2ec1c3 118 virtual uint8_t SetRx2DatarateIndex(uint8_t index);
jreiss 11:829f8c2ec1c3 119
jreiss 11:829f8c2ec1c3 120 /**
jreiss 11:829f8c2ec1c3 121 * Get next channel and set the SxRadio tx config with current settings
jreiss 11:829f8c2ec1c3 122 * @return LORA_OK
jreiss 11:829f8c2ec1c3 123 */
jreiss 11:829f8c2ec1c3 124 virtual uint8_t SetTxConfig();
jreiss 11:829f8c2ec1c3 125
jreiss 11:829f8c2ec1c3 126 /**
jreiss 11:829f8c2ec1c3 127 * Set the SxRadio rx config provided window
jreiss 11:829f8c2ec1c3 128 * @param window to be opened
jreiss 11:829f8c2ec1c3 129 * @param continuous keep window open
jreiss 11:829f8c2ec1c3 130 * @return LORA_OK
jreiss 11:829f8c2ec1c3 131 */
jreiss 11:829f8c2ec1c3 132 virtual uint8_t SetRxConfig(uint8_t window, bool continuous);
jreiss 11:829f8c2ec1c3 133
jreiss 11:829f8c2ec1c3 134 /**
jreiss 11:829f8c2ec1c3 135 * Set channel group if supported by plan
jreiss 11:829f8c2ec1c3 136 * @param group
jreiss 11:829f8c2ec1c3 137 * @return LORA_OK
jreiss 11:829f8c2ec1c3 138 */
jreiss 11:829f8c2ec1c3 139 virtual uint8_t SetChannelGroup(uint8_t group);
jreiss 11:829f8c2ec1c3 140
jreiss 11:829f8c2ec1c3 141 /**
jreiss 11:829f8c2ec1c3 142 * Callback for Join Accept packet to load optional channels
jreiss 11:829f8c2ec1c3 143 * @return LORA_OK
jreiss 11:829f8c2ec1c3 144 */
jreiss 11:829f8c2ec1c3 145 virtual uint8_t HandleJoinAccept(const uint8_t* buffer, uint8_t size);
jreiss 11:829f8c2ec1c3 146
jreiss 11:829f8c2ec1c3 147 /**
jreiss 11:829f8c2ec1c3 148 * Callback to for rx parameter setup ServerCommand
jreiss 11:829f8c2ec1c3 149 * @param payload packet data
jreiss 11:829f8c2ec1c3 150 * @param index of start of command buffer
jreiss 11:829f8c2ec1c3 151 * @param size number of bytes in command buffer
jreiss 11:829f8c2ec1c3 152 * @param[out] status to be returned in MoteCommand answer
jreiss 11:829f8c2ec1c3 153 * @return LORA_OK
jreiss 11:829f8c2ec1c3 154 */
jreiss 11:829f8c2ec1c3 155 virtual uint8_t HandleRxParamSetup(const uint8_t* payload, uint8_t index, uint8_t size, uint8_t& status);
jreiss 11:829f8c2ec1c3 156
jreiss 11:829f8c2ec1c3 157 /**
jreiss 11:829f8c2ec1c3 158 * Callback to for new channel ServerCommand
jreiss 11:829f8c2ec1c3 159 * @param payload packet data
jreiss 11:829f8c2ec1c3 160 * @param index of start of command buffer
jreiss 11:829f8c2ec1c3 161 * @param size number of bytes in command buffer
jreiss 11:829f8c2ec1c3 162 * @param[out] status to be returned in MoteCommand answer
jreiss 11:829f8c2ec1c3 163 * @return LORA_OK
jreiss 11:829f8c2ec1c3 164 */
jreiss 11:829f8c2ec1c3 165 virtual uint8_t HandleNewChannel(const uint8_t* payload, uint8_t index, uint8_t size, uint8_t& status);
jreiss 11:829f8c2ec1c3 166
jreiss 11:829f8c2ec1c3 167 /**
jreiss 11:829f8c2ec1c3 168 * Callback to for ping slot channel request ServerCommand
jreiss 11:829f8c2ec1c3 169 * @param payload packet data
jreiss 11:829f8c2ec1c3 170 * @param index of start of command buffer
jreiss 11:829f8c2ec1c3 171 * @param size number of bytes in command buffer
jreiss 11:829f8c2ec1c3 172 * @param[out] status to be returned in MoteCommand answer
jreiss 11:829f8c2ec1c3 173 * @return LORA_OK
jreiss 11:829f8c2ec1c3 174 */
jreiss 11:829f8c2ec1c3 175 virtual uint8_t HandlePingSlotChannelReq(const uint8_t* payload, uint8_t index, uint8_t size, uint8_t& status);
jreiss 11:829f8c2ec1c3 176
jreiss 11:829f8c2ec1c3 177 /**
jreiss 11:829f8c2ec1c3 178 * Callback to for beacon frequency request ServerCommand
jreiss 11:829f8c2ec1c3 179 * @param payload packet data
jreiss 11:829f8c2ec1c3 180 * @param index of start of command buffer
jreiss 11:829f8c2ec1c3 181 * @param size number of bytes in command buffer
jreiss 11:829f8c2ec1c3 182 * @param[out] status to be returned in MoteCommand answer
jreiss 11:829f8c2ec1c3 183 * @return LORA_OK
jreiss 11:829f8c2ec1c3 184 */
jreiss 11:829f8c2ec1c3 185 virtual uint8_t HandleBeaconFrequencyReq(const uint8_t* payload, uint8_t index, uint8_t size, uint8_t& status);
jreiss 11:829f8c2ec1c3 186
jreiss 11:829f8c2ec1c3 187 /**
jreiss 11:829f8c2ec1c3 188 * Callback to for adaptive datarate ServerCommand
jreiss 11:829f8c2ec1c3 189 * @param payload packet data
jreiss 11:829f8c2ec1c3 190 * @param index of start of command buffer
jreiss 11:829f8c2ec1c3 191 * @param size number of bytes in command buffer
jreiss 11:829f8c2ec1c3 192 * @param[out] status to be returned in MoteCommand answer
jreiss 11:829f8c2ec1c3 193 * @return LORA_OK
jreiss 11:829f8c2ec1c3 194 */
jreiss 11:829f8c2ec1c3 195 virtual uint8_t HandleAdrCommand(const uint8_t* payload, uint8_t index, uint8_t size, uint8_t& status);
jreiss 11:829f8c2ec1c3 196
jreiss 11:829f8c2ec1c3 197 /**
jreiss 11:829f8c2ec1c3 198 * Flag if ADR ACK should be sent in next packet
jreiss 11:829f8c2ec1c3 199 * @return true when flag should be set
jreiss 11:829f8c2ec1c3 200 */
jreiss 11:829f8c2ec1c3 201 virtual bool AdrAckReq();
jreiss 11:829f8c2ec1c3 202
jreiss 11:829f8c2ec1c3 203 /**
jreiss 11:829f8c2ec1c3 204 * Get the time the radio must be off air to comply with regulations
jreiss 11:829f8c2ec1c3 205 * Time to wait may be dependent on duty-cycle restrictions per channel
jreiss 11:829f8c2ec1c3 206 * Or duty-cycle of join requests if OTAA is being attempted
jreiss 11:829f8c2ec1c3 207 * @return ms of time to wait for next tx opportunity
jreiss 11:829f8c2ec1c3 208 */
jreiss 11:829f8c2ec1c3 209 virtual uint32_t GetTimeOffAir();
jreiss 11:829f8c2ec1c3 210
jreiss 11:829f8c2ec1c3 211 /**
jreiss 11:829f8c2ec1c3 212 * Get the channels in use by current channel plan
jreiss 11:829f8c2ec1c3 213 * @return channel frequencies
jreiss 11:829f8c2ec1c3 214 */
jreiss 11:829f8c2ec1c3 215 virtual std::vector<uint32_t> GetChannels();
jreiss 11:829f8c2ec1c3 216
jreiss 11:829f8c2ec1c3 217 /**
jreiss 11:829f8c2ec1c3 218 * Get the channel datarate ranges in use by current channel plan
jreiss 11:829f8c2ec1c3 219 * @return channel datarate ranges
jreiss 11:829f8c2ec1c3 220 */
jreiss 11:829f8c2ec1c3 221 virtual std::vector<uint8_t> GetChannelRanges();
jreiss 11:829f8c2ec1c3 222
jreiss 11:829f8c2ec1c3 223
jreiss 11:829f8c2ec1c3 224 /**
jreiss 11:829f8c2ec1c3 225 * Print log message for given rx window
jreiss 11:829f8c2ec1c3 226 * @param wnd 1 or 2
jreiss 11:829f8c2ec1c3 227 */
jreiss 11:829f8c2ec1c3 228 virtual void LogRxWindow(uint8_t wnd);
jreiss 11:829f8c2ec1c3 229
jreiss 11:829f8c2ec1c3 230 /**
jreiss 11:829f8c2ec1c3 231 * Enable the default channels of the channel plan
jreiss 11:829f8c2ec1c3 232 */
jreiss 11:829f8c2ec1c3 233 virtual void EnableDefaultChannels();
jreiss 11:829f8c2ec1c3 234
jreiss 11:829f8c2ec1c3 235 virtual uint8_t GetMinDatarate();
jreiss 11:829f8c2ec1c3 236
jreiss 11:829f8c2ec1c3 237 virtual uint8_t GetMaxDatarate();
jreiss 11:829f8c2ec1c3 238
jreiss 11:829f8c2ec1c3 239 protected:
jreiss 11:829f8c2ec1c3 240
jreiss 11:829f8c2ec1c3 241 static const uint8_t AU915_TX_POWERS[11]; //!< List of available tx powers
jreiss 11:829f8c2ec1c3 242 static const uint8_t AU915_RADIO_POWERS[21]; //!< List of calibrated tx powers
jreiss 11:829f8c2ec1c3 243 static const uint8_t AU915_MAX_PAYLOAD_SIZE[]; //!< List of max payload sizes for each datarate
jreiss 11:829f8c2ec1c3 244 static const uint8_t AU915_MAX_PAYLOAD_SIZE_REPEATER[]; //!< List of repeater compatible max payload sizes for each datarate
jreiss 11:829f8c2ec1c3 245
jreiss 11:829f8c2ec1c3 246 };
jreiss 11:829f8c2ec1c3 247 }
jreiss 11:829f8c2ec1c3 248
jreiss 11:829f8c2ec1c3 249 #endif // __CUSTOM_CHANNEL_PLAN_AU915_H__
jreiss 11:829f8c2ec1c3 250