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:
2:4569491293d7
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 2:4569491293d7 1 #ifndef MTSTEXT_H
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 2 #define MTSTEXT_H
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 3
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 4 #include <string>
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 5 #include <vector>
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 6 #include <stddef.h>
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 7 #include <stdint.h>
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 8 #include <stdio.h>
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 9 #include <string.h>
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 10
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 11 namespace mts
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 12 {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 13
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 14 /** This class contains a number of static methods for manipulating strings and other
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 15 * text data.
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 16 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 17 class Text
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 18 {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 19 public:
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 20 /** This static method can be used to pull out a string at the next line break. A
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 21 * break can either be a newline '\n', carriage return '\r' or both.
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 22 *
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 23 * @param source the source string to look for the line break on.
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 24 * @param start the start postion within the string to begin looking for the line
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 25 * break.
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 26 * @param cursor this value will be updated with the index for the next available character
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 27 * after the line break. If a line break is not found returns -1.
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 28 * @returns the string beginning with the start index up to including the line breaks.
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 29 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 30 static std::string getLine(const std::string& source, const size_t& start, size_t& cursor);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 31
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 32 /** This is a static method for splitting strings using a delimeter value.
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 33 *
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 34 * @param str the string to try and split.
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 35 * @param delimiter the delimeter value to split on as a character.
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 36 * @param limit the maximum number of splits. If equal to 0 it splits as amny times as possible.
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 37 * The default is 0.
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 38 * @returns an ordered vector of strings conatining the splits of the original string.
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 39 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 40 static std::vector<std::string> split(const std::string& str, char delimiter, int limit = 0);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 41
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 42 /** This is a static method for splitting strings using a delimeter value.
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 43 *
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 44 * @param str the string to try and split.
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 45 * @param delimiter the delimeter value to split on as a string.
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 46 * @param limit the maximum number of splits. If equal to 0 it splits as amny times as possible.
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 47 * The default is 0.
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 48 * @returns an ordered vector of strings conatining the splits of the original string.
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 49 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 50 static std::vector<std::string> split(const std::string& str, const std::string& delimiter, int limit = 0);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 51
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 52 static std::string readString(char* index, int length);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 53
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 54 static std::string toUpper(const std::string str);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 55
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 56 static std::string float2String(double val, int precision);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 57
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 58 static std::string bin2hexString(const std::vector<uint8_t>& data, const char* delim = "", bool leadingZeros = false, bool bytePadding = true);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 59
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 60 static std::string bin2hexString(const uint8_t* data, const uint32_t len, const char* delim = "", bool leadingZeros = false, bool bytePadding = true);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 61
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 62 static std::string bin2base64(const std::vector<uint8_t>& data);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 63
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 64 static std::string bin2base64(const uint8_t* data, size_t size);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 65
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 66 static bool base642bin(const std::string in, std::vector<uint8_t>& out);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 67
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 68 static void ltrim(std::string& str, const char* args);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 69
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 70 static void rtrim(std::string& str, const char* args);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 71
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 72 static void trim(std::string& str, const char* args);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 73
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 74 private:
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 75 // Safety for class with only static methods
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 76 Text();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 77 Text(const Text& other);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 78 Text& operator=(const Text& other);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 79 };
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 80
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 81 }
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 82
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 83 #endif