ver1

Committer:
Jenkins@KEILDM1.dc.multitech.prv
Date:
Fri Oct 12 10:33:08 2018 -0500
Revision:
182:b642f4d0c95b
Parent:
172:7ec44396a51b
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_AS923_H__
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 17 #define __CHANNEL_PLAN_AS923_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 <vector>
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 22 #include "ChannelPlan.h"
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 AS923_125K_NUM_CHANS = 16; //!< Number of 125k channels in AS923 channel plan
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 27 const uint8_t AS923_DEFAULT_NUM_CHANS = 2; //!< Number of default channels in AS923 channel plan
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 28 const uint32_t AS923_125K_FREQ_BASE = 923200000; //!< Frequency base for 125k AS923 uplink channels
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 29 const uint32_t AS923_125K_FREQ_STEP = 200000; //!< Frequency step for 125k AS923 uplink channels
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 30 const uint32_t AS923_RX2_FREQ = 923200000; //!< Frequency default for second rx window in AS923
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 31 const uint8_t AS923_BEACON_DR = DR_3; //!< Default beacon datarate
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 32 const uint32_t AS923_BEACON_FREQ = 923400000U; //!< Default beacon broadcast frequency
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 33
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 34 class ChannelPlan_AS923: public lora::ChannelPlan {
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 35 public:
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 36 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 37 * ChannelPlan constructor
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 38 * @param radio SxRadio object used to set Tx/Rx config
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 39 * @param settings Settings object
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 40 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 41 ChannelPlan_AS923();
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 42 ChannelPlan_AS923(Settings* settings);
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 43 ChannelPlan_AS923(SxRadio* radio, Settings* settings);
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 44
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 45 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 46 * ChannelPlan destructor
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 47 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 48 virtual ~ChannelPlan_AS923();
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 49
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 50 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 51 * Initialize channels, datarates and duty cycle bands according to current channel plan in settings
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 52 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 53 virtual void Init();
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 54
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 55 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 56 * Get the next channel to use to transmit
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 57 * @return LORA_OK if channel was found
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 58 * @return LORA_NO_CHANS_ENABLED
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 59 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 60 virtual uint8_t GetNextChannel();
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 61
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 62 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 63 * Add a channel to the ChannelPlan
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 64 * @param index of channel, use -1 to add to end
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 65 * @param channel settings to add
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 66 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 67 virtual uint8_t AddChannel(int8_t index, Channel channel);
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 68
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 69 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 70 * Get channel at index
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 71 * @return Channel
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 72 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 73 virtual Channel GetChannel(int8_t index);
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 74
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 75 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 76 * Get rx window settings for requested window
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 77 * RX_1, RX_2, RX_BEACON, RX_SLOT
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 78 * @param window
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 79 * @return RxWindow
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 80 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 81 virtual RxWindow GetRxWindow(uint8_t window);
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 82
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 83 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 84 * Get datarate to use on the join request
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 85 * @return datarate index
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 86 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 87 virtual uint8_t GetJoinDatarate();
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 88
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 89 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 90 * Calculate the next time a join request is possible
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 91 * @param size of join frame
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 92 * @returns LORA_OK
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 93 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 94 virtual uint8_t CalculateJoinBackoff(uint8_t size);
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 95
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 96 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 97 * Get next channel and set the SxRadio tx config with current settings
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 98 * @return LORA_OK
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 99 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 100 virtual uint8_t SetTxConfig();
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 101
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 102 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 103 * Set the SxRadio rx config provided window
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 104 * @param window to be opened
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 105 * @param continuous keep window open
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 106 * @param wnd_growth factor to increase the rx window by
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 107 * @return LORA_OK
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 108 */
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 109 virtual uint8_t SetRxConfig(uint8_t window, bool continuous, uint16_t wnd_growth);
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 110
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 111 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 112 * Set frequency sub band if supported by plan
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 113 * @param sub_band
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 114 * @return LORA_OK
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 115 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 116 virtual uint8_t SetFrequencySubBand(uint8_t sub_band);
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 117
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 118 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 119 * Callback for ACK timeout event
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 120 * @return LORA_OK
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 121 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 122 virtual uint8_t HandleAckTimeout();
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 123
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 124 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 125 * Callback for Join Accept packet to load optional channels
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 126 * @return LORA_OK
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 127 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 128 virtual uint8_t HandleJoinAccept(const uint8_t* buffer, uint8_t size);
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 129
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 130 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 131 * Callback to for rx parameter setup ServerCommand
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 132 * @param payload packet data
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 133 * @param index of start of command buffer
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 134 * @param size number of bytes in command buffer
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 135 * @param[out] status to be returned in MoteCommand answer
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 136 * @return LORA_OK
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 137 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 138 virtual uint8_t HandleRxParamSetup(const uint8_t* payload, uint8_t index, uint8_t size, uint8_t& status);
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 139
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 140 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 141 * Callback to for new channel ServerCommand
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 142 * @param payload packet data
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 143 * @param index of start of command buffer
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 144 * @param size number of bytes in command buffer
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 145 * @param[out] status to be returned in MoteCommand answer
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 146 * @return LORA_OK
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 147 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 148 virtual uint8_t HandleNewChannel(const uint8_t* payload, uint8_t index, uint8_t size, uint8_t& status);
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 149
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 150 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 151 * Callback to for ping slot channel request ServerCommand
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 152 * @param payload packet data
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 153 * @param index of start of command buffer
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 154 * @param size number of bytes in command buffer
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 155 * @param[out] status to be returned in MoteCommand answer
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 156 * @return LORA_OK
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 157 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 158 virtual uint8_t HandlePingSlotChannelReq(const uint8_t* payload, uint8_t index, uint8_t size, uint8_t& status);
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 159
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 160 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 161 * Callback to for beacon frequency request ServerCommand
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 162 * @param payload packet data
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 163 * @param index of start of command buffer
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 164 * @param size number of bytes in command buffer
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 165 * @param[out] status to be returned in MoteCommand answer
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 HandleBeaconFrequencyReq(const uint8_t* payload, uint8_t index, uint8_t size, uint8_t& status);
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 to for adaptive datarate ServerCommand
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 172 * @param payload packet data
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 173 * @param index of start of command buffer
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 174 * @param size number of bytes in command buffer
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 175 * @param[out] status to be returned in MoteCommand answer
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 176 * @return LORA_OK
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 177 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 178 virtual uint8_t HandleAdrCommand(const uint8_t* payload, uint8_t index, uint8_t size, uint8_t& status);
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 179
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 180 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 181 * Validate the configuration after multiple ADR commands have been applied
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 182 * @return status to be returned in MoteCommand answer
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 183 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 184 virtual uint8_t ValidateAdrConfiguration();
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 185
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 186 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 187 * Update duty cycle with at given frequency and time on air
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 188 * @param freq frequency
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 189 * @param time_on_air_ms tx time on air
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 190 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 191 virtual void UpdateDutyCycle(uint32_t freq, uint32_t time_on_air_ms);
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 192
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 193 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 194 * Get the time the radio must be off air to comply with regulations
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 195 * Time to wait may be dependent on duty-cycle restrictions per channel
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 196 * Or duty-cycle of join requests if OTAA is being attempted
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 197 * @return ms of time to wait for next tx opportunity
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 198 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 199 virtual uint32_t GetTimeOffAir();
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 200
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 201 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 202 * Get the channels in use by current channel plan
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 203 * @return channel frequencies
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 204 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 205 virtual std::vector<uint32_t> GetChannels();
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 206
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 207 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 208 * Get the channel datarate ranges in use by current channel plan
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 209 * @return channel datarate ranges
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 210 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 211 virtual std::vector<uint8_t> GetChannelRanges();
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 212
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 213 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 214 * Print log message for given rx window
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 215 * @param wnd 1 or 2
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 216 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 217 virtual void LogRxWindow(uint8_t wnd);
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 218
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 219 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 220 * Enable the default channels of the channel plan
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 221 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 222 virtual void EnableDefaultChannels();
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 223
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 224 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 225 * Called when MAC layer doesn't know about a command.
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 226 * Use to add custom or new mac command handling
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 227 * @return LORA_OK
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 228 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 229 virtual uint8_t HandleMacCommand(uint8_t* payload, uint8_t& index);
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 230
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 231 /**
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 232 * Get max payload size for current datarate
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 233 * @return size in bytes
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 234 */
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 235 virtual uint8_t GetMaxPayloadSize();
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 236
Jenkins@KEILDM1.dc.multitech.prv 109:41d16d4ab0f0 237 /**
Jenkins@KEILDM1.dc.multitech.prv 109:41d16d4ab0f0 238 * Decrements the datarate based on TxDwellTime
Jenkins@KEILDM1.dc.multitech.prv 109:41d16d4ab0f0 239 */
Jenkins@KEILDM1.dc.multitech.prv 109:41d16d4ab0f0 240 virtual void DecrementDatarate();
Jenkins@KEILDM1.dc.multitech.prv 109:41d16d4ab0f0 241
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 242 /**
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 243 * Check if this packet is a beacon and if so extract parameters needed
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 244 * @param payload of potential beacon
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 245 * @param size of the packet
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 246 * @param [out] data extracted from the beacon if this packet was indeed a beacon
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 247 * @return true if this packet is beacon, false if not
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 248 */
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 249 virtual bool DecodeBeacon(const uint8_t* payload,
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 250 size_t size,
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 251 BeaconData_t& data);
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 252
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 253 protected:
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 254
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 255 static const uint8_t AS923_TX_POWERS[8]; //!< List of available tx powers
Jenkins@KEILDM1.dc.multitech.prv 182:b642f4d0c95b 256 static const uint8_t AS923_RADIO_POWERS[21]; //!< List of calibrated tx powers
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 257 static const uint8_t AS923_MAX_PAYLOAD_SIZE[]; //!< List of max payload sizes for each datarate
Jenkins@KEILDM1.dc.multitech.prv 182:b642f4d0c95b 258 static const uint8_t AS923_MAX_PAYLOAD_SIZE_400[]; //!< List of max payload sizes for each datarate
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 259 static const uint8_t AS923_MAX_PAYLOAD_SIZE_REPEATER[]; //!< List of repeater compatible max payload sizes for each datarate
Jenkins@KEILDM1.dc.multitech.prv 182:b642f4d0c95b 260 static const uint8_t AS923_MAX_PAYLOAD_SIZE_REPEATER_400[]; //!< List of repeater compatible max payload sizes for each datarate
Jenkins@KEILDM1.dc.multitech.prv 182:b642f4d0c95b 261 static const uint8_t MAX_ERP_VALUES[]; //!< Lookup table for Max EIRP (dBm) codes
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 262 typedef struct __attribute__((packed)) {
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 263 uint8_t RFU[2];
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 264 uint8_t Time[4];
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 265 uint8_t CRC1[2];
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 266 uint8_t GwSpecific[7];
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 267 uint8_t CRC2[2];
Jenkins@KEILDM1.dc.multitech.prv 172:7ec44396a51b 268 } BCNPayload;
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 269 };
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 270 }
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 271
Jenkins@KEILDM1.dc.multitech.prv 82:0f5a742a08cd 272 #endif //__CHANNEL_PLAN_AS923_H__