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:
Fri Nov 08 09:29:24 2019 -0600
Revision:
20:bc12c888e7dc
Parent:
19:aa5b1fcd05be
Child:
29:fb5769f4a67c
xdot-library revision 3.2.5 and mbed-os revision mbed-os-5.13.4

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1 /** __ ___ ____ _ ______ __ ____ __ ____
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 2 * / |/ /_ __/ / /_(_)__/_ __/__ ____/ / / __/_ _____ / /____ __ _ ___ / _/__ ____
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 3 * / /|_/ / // / / __/ /___// / / -_) __/ _ \ _\ \/ // (_-</ __/ -_) ' \(_-< _/ // _ \/ __/ __
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 4 * /_/ /_/\_,_/_/\__/_/ /_/ \__/\__/_//_/ /___/\_, /___/\__/\__/_/_/_/___/ /___/_//_/\__/ /_/
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 5 * Copyright (C) 2015 by Multi-Tech Systems /___/
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 6 *
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 7 *
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 8 * @author Jason Reiss
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 9 * @date 10-31-2015
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 10 * @brief lora::Mote provides a user level class that abstracts the complexity of the Mac layer
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 11 *
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 12 * @details
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 13 *
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 14 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 15
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 16 #ifndef __LORA_MOTE_H__
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 17 #define __LORA_MOTE_H__
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 18
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 19 #include "mbed.h"
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 20 #include "mbed_events.h"
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 21
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 22 #include "MacEvents.h"
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 23
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 24 #include <vector>
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 25
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 26 class SxRadio;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 27 class SxRadio1272;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 28
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 29 namespace lora {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 30
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 31 class Mac;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 32 class ChannelPlan;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 33
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 34 class MoteEvents: public MacEvents {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 35
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 36 /**
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 37 * Fired at start of TX
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 38 */
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 39 virtual void TxStart(void);
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 40
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 41 /**
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 42 * Fired at end of TX
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 43 * @param dr datarate used for TX
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 44 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 45 virtual void TxDone(uint8_t dr);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 46
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 47 /**
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 48 * Fired if TX timed out
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 49 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 50 virtual void TxTimeout(void);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 51
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 52 /**
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 53 * Fired when JoinAccept message is received and MIC is validated
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 54 * @param payload received bytes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 55 * @param size number of received bytes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 56 * @param rssi of received packet
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 57 * @param snr of received packet
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 58 */
Jenkins@KEILDM1.dc.multitech.prv 20:bc12c888e7dc 59 virtual void JoinAccept(uint8_t *payload, uint16_t size, int16_t rssi, int16_t snr);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 60
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 61 /**
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 62 * Fired when JoinAccept message is received and MIC is not valid
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 63 * @param payload received bytes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 64 * @param size number of received bytes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 65 * @param rssi of received packet
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 66 * @param snr of received packet
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 67 */
Jenkins@KEILDM1.dc.multitech.prv 20:bc12c888e7dc 68 virtual void JoinFailed(uint8_t *payload, uint16_t size, int16_t rssi, int16_t snr);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 69
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 70 /**
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 71 * Fired when packet is received and MIC is valid
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 72 * @param port of packet
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 73 * @param payload received bytes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 74 * @param size number of received bytes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 75 * @param rssi of received packet
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 76 * @param snr of received packet
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 77 * @param ctrl Downlink control field of packet
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 78 * @param slot rx window packet was received
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 79 * @param retries number of attempts before ack was received
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 80 * @param address of the end device
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 81 * @param dupRx set if this packet has already been received
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 82 */
Jenkins@KEILDM1.dc.multitech.prv 20:bc12c888e7dc 83 virtual void PacketRx(uint8_t port, uint8_t *payload, uint16_t size, int16_t rssi, int16_t snr, lora::DownlinkControl ctrl, uint8_t slot, uint8_t retries = 0, uint32_t address = 0, bool dupRx=false);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 84
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 85 /**
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 86 * Fired when radio has received a packet, packet is not validated
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 87 * @param payload received bytes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 88 * @param size number of received bytes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 89 * @param rssi of received packet
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 90 * @param snr of received packet
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 91 * @param ctrl Downlink control field of packet
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 92 * @param slot rx window packet was received
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 93 */
Jenkins@KEILDM1.dc.multitech.prv 20:bc12c888e7dc 94 virtual void RxDone(uint8_t *payload, uint16_t size, int16_t rssi, int16_t snr, lora::DownlinkControl ctrl, uint8_t slot);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 95
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 96 /**
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 97 * Fired when a beacon is received
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 98 * @param beacon_data parsed from the beacon payload
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 99 * @param rssi of received beacon
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 100 * @param snr of received beacon
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 101 */
Jenkins@KEILDM1.dc.multitech.prv 20:bc12c888e7dc 102 virtual void BeaconRx(const BeaconData_t& beacon_data, int16_t rssi, int16_t snr);
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 103
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 104 /**
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 105 * Fired upon losing beacon synchronization (120 minutes elapsed from last beacon reception)
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 106 */
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 107 virtual void BeaconLost();
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 108
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 109 /**
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 110 * Fired if rx window times out
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 111 * @param slot rx window that timed out
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 112 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 113 virtual void RxTimeout(uint8_t slot);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 114
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 115 /**
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 116 * Fired if rx CRC error
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 117 * @param slot rx window that errored
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 118 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 119 virtual void RxError(uint8_t slot);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 120
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 121 /**
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 122 * Fired if pong packet is received
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 123 * @param m_rssi of received packet at mote
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 124 * @param m_snr of received packet at mote
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 125 * @param s_rssi of received packet at server
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 126 * @param s_snr of received packet at server
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 127 */
Jenkins@KEILDM1.dc.multitech.prv 20:bc12c888e7dc 128 virtual void Pong(int16_t m_rssi, int16_t m_snr, int16_t s_rssi, int16_t s_snr);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 129
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 130 /**
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 131 * Fired if network link check answer is received
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 132 * @param m_rssi of received packet at mote
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 133 * @param m_snr of received packet at mote
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 134 * @param s_snr margin of received packet at server
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 135 * @param s_gateways number of gateways reporting the packet
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 136 */
Jenkins@KEILDM1.dc.multitech.prv 20:bc12c888e7dc 137 virtual void NetworkLinkCheck(int16_t m_rssi, int16_t m_snr, int16_t s_snr, uint8_t s_gateways);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 138
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 139 /**
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 140 * Fired upon receiving a server time answer
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 141 * @param seconds from the GPS epoch
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 142 * @param sub_seconds from the GPS epoch
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 143 */
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 144 virtual void ServerTime(uint32_t seconds, uint8_t sub_seconds);
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 145
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 146 /**
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 147 * Callback to for device to measure the battery level and report to server
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 148 * @return battery level 0-255, 0 - external power, 1-254 level min-max, 255 device unable to measure battery
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 149 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 150 virtual uint8_t MeasureBattery();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 151
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 152 /**
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 153 * Fired when ack attempts are exhausted and RxTimeout or RxError occur
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 154 * @param retries number of attempts to resend the packet
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 155 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 156 virtual void MissedAck(uint8_t retries);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 157 };
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 158
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 159 class Mote {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 160 public:
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 161 Mote(Settings* settings, ChannelPlan* plan);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 162 virtual ~Mote();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 163
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 164 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 165 * MTS LoRa version
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 166 * @return string containing version information
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 167 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 168 const char* getId();
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 169
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 170 /**
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 171 * Indicator for network session join status
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 172 * @return true if joined to network
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 173 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 174 bool Joined();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 175
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 176 /**
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 177 * Send join request
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 178 * @return LORA_OK if request was sent
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 179 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 180 uint8_t Join();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 181
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 182 /**
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 183 * Send a packet
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 184 * @param port to send packet
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 185 * @param payload of packet
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 186 * @param size in bytes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 187 * @return LORA_OK if successful
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 188 * @return LORA_MAX_PAYLOAD_EXCEEDED if payload size exceeds datarate maximum
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 189 * @return LORA_NO_CHANS_ENABLED if there is not an available channel that supports the current datarate
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 190 * @return LORA_LINK_BUSY if link was busy
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 191 * @return LORA_RADIO_BUSY if radio was busy
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 192 * @return LORA_BUFFER_FULL if mac commands filled the packet, client should resend the packet
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 193 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 194 uint8_t Send(uint8_t port, const uint8_t* payload, uint8_t size);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 195
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 196 /**
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 197 * Configure the channel plan
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 198 * @param plan pointer to ChannelPlan object
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 199 * @return LORA_OK
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 200 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 201 uint8_t SetChannelPlan(ChannelPlan* plan);
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 202
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 203
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 204 Settings* GetSettings();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 205
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 206 /**
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 207 * Get the channel mask of currently enabled channels
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 208 * @return vector containing channel bit masks
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 209 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 210 std::vector<uint16_t> GetChannelMask();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 211
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 212 /**
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 213 * Set a 16 bit channel mask with index
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 214 * @param index of mask to set 0:0-15, 1:16-31 ...
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 215 * @param mask 16 bit mask of enabled channels
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 216 * @return true
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 217 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 218 virtual uint8_t SetChannelMask(uint8_t index, uint16_t mask);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 219
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 220 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 221 * Set the current frequency sub band for hybrid operation 1-8 else 0 for 64 channel operation
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 222 * @param sub_band 0-8
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 223 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 224 uint8_t SetFrequencySubBand(uint8_t sub_band);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 225
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 226 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 227 * Get the current frequency sub band
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 228 * @return sub band 0-8
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 229 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 230 uint8_t GetFrequencySubBand();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 231
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 232 /**
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 233 * Add a channel to the channel plan
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 234 * EU868, AS923 and KR920 allows additional channels to be added
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 235 * Channels 0-2 are fixed default channels
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 236 *
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 237 * @param index of the channel
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 238 * @param frequency of the channel or 0 to remove channel
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 239 * @param range of datarates allowed by the channel
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 240 * @return LORA_OK if channel was added
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 241 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 242 uint8_t AddChannel(uint8_t index, uint32_t frequency, lora::DatarateRange range);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 243
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 244 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 245 * Add a downlink channel to the channel plan
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 246 * EU868, AS923 and KR920 allows downlink channels to be added
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 247 *
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 248 * @param index of the channel
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 249 * @param frequency of the channel or 0 to remove channel
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 250 * @return LORA_OK if channel was added
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 251 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 252 uint8_t AddDownlinkChannel(uint8_t index, uint32_t frequency);
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 253
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 254 /**
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 255 * Set network mode
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 256 * Choose Public LoRaWAN mode or Private Multitech mode
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 257 *
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 258 * Public mode uses 0x34 sync word with 5/6 second join windows
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 259 * Private mode uses 0x12 sync word with 1/2 second join windows
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 260 * US915/AU915 Rx1 and Rx2 are fixed per frequency sub band setting
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 261 *
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 262 * @param mode public or private
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 263 * @return LORA_OK
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 264 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 265 uint8_t SetNetworkMode(uint8_t mode);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 266
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 267 /**
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 268 * Get a pointer to the mac layer
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 269 * @return Mac mac
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 270 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 271 Mac* GetMac();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 272
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 273 /**
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 274 * Get a pointer to the radio
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 275 * Can be used to read radio registers or get a random value based on RSSI
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 276 *
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 277 * @return SxRadio pointer
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 278 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 279 SxRadio* GetRadio();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 280
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 281 /**
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 282 * Get the current statistics for the device
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 283 * @return Statistics
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 284 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 285 Statistics& GetStats();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 286
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 287 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 288 * Reset the current statistics for the device
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 289 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 290 void ResetStats();
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 291
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 292 /**
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 293 * Get time on air with current settings for provided payload bytes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 294 * 13 overhead bytes will be added to payload
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 295 * @param bytes of payload data
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 296 * @return time-on-air in ms
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 297 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 298 uint32_t GetTimeOnAir(uint8_t bytes);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 299
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 300 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 301 * Get time off air required to adhere to duty-cycle limitations
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 302 * @return time-off-air in ms
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 303 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 304 uint32_t GetTimeOffAir();
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 305
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 306 /**
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 307 * Call before setting device in sleep mode to place radio in sleep
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 308 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 309 void Sleep();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 310
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 311 protected:
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 312 SxRadio1272* _radio;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 313 Settings* _settings;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 314 Mac* _mac;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 315
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 316 private:
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 317 ChannelPlan* _plan;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 318 MoteEvents _events;
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 319
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 320 // Event queue objects for timing events
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 321 EventQueue _evtQueue;
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 322 Thread _dispatch_thread;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 323 };
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 324
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 325 }
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 326 #endif