Stable version of the xDot library for mbed 5. This version of the library is suitable for deployment scenarios.

Dependents:   Dot-Examples XDOT-Devicewise Dot-Examples-delujoc Dot-Examples_receive ... more

Fork of libxDot-dev-mbed5-deprecated by MultiTech

The Dot library provides a LoRaWan certified stack for LoRa communication using MultiTech mDot and xDot devices. The stack is compatible with mbed 5.

The name of the repository can be used to determine which device the stack was compiled for and if it's a development or production-ready build:

A changelog for the Dot library can be found here.

The Dot library version and the version of mbed-os it was compiled against can both be found in the commit message for that revision of the Dot library. Building your application with the same version of mbed-os as what was used to build the Dot library is highly recommended!

The Dot-Examples repository demonstrates how to use the Dot library in a custom application.

The mDot and xDot platform pages have lots of platform specific information and document potential issues, gotchas, etc, and provide instructions for getting started with development. Please take a look at the platform page before starting development as they should answer many questions you will have.

FOTA

Full FOTA support is only available with mDot, xDot does not have the required external flash. xDot can use the FOTA example to dynamically join a multicast session only. After joining the multicast session the received Fragmentation packets could be handed to a host MCU for processing and at completion the firmware can be loaded into the xDot using the bootloader and y-modem. See xDot Developer Guide.

  • Add the following code to allow Fota to use the Dot instance

examples/src/fota_example.cpp

    // Initialize FOTA singleton
    Fota::getInstance(dot);
  • Add fragmentation handling the the PacketRx event

examples/inc/RadioEvent.h

    virtual void PacketRx(uint8_t port, uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr, lora::DownlinkControl ctrl, uint8_t slot, uint8_t retries, uint32_t address, bool dupRx) {
        mDotEvent::PacketRx(port, payload, size, rssi, snr, ctrl, slot, retries, address, dupRx);

#if ACTIVE_EXAMPLE == FOTA_EXAMPLE
        if(port == 200 || port == 201 || port == 202) {
            Fota::getInstance()->processCmd(payload, port, size);
        }
#endif
    }

The FOTA implementation has a few differences from the LoRaWAN Protocol

  • Fragmentation Indexing starts at 0
  • McKEKey is 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
  • Start Time is a count-down in seconds to start of session
Committer:
Jenkins@KEILDM1.dc.multitech.prv
Date:
Thu Apr 02 09:36:13 2020 -0500
Revision:
29:fb5769f4a67c
Parent:
19:aa5b1fcd05be
xdot-library revision 3.3.5 and mbed-os revision mbed-os-5.15.1

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1 /** __ ___ ____ _ ______ __ ____ __ ____
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 2 * / |/ /_ __/ / /_(_)__/_ __/__ ____/ / / __/_ _____ / /____ __ _ ___ / _/__ ____
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 3 * / /|_/ / // / / __/ /___// / / -_) __/ _ \ _\ \/ // (_-</ __/ -_) ' \(_-< _/ // _ \/ __/ __
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 4 * /_/ /_/\_,_/_/\__/_/ /_/ \__/\__/_//_/ /___/\_, /___/\__/\__/_/_/_/___/ /___/_//_/\__/ /_/
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 5 * Copyright (C) 2015 by Multi-Tech Systems /___/
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 6 *
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 7 *
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 8 * @author Jason Reiss
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 9 * @date 10-31-2015
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 10 * @brief lora::ChannelPlan provides an interface for LoRaWAN channel schemes
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 11 *
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 12 * @details
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 13 *
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 14 */
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 15
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 16 #ifndef __CHANNEL_PLAN_RU864_H__
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 17 #define __CHANNEL_PLAN_RU864_H__
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 18
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 19 #include "Lora.h"
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 20 #include "SxRadio.h"
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 21 #include <vector>
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 22 #include "ChannelPlan.h"
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 23
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 24 namespace lora {
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 25
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 26 const uint8_t RU864_125K_NUM_CHANS = 16; //!< Number of 125k channels in RU864 channel plan
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 27 const uint8_t RU864_DEFAULT_NUM_CHANS = 2; //!< Number of defualt channels in RU864 channel plan
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 28 const uint32_t RU864_125K_FREQ_BASE = 868900000; //!< Frequency base for 125k RU864 uplink channels
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 29 const uint32_t RU864_125K_FREQ_STEP = 200000; //!< Frequency step for 125k RU864 uplink channels
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 30 const uint32_t RU864_RX2_FREQ = 869100000; //!< Frequency default for second rx window in RU864
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 31
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 32 const uint8_t RU864_TX_POWER_MAX = 16; //!< Max power for RU864 channel plan
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 33
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 34 // 0.1% duty cycle 864-866
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 35 const uint32_t RU864_MILLI_FREQ_MIN = 864000000;
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 36 const uint32_t RU864_MILLI_FREQ_MAX = 865000000;
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 37
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 38
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 39 const uint32_t RU864_FREQ_MIN = 864000000;
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 40 const uint32_t RU864_FREQ_MAX = 870000000;
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 41
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 42 const uint8_t RU864_MIN_DATARATE = (uint8_t) DR_0; //!< Minimum transmit datarate for RU864
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 43 const uint8_t RU864_MAX_DATARATE = (uint8_t) DR_7; //!< Maximum transmit datarate for RU864
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 44
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 45 const uint8_t RU864_MIN_DATARATE_OFFSET = (uint8_t) 0; //!< Minimum transmit datarate for US915
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 46 const uint8_t RU864_MAX_DATARATE_OFFSET = (uint8_t) 5; //!< Maximum transmit datarate for US915
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 47
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 48 const uint8_t RU864_BEACON_DR = DR_3; //!< Default beacon datarate
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 49 const uint32_t RU864_BEACON_FREQ = 869100000U; //!< Default beacon broadcast frequency
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 50 const uint32_t RU864_PING_SLOT_FREQ = 868900000U; //!< Default ping slot frequency
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 51
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 52 class ChannelPlan_RU864 : public lora::ChannelPlan {
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 53 public:
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 54 /**
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 55 * ChannelPlan constructor
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 56 * @param radio SxRadio object used to set Tx/Rx config
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 57 * @param settings Settings object
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 58 */
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 59 ChannelPlan_RU864();
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 60 ChannelPlan_RU864(Settings* settings);
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 61 ChannelPlan_RU864(SxRadio* radio, Settings* settings);
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 62
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 63 /**
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 64 * ChannelPlan destructor
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 65 */
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 66 virtual ~ChannelPlan_RU864();
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 67
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 68 /**
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 69 * Initialize channels, datarates and duty cycle bands according to current channel plan in settings
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 70 */
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 71 virtual void Init();
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 72
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 73 /**
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 74 * Get the next channel to use to transmit
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 75 * @return LORA_OK if channel was found
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 76 * @return LORA_NO_CHANS_ENABLED
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 77 */
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 78 virtual uint8_t GetNextChannel();
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 79
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 80 /**
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 81 * Add a channel to the ChannelPlan
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 82 * @param index of channel, use -1 to add to end
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 83 * @param channel settings to add
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 84 */
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 85 virtual uint8_t AddChannel(int8_t index, Channel channel);
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 86
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 87 /**
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 88 * Get channel at index
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 89 * @return Channel
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 90 */
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 91 virtual Channel GetChannel(int8_t index);
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 92
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 93 /**
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 94 * Get rx window settings for requested window
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 95 * RX_1, RX_2, RX_BEACON, RX_SLOT
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 96 * @param window
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 97 * @return RxWindow
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 98 */
Jenkins@KEILDM1.dc.multitech.prv 29:fb5769f4a67c 99 virtual RxWindow GetRxWindow(uint8_t window, int8_t id = 0);
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 100
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 101 /**
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 102 * Get datarate to use on the join request
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 103 * @return datarate index
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 104 */
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 105 virtual uint8_t GetJoinDatarate();
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 106
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 107 /**
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 108 * Calculate the next time a join request is possible
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 109 * @param size of join frame
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 110 * @returns LORA_OK
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 111 */
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 112 virtual uint8_t CalculateJoinBackoff(uint8_t size);
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 113
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 114 /**
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 115 * Get next channel and set the SxRadio tx config with current settings
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 116 * @return LORA_OK
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 117 */
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 118 virtual uint8_t SetTxConfig();
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 119
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 120
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 121 /**
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 122 * Set frequency sub band if supported by plan
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 123 * @param sub_band
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 124 * @return LORA_OK
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 125 */
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 126 virtual uint8_t SetFrequencySubBand(uint8_t sub_band);
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 127
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 128 /**
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 129 * Callback for Join Accept packet to load optional channels
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 130 * @return LORA_OK
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 131 */
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 132 virtual uint8_t HandleJoinAccept(const uint8_t* buffer, uint8_t size);
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 133
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 134 /**
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 135 * Callback to for rx parameter setup ServerCommand
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 136 * @param payload packet data
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 137 * @param index of start of command buffer
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 138 * @param size number of bytes in command buffer
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 139 * @param[out] status to be returned in MoteCommand answer
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 140 * @return LORA_OK
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 141 */
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 142 virtual uint8_t HandleRxParamSetup(const uint8_t* payload, uint8_t index, uint8_t size, uint8_t& status);
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 143
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 144 /**
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 145 * Callback to for new channel ServerCommand
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 146 * @param payload packet data
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 147 * @param index of start of command buffer
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 148 * @param size number of bytes in command buffer
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 149 * @param[out] status to be returned in MoteCommand answer
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 150 * @return LORA_OK
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 151 */
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 152 virtual uint8_t HandleNewChannel(const uint8_t* payload, uint8_t index, uint8_t size, uint8_t& status);
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 153
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 154 /**
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 155 * Callback to for ping slot channel request ServerCommand
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 156 * @param payload packet data
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 157 * @param index of start of command buffer
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 158 * @param size number of bytes in command buffer
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 159 * @param[out] status to be returned in MoteCommand answer
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 160 * @return LORA_OK
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 161 */
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 162 virtual uint8_t HandlePingSlotChannelReq(const uint8_t* payload, uint8_t index, uint8_t size, uint8_t& status);
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 163
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 164 /**
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 165 * Callback to for beacon frequency request ServerCommand
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 166 * @param payload packet data
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 167 * @param index of start of command buffer
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 168 * @param size number of bytes in command buffer
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 169 * @param[out] status to be returned in MoteCommand answer
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 170 * @return LORA_OK
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 171 */
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 172 virtual uint8_t HandleBeaconFrequencyReq(const uint8_t* payload, uint8_t index, uint8_t size, uint8_t& status);
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 173
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 174 /**
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 175 * Callback to for adaptive datarate ServerCommand
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 176 * @param payload packet data
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 177 * @param index of start of command buffer
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 178 * @param size number of bytes in command buffer
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 179 * @param[out] status to be returned in MoteCommand answer
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 180 * @return LORA_OK
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 181 */
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 182 virtual uint8_t HandleAdrCommand(const uint8_t* payload, uint8_t index, uint8_t size, uint8_t& status);
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 183
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 184 /**
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 185 * Validate the configuration after multiple ADR commands have been applied
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 186 * @return status to be returned in MoteCommand answer
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 187 */
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 188 virtual uint8_t ValidateAdrConfiguration();
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 189
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 190 /**
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 191 * Update duty cycle with at given frequency and time on air
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 192 * @param freq frequency
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 193 * @param time_on_air_ms tx time on air
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 194 */
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 195 virtual void UpdateDutyCycle(uint32_t freq, uint32_t time_on_air_ms);
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 196
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 197 /**
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 198 * Get the time the radio must be off air to comply with regulations
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 199 * Time to wait may be dependent on duty-cycle restrictions per channel
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 200 * Or duty-cycle of join requests if OTAA is being attempted
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 201 * @return ms of time to wait for next tx opportunity
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 202 */
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 203 virtual uint32_t GetTimeOffAir();
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 204
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 205 /**
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 206 * Get the channels in use by current channel plan
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 207 * @return channel frequencies
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 208 */
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 209 virtual std::vector<uint32_t> GetChannels();
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 210
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 211 /**
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 212 * Get the channel datarate ranges in use by current channel plan
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 213 * @return channel datarate ranges
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 214 */
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 215 virtual std::vector<uint8_t> GetChannelRanges();
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 216
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 217 /**
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 218 * Print log message for given rx window
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 219 * @param wnd 1 or 2
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 220 */
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 221 virtual void LogRxWindow(uint8_t wnd);
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 222
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 223 /**
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 224 * Enable the default channels of the channel plan
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 225 */
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 226 virtual void EnableDefaultChannels();
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 227
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 228 /**
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 229 * Check if this packet is a beacon and if so extract parameters needed
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 230 * @param payload of potential beacon
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 231 * @param size of the packet
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 232 * @param [out] data extracted from the beacon if this packet was indeed a beacon
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 233 * @return true if this packet is beacon, false if not
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 234 */
Jenkins@KEILDM1.dc.multitech.prv 29:fb5769f4a67c 235 virtual uint8_t DecodeBeacon(const uint8_t* payload,
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 236 size_t size,
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 237 BeaconData_t& data);
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 238
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 239 protected:
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 240
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 241 static const uint8_t RU864_TX_POWERS[8]; //!< List of available tx powers
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 242 static const uint8_t RU864_RADIO_POWERS[21]; //!< List of calibrated tx powers
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 243 static const uint8_t RU864_MAX_PAYLOAD_SIZE[]; //!< List of max payload sizes for each datarate
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 244 static const uint8_t RU864_MAX_PAYLOAD_SIZE_REPEATER[]; //!< List of repeater compatible max payload sizes for each datarate
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 245
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 246 typedef struct __attribute__((packed)) {
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 247 uint8_t RFU[2];
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 248 uint8_t Time[4];
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 249 uint8_t CRC1[2];
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 250 uint8_t GwSpecific[7];
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 251 uint8_t CRC2[2];
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 252 } BCNPayload;
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 253 };
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 254 }
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 255
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 256 #endif //__CHANNEL_PLAN_RU864_H__