ver1
plans/ChannelPlan_EU868.h@183:960b4e7df69d, 2020-02-24 (annotated)
- Committer:
- hnript
- Date:
- Mon Feb 24 07:38:13 2020 +0000
- Revision:
- 183:960b4e7df69d
- Parent:
- 172:7ec44396a51b
ver1
Who changed what in which revision?
User | Revision | Line number | New 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_EU868_H__ |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 17 | #define __CHANNEL_PLAN_EU868_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 EU868_125K_NUM_CHANS = 16; //!< Number of 125k channels in EU868 channel plan |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 27 | const uint8_t EU868_DEFAULT_NUM_CHANS = 3; //!< Number of defualt channels in EU868 channel plan |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 28 | const uint32_t EU868_125K_FREQ_BASE = 868100000; //!< Frequency base for 125k EU868 uplink channels |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 29 | const uint32_t EU868_125K_FREQ_STEP = 200000; //!< Frequency step for 125k EU868 uplink channels |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 30 | const uint32_t EU868_RX2_FREQ = 869525000; //!< Frequency default for second rx window in EU868 |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 31 | |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 32 | const uint8_t EU868_TX_POWER_MAX = 14; //!< Max power for EU868 channel plan |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 33 | |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 34 | // 0.1% duty cycle 863-868 |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 35 | // Limiting to 865-868 allows for 1% duty cycle |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 36 | const uint32_t EU868_MILLI_FREQ_MIN = 865000000; |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 37 | const uint32_t EU868_MILLI_FREQ_MAX = 868000000; |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 38 | |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 39 | const uint32_t EU868_MILLI_1_FREQ_MIN = 868700000; |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 40 | const uint32_t EU868_MILLI_1_FREQ_MAX = 869200000; |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 41 | |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 42 | // 1% duty cycle |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 43 | const uint32_t EU868_CENTI_FREQ_MIN = 868000000; |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 44 | const uint32_t EU868_CENTI_FREQ_MAX = 868600000; |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 45 | |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 46 | // 10% duty cycle |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 47 | const uint32_t EU868_DECI_FREQ_MIN = 869400000; |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 48 | const uint32_t EU868_DECI_FREQ_MAX = 869650000; |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 49 | |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 50 | // Below 7dBm there is no duty cycle for these frequencies |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 51 | // Up to 14dBm there is 1% duty cycle |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 52 | const uint32_t EU868_VAR_FREQ_MIN = 869700000; |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 53 | const uint32_t EU868_VAR_FREQ_MAX = 870000000; |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 54 | |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 55 | const uint32_t EU868_FREQ_MIN = 863000000; |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 56 | const uint32_t EU868_FREQ_MAX = 870000000; |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 57 | |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 58 | const uint8_t EU868_MIN_DATARATE = (uint8_t) DR_0; //!< Minimum transmit datarate for EU868 |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 59 | const uint8_t EU868_MAX_DATARATE = (uint8_t) DR_7; //!< Maximum transmit datarate for EU868 |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 60 | |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 61 | const uint8_t EU868_MIN_DATARATE_OFFSET = (uint8_t) 0; //!< Minimum transmit datarate for US915 |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 62 | const uint8_t EU868_MAX_DATARATE_OFFSET = (uint8_t) 5; //!< Maximum transmit datarate for US915 |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 63 | |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 64 | const uint8_t EU868_BEACON_DR = DR_3; //!< Default beacon datarate |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 65 | const uint32_t EU868_BEACON_FREQ = 869525000U; //!< Default beacon broadcast frequency |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 66 | |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 67 | class ChannelPlan_EU868 : public lora::ChannelPlan { |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 68 | public: |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 69 | /** |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 70 | * ChannelPlan constructor |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 71 | * @param radio SxRadio object used to set Tx/Rx config |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 72 | * @param settings Settings object |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 73 | */ |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 74 | ChannelPlan_EU868(); |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 75 | ChannelPlan_EU868(Settings* settings); |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 76 | ChannelPlan_EU868(SxRadio* radio, Settings* settings); |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 77 | |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 78 | /** |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 79 | * ChannelPlan destructor |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 80 | */ |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 81 | virtual ~ChannelPlan_EU868(); |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 82 | |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 83 | /** |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 84 | * Initialize channels, datarates and duty cycle bands according to current channel plan in settings |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 85 | */ |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 86 | virtual void Init(); |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 87 | |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 88 | /** |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 89 | * Get the next channel to use to transmit |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 90 | * @return LORA_OK if channel was found |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 91 | * @return LORA_NO_CHANS_ENABLED |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 92 | */ |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 93 | virtual uint8_t GetNextChannel(); |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 94 | |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 95 | /** |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 96 | * Add a channel to the ChannelPlan |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 97 | * @param index of channel, use -1 to add to end |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 98 | * @param channel settings to add |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 99 | */ |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 100 | virtual uint8_t AddChannel(int8_t index, Channel channel); |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 101 | |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 102 | /** |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 103 | * Get channel at index |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 104 | * @return Channel |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 105 | */ |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 106 | virtual Channel GetChannel(int8_t index); |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 107 | |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 108 | /** |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 109 | * Get rx window settings for requested window |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 110 | * RX_1, RX_2, RX_BEACON, RX_SLOT |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 111 | * @param window |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 112 | * @return RxWindow |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 113 | */ |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 114 | virtual RxWindow GetRxWindow(uint8_t window); |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 115 | |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 116 | /** |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 117 | * Get datarate to use on the join request |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 118 | * @return datarate index |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 119 | */ |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 120 | virtual uint8_t GetJoinDatarate(); |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 121 | |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 122 | /** |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 123 | * Calculate the next time a join request is possible |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 124 | * @param size of join frame |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 125 | * @returns LORA_OK |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 126 | */ |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 127 | virtual uint8_t CalculateJoinBackoff(uint8_t size); |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 128 | |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 129 | /** |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 130 | * Get next channel and set the SxRadio tx config with current settings |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 131 | * @return LORA_OK |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 132 | */ |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 133 | virtual uint8_t SetTxConfig(); |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 134 | |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 135 | /** |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 136 | * Set the SxRadio rx config provided window |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 137 | * @param window to be opened |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 138 | * @param continuous keep window open |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 139 | * @param wnd_growth factor to increase the rx window by |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 140 | * @return LORA_OK |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 141 | */ |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 142 | virtual uint8_t SetRxConfig(uint8_t window, bool continuous, uint16_t wnd_growth); |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 143 | |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 144 | /** |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 145 | * Set frequency sub band if supported by plan |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 146 | * @param sub_band |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 147 | * @return LORA_OK |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 148 | */ |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 149 | virtual uint8_t SetFrequencySubBand(uint8_t sub_band); |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 150 | |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 151 | /** |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 152 | * Callback for ACK timeout event |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 153 | * @return LORA_OK |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 154 | */ |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 155 | virtual uint8_t HandleAckTimeout(); |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 156 | |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 157 | /** |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 158 | * Callback for Join Accept packet to load optional channels |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 159 | * @return LORA_OK |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 160 | */ |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 161 | virtual uint8_t HandleJoinAccept(const uint8_t* buffer, uint8_t size); |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 162 | |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 163 | /** |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 164 | * Callback to for rx parameter setup ServerCommand |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 165 | * @param payload packet data |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 166 | * @param index of start of command buffer |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 167 | * @param size number of bytes in command buffer |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 168 | * @param[out] status to be returned in MoteCommand answer |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 169 | * @return LORA_OK |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 170 | */ |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 171 | virtual uint8_t HandleRxParamSetup(const uint8_t* payload, uint8_t index, uint8_t size, uint8_t& status); |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 172 | |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 173 | /** |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 174 | * Callback to for new channel ServerCommand |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 175 | * @param payload packet data |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 176 | * @param index of start of command buffer |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 177 | * @param size number of bytes in command buffer |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 178 | * @param[out] status to be returned in MoteCommand answer |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 179 | * @return LORA_OK |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 180 | */ |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 181 | virtual uint8_t HandleNewChannel(const uint8_t* payload, uint8_t index, uint8_t size, uint8_t& status); |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 182 | |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 183 | /** |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 184 | * Callback to for ping slot channel request ServerCommand |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 185 | * @param payload packet data |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 186 | * @param index of start of command buffer |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 187 | * @param size number of bytes in command buffer |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 188 | * @param[out] status to be returned in MoteCommand answer |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 189 | * @return LORA_OK |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 190 | */ |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 191 | virtual uint8_t HandlePingSlotChannelReq(const uint8_t* payload, uint8_t index, uint8_t size, uint8_t& status); |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 192 | |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 193 | /** |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 194 | * Callback to for beacon frequency request ServerCommand |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 195 | * @param payload packet data |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 196 | * @param index of start of command buffer |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 197 | * @param size number of bytes in command buffer |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 198 | * @param[out] status to be returned in MoteCommand answer |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 199 | * @return LORA_OK |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 200 | */ |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 201 | virtual uint8_t HandleBeaconFrequencyReq(const uint8_t* payload, uint8_t index, uint8_t size, uint8_t& status); |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 202 | |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 203 | /** |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 204 | * Callback to for adaptive datarate ServerCommand |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 205 | * @param payload packet data |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 206 | * @param index of start of command buffer |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 207 | * @param size number of bytes in command buffer |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 208 | * @param[out] status to be returned in MoteCommand answer |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 209 | * @return LORA_OK |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 210 | */ |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 211 | virtual uint8_t HandleAdrCommand(const uint8_t* payload, uint8_t index, uint8_t size, uint8_t& status); |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 212 | |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 213 | /** |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 214 | * Validate the configuration after multiple ADR commands have been applied |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 215 | * @return status to be returned in MoteCommand answer |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 216 | */ |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 217 | virtual uint8_t ValidateAdrConfiguration(); |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 218 | |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 219 | /** |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 220 | * Update duty cycle with at given frequency and time on air |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 221 | * @param freq frequency |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 222 | * @param time_on_air_ms tx time on air |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 223 | */ |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 224 | virtual void UpdateDutyCycle(uint32_t freq, uint32_t time_on_air_ms); |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 225 | |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 226 | /** |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 227 | * Get the time the radio must be off air to comply with regulations |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 228 | * Time to wait may be dependent on duty-cycle restrictions per channel |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 229 | * Or duty-cycle of join requests if OTAA is being attempted |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 230 | * @return ms of time to wait for next tx opportunity |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 231 | */ |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 232 | virtual uint32_t GetTimeOffAir(); |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 233 | |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 234 | /** |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 235 | * Get the channels in use by current channel plan |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 236 | * @return channel frequencies |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 237 | */ |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 238 | virtual std::vector<uint32_t> GetChannels(); |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 239 | |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 240 | /** |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 241 | * Get the channel datarate ranges in use by current channel plan |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 242 | * @return channel datarate ranges |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 243 | */ |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 244 | virtual std::vector<uint8_t> GetChannelRanges(); |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 245 | |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 246 | /** |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 247 | * Print log message for given rx window |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 248 | * @param wnd 1 or 2 |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 249 | */ |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 250 | virtual void LogRxWindow(uint8_t wnd); |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 251 | |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 252 | /** |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 253 | * Enable the default channels of the channel plan |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 254 | */ |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 255 | virtual void EnableDefaultChannels(); |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 256 | |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 257 | /** |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 258 | * Check if this packet is a beacon and if so extract parameters needed |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 259 | * @param payload of potential beacon |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 260 | * @param size of the packet |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 261 | * @param [out] data extracted from the beacon if this packet was indeed a beacon |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 262 | * @return true if this packet is beacon, false if not |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 263 | */ |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 264 | virtual bool DecodeBeacon(const uint8_t* payload, |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 265 | size_t size, |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 266 | BeaconData_t& data); |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 267 | |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 268 | protected: |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 269 | |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 270 | static const uint8_t EU868_TX_POWERS[8]; //!< List of available tx powers |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 271 | static const uint8_t EU868_RADIO_POWERS[21]; //!< List of calibrated tx powers |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 272 | static const uint8_t EU868_MAX_PAYLOAD_SIZE[]; //!< List of max payload sizes for each datarate |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 273 | static const uint8_t EU868_MAX_PAYLOAD_SIZE_REPEATER[]; //!< List of repeater compatible max payload sizes for each datarate |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 274 | |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 275 | typedef struct __attribute__((packed)) { |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 276 | uint8_t RFU[2]; |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 277 | uint8_t Time[4]; |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 278 | uint8_t CRC1[2]; |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 279 | uint8_t GwSpecific[7]; |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 280 | uint8_t CRC2[2]; |
Jenkins@KEILDM1.dc.multitech.prv | 172:7ec44396a51b | 281 | } BCNPayload; |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 282 | }; |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 283 | } |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 284 | |
Jenkins@KEILDM1.dc.multitech.prv | 82:0f5a742a08cd | 285 | #endif //__CHANNEL_PLAN_EU868_H__ |