ver1

Committer:
Jenkins@KEILDM1.dc.multitech.prv
Date:
Fri Oct 12 10:33:08 2018 -0500
Revision:
182:b642f4d0c95b
Parent:
178:8f7d93f3bbb5
mdot-library revision 3.1.0-36-gf489e3e and mbed-os revision mbed-os-5.9.6

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 1 /** __ ___ ____ _ ______ __ ____ __ ____
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 2 * / |/ /_ __/ / /_(_)__/_ __/__ ____/ / / __/_ _____ / /____ __ _ ___ / _/__ ____
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 3 * / /|_/ / // / / __/ /___// / / -_) __/ _ \ _\ \/ // (_-</ __/ -_) ' \(_-< _/ // _ \/ __/ __
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 4 * /_/ /_/\_,_/_/\__/_/ /_/ \__/\__/_//_/ /___/\_, /___/\__/\__/_/_/_/___/ /___/_//_/\__/ /_/
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 5 * Copyright (C) 2015 by Multi-Tech Systems /___/
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 6 *
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 7 *
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 8 * @author Jason Reiss
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 9 * @date 10-31-2015
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 10 * @brief lora::ChannelPlan provides an interface for LoRaWAN channel schemes
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 11 *
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 12 * @details
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 13 *
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 14 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 15
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 16 #ifndef __CHANNEL_PLAN_AU915_H__
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 17 #define __CHANNEL_PLAN_AU915_H__
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 18
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 19 #include "Lora.h"
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 20 #include "SxRadio.h"
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 21 #include "ChannelPlan.h"
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 22 #include <vector>
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 23
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 24 namespace lora {
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 25
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 26 const uint8_t AU915_125K_NUM_CHANS = 64; //!< Number of 125k channels in AU915 channel plan
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 27 const uint8_t AU915_500K_NUM_CHANS = 8; //!< Number of 500k channels in AU915 channel plan
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 28
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 29 const uint32_t AU915_125K_FREQ_BASE = 915200000; //!< Frequency base for 125k AU915 uplink channels
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 30 const uint32_t AU915_125K_FREQ_STEP = 200000; //!< Frequency step for 125k AU915 uplink channels
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 31
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 32 const uint32_t AU915_500K_FREQ_BASE = 915900000; //!< Frequency base for 500k AU915 uplink channels
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 33 const uint32_t AU915_500K_FREQ_STEP = 1600000; //!< Frequency step for 500k AU915 uplink channels
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 34
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 35 const uint32_t AU915_500K_DBASE = 923300000; //!< Frequency base for 500k AU915 downlink channels
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 36 const uint32_t AU915_500K_DSTEP = 600000; //!< Frequency step for 500k AU915 downlink channels
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 37
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 38 const uint32_t AU915_FREQ_MIN = 915000000;
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 39 const uint32_t AU915_FREQ_MAX = 928000000;
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 40
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 41 const uint8_t AU915_MIN_DATARATE = (uint8_t) DR_0; //!< Minimum transmit datarate for AU915
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 42 const uint8_t AU915_MAX_DATARATE = (uint8_t) DR_6; //!< Maximum transmit datarate for AU915
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 43
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 44 const uint8_t AU915_MIN_DATARATE_OFFSET = (uint8_t) 0; //!< Minimum transmit datarate for AU915
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 45 const uint8_t AU915_MAX_DATARATE_OFFSET = (uint8_t) 5; //!< Maximum transmit datarate for AU915
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 46
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 47 const uint8_t AU915_BEACON_DR = DR_8; //!< Default beacon datarate
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 48 const uint32_t AU915_BEACON_FREQ_BASE = 923300000U; //!< Base beacon broadcast frequency
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 49 const uint32_t AU915_BEACON_FREQ_STEP = 600000U; //!< Step size for beacon frequencies
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 50 const uint8_t AU915_BEACON_CHANNELS = 8U; //!< Number of beacon channels
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 51
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 52 class ChannelPlan_AU915 : public lora::ChannelPlan {
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 53 public:
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 54
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 55 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 56 * ChannelPlan constructor
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 57 * @param radio SxRadio object used to set Tx/Rx config
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 58 * @param settings Settings object
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 59 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 60 ChannelPlan_AU915();
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 61 ChannelPlan_AU915(Settings* settings);
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 62 ChannelPlan_AU915(SxRadio* radio, Settings* settings);
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 63
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 64 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 65 * ChannelPlan destructor
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 66 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 67 virtual ~ChannelPlan_AU915();
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 68
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 69 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 70 * Initialize channels, datarates and duty cycle bands according to current channel plan in settings
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 71 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 72 virtual void Init();
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 73
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 74 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 75 * Get the next channel to use to transmit
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 76 * @return LORA_OK if channel was found
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 77 * @return LORA_NO_CHANS_ENABLED
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 78 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 79 virtual uint8_t GetNextChannel();
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 80
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 81 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 82 * Set the number of channels in the plan
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 83 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 84 virtual void SetNumberOfChannels(uint8_t channels, bool resize = true);
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 85
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 86 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 87 * Check if channel is enabled
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 88 * @return true if enabled
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 89 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 90 virtual bool IsChannelEnabled(uint8_t channel);
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 91
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 92
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 93 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 94 * Add a channel to the ChannelPlan
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 95 * @param index of channel, use -1 to add to end
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 96 * @param channel settings to add
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 97 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 98 virtual uint8_t AddChannel(int8_t index, Channel channel);
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 99
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 100 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 101 * Get channel at index
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 102 * @return Channel
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 103 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 104 virtual Channel GetChannel(int8_t index);
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 105
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 106 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 107 * Get rx window settings for requested window
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 108 * RX_1, RX_2, RX_BEACON, RX_SLOT
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 109 * @param window
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 110 * @return RxWindow
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 111 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 112 virtual RxWindow GetRxWindow(uint8_t window);
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 113
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 114 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 115 * Get datarate to use on the join request
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 116 * @return datarate index
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 117 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 118 virtual uint8_t GetJoinDatarate();
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 119
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 120 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 121 * Calculate the next time a join request is possible
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 122 * @param size of join frame
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 123 * @returns LORA_OK
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 124 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 125 virtual uint8_t CalculateJoinBackoff(uint8_t size);
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 126
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 127 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 128 * Set the datarate offset used for first receive window
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 129 * @param offset
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 130 * @return LORA_OK
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 131 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 132 virtual uint8_t SetRx1Offset(uint8_t offset);
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 133
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 134 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 135 * Set the frequency for second receive window
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 136 * @param freq
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 137 * @return LORA_OK
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 138 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 139 virtual uint8_t SetRx2Frequency(uint32_t freq);
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 140
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 141 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 142 * Set the datarate index used for second receive window
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 143 * @param index
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 144 * @return LORA_OK
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 145 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 146 virtual uint8_t SetRx2DatarateIndex(uint8_t index);
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 147
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 148 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 149 * Get next channel and set the SxRadio tx config with current settings
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 150 * @return LORA_OK
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 151 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 152 virtual uint8_t SetTxConfig();
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 153
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 154 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 155 * Set the SxRadio rx config provided window
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 156 * @param window to be opened
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 157 * @param continuous keep window open
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 158 * @param wnd_growth factor to increase the rx window by
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 159 * @return LORA_OK
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 160 */
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 161 virtual uint8_t SetRxConfig(uint8_t window, bool continuous, uint16_t wnd_growth);
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 162
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 163 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 164 * Set frequency sub band if supported by plan
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 165 * @param sub_band
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 166 * @return LORA_OK
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 167 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 168 virtual uint8_t SetFrequencySubBand(uint8_t sub_band);
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 169
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 170 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 171 * Callback for Join Accept packet to load optional channels
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 172 * @return LORA_OK
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 173 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 174 virtual uint8_t HandleJoinAccept(const uint8_t* buffer, uint8_t size);
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 175
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 176 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 177 * Callback to for rx parameter setup ServerCommand
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 178 * @param payload packet data
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 179 * @param index of start of command buffer
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 180 * @param size number of bytes in command buffer
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 181 * @param[out] status to be returned in MoteCommand answer
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 182 * @return LORA_OK
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 183 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 184 virtual uint8_t HandleRxParamSetup(const uint8_t* payload, uint8_t index, uint8_t size, uint8_t& status);
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 185
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 186 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 187 * Callback to for new channel ServerCommand
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 188 * @param payload packet data
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 189 * @param index of start of command buffer
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 190 * @param size number of bytes in command buffer
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 191 * @param[out] status to be returned in MoteCommand answer
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 192 * @return LORA_OK
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 193 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 194 virtual uint8_t HandleNewChannel(const uint8_t* payload, uint8_t index, uint8_t size, uint8_t& status);
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 195
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 196 /**
Jenkins@KEILDM1.dc.multitech.prv 139:b2e9d643eef9 197 * Callback to for downlink channel request ServerCommand
Jenkins@KEILDM1.dc.multitech.prv 139:b2e9d643eef9 198 * @param payload packet data
Jenkins@KEILDM1.dc.multitech.prv 139:b2e9d643eef9 199 * @param index of start of command buffer
Jenkins@KEILDM1.dc.multitech.prv 139:b2e9d643eef9 200 * @param size number of bytes in command buffer
Jenkins@KEILDM1.dc.multitech.prv 139:b2e9d643eef9 201 * @param[out] status to be returned in MoteCommand answer
Jenkins@KEILDM1.dc.multitech.prv 139:b2e9d643eef9 202 * @return LORA_OK
Jenkins@KEILDM1.dc.multitech.prv 139:b2e9d643eef9 203 */
Jenkins@KEILDM1.dc.multitech.prv 139:b2e9d643eef9 204 virtual uint8_t HandleDownlinkChannelReq(const uint8_t* payload, uint8_t index, uint8_t size, uint8_t& status);
Jenkins@KEILDM1.dc.multitech.prv 139:b2e9d643eef9 205
Jenkins@KEILDM1.dc.multitech.prv 139:b2e9d643eef9 206 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 207 * Callback to for ping slot channel request ServerCommand
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 208 * @param payload packet data
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 209 * @param index of start of command buffer
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 210 * @param size number of bytes in command buffer
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 211 * @param[out] status to be returned in MoteCommand answer
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 212 * @return LORA_OK
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 213 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 214 virtual uint8_t HandlePingSlotChannelReq(const uint8_t* payload, uint8_t index, uint8_t size, uint8_t& status);
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 215
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 216 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 217 * Callback to for beacon frequency request ServerCommand
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 218 * @param payload packet data
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 219 * @param index of start of command buffer
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 220 * @param size number of bytes in command buffer
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 221 * @param[out] status to be returned in MoteCommand answer
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 222 * @return LORA_OK
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 223 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 224 virtual uint8_t HandleBeaconFrequencyReq(const uint8_t* payload, uint8_t index, uint8_t size, uint8_t& status);
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 225
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 226 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 227 * Callback to for adaptive datarate ServerCommand
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 228 * @param payload packet data
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 229 * @param index of start of command buffer
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 230 * @param size number of bytes in command buffer
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 231 * @param[out] status to be returned in MoteCommand answer
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 232 * @return LORA_OK
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 233 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 234 virtual uint8_t HandleAdrCommand(const uint8_t* payload, uint8_t index, uint8_t size, uint8_t& status);
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 235
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 236 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 237 * Validate the configuration after multiple ADR commands have been applied
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 238 * @return status to be returned in MoteCommand answer
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 239 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 240 virtual uint8_t ValidateAdrConfiguration();
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 241
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 242 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 243 * Get the time the radio must be off air to comply with regulations
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 244 * Time to wait may be dependent on duty-cycle restrictions per channel
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 245 * Or duty-cycle of join requests if OTAA is being attempted
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 246 * @return ms of time to wait for next tx opportunity
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 247 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 248 virtual uint32_t GetTimeOffAir();
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 249
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 250 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 251 * Get the channels in use by current channel plan
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 252 * @return channel frequencies
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 253 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 254 virtual std::vector<uint32_t> GetChannels();
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 255
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 256 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 257 * Get the channel datarate ranges in use by current channel plan
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 258 * @return channel datarate ranges
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 259 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 260 virtual std::vector<uint8_t> GetChannelRanges();
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 261
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 262
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 263 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 264 * Print log message for given rx window
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 265 * @param wnd 1 or 2
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 266 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 267 virtual void LogRxWindow(uint8_t wnd);
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 268
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 269 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 270 * Enable the default channels of the channel plan
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 271 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 272 virtual void EnableDefaultChannels();
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 273
Jenkins@KEILDM1.dc.multitech.prv 182:b642f4d0c95b 274 /**
Jenkins@KEILDM1.dc.multitech.prv 182:b642f4d0c95b 275 * Called when MAC layer doesn't know about a command.
Jenkins@KEILDM1.dc.multitech.prv 182:b642f4d0c95b 276 * Use to add custom or new mac command handling
Jenkins@KEILDM1.dc.multitech.prv 182:b642f4d0c95b 277 * @return LORA_OK
Jenkins@KEILDM1.dc.multitech.prv 182:b642f4d0c95b 278 */
Jenkins@KEILDM1.dc.multitech.prv 182:b642f4d0c95b 279 virtual uint8_t HandleMacCommand(uint8_t* payload, uint8_t& index);
Jenkins@KEILDM1.dc.multitech.prv 182:b642f4d0c95b 280
Jenkins@KEILDM1.dc.multitech.prv 182:b642f4d0c95b 281 /**
Jenkins@KEILDM1.dc.multitech.prv 182:b642f4d0c95b 282 * Get max payload size for current datarate
Jenkins@KEILDM1.dc.multitech.prv 182:b642f4d0c95b 283 * @return size in bytes
Jenkins@KEILDM1.dc.multitech.prv 182:b642f4d0c95b 284 */
Jenkins@KEILDM1.dc.multitech.prv 182:b642f4d0c95b 285 virtual uint8_t GetMaxPayloadSize();
Jenkins@KEILDM1.dc.multitech.prv 182:b642f4d0c95b 286
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 287 virtual uint8_t GetMinDatarate();
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 288
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 289 virtual uint8_t GetMaxDatarate();
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 290
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 291 /**
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 292 * Check if this packet is a beacon and if so extract parameters needed
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 293 * @param payload of potential beacon
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 294 * @param size of the packet
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 295 * @param [out] data extracted from the beacon if this packet was indeed a beacon
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 296 * @return true if this packet is beacon, false if not
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 297 */
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 298 virtual bool DecodeBeacon(const uint8_t* payload,
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 299 size_t size,
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 300 BeaconData_t& data);
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 301
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 302 /**
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 303 * Update class B beacon and ping slot settings if frequency hopping enabled
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 304 * @param time received in the last beacon
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 305 * @param period of the beacon
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 306 * @param devAddr of this end device
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 307 */
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 308 virtual void FrequencyHop(uint32_t time, uint32_t period, uint32_t devAddr);
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 309
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 310 protected:
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 311
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 312 static const uint8_t AU915_TX_POWERS[11]; //!< List of available tx powers
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 313 static const uint8_t AU915_RADIO_POWERS[21]; //!< List of calibrated tx powers
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 314 static const uint8_t AU915_MAX_PAYLOAD_SIZE[]; //!< List of max payload sizes for each datarate
Jenkins@KEILDM1.dc.multitech.prv 182:b642f4d0c95b 315 static const uint8_t AU915_MAX_PAYLOAD_SIZE_400[]; //!< List of max payload sizes for each datarate
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 316 static const uint8_t AU915_MAX_PAYLOAD_SIZE_REPEATER[]; //!< List of repeater compatible max payload sizes for each datarate
Jenkins@KEILDM1.dc.multitech.prv 182:b642f4d0c95b 317 static const uint8_t AU915_MAX_PAYLOAD_SIZE_REPEATER_400[]; //!< List of repeater compatible max payload sizes for each datarate
Jenkins@KEILDM1.dc.multitech.prv 182:b642f4d0c95b 318 static const uint8_t MAX_ERP_VALUES[]; //!< Lookup table for Max EIRP (dBm) codes
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 319
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 320 typedef struct __attribute__((packed)) {
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 321 uint8_t RFU1[3];
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 322 uint8_t Time[4];
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 323 uint8_t CRC1[2];
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 324 uint8_t GwSpecific[7];
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 325 uint8_t RFU2[1];
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 326 uint8_t CRC2[2];
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 327 } BCNPayload;
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 328 };
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 329 }
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 330
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 331 #endif // __CHANNEL_PLAN_AU915_H__