MultiTech / libmDot-dev-mbed5-deprecated

Dependents:   mDot-IKS01A1 mDot-IKS01A1 mDot-Examples mDot-IKS01A1-Explora ... more

Fork of libmDot-dev-mbed2-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.

Dot Library Version 3 Updates

Dot Library versions 3.x.x require a channel plan to be injected into the stack. Channel plans are included with the 3.x.x Dot Library releases. The following code snippet demonstrates how to create a channel plan and inject it into the stack.

#include "mDot.h"
#include "channel_plans.h"

int main() {
    ChannelPlan* plan = new lora::ChannelPlan_US915();
    assert(plan);
    mDot* dot = mDot::getInstance(plan);
    assert(dot);

    // ...
}

Dot devices must not be deployed with software using a different channel plan than the Dot's default plan! This functionality is for development and testing only!

Multicast Sessions

Multicast sessions and packet rx events in library. When in Class C mode Multicast downlinks can be received. Recieved packets should be filtered on address, counter value will be maintained in the session or can be set explicitly depending on Application support to share Multicast Address, Keys and Counters.

mDot.h

        /**
         * Add a multicast session address and keys
         * Downlink counter is set to 0
         * Up to 3 MULTICAST_SESSIONS can be set
         */
        int32_t setMulticastSession(uint8_t index, uint32_t addr, const uint8_t* nsk, const uint8_t* dsk);
 
        /**
         * Set a multicast session counter
         * Up to 3 MULTICAST_SESSIONS can be set
         */
        int32_t setMulticastDownlinkCounter(uint8_t index, uint32_t count);

mDotEvent.h

The address field was added to PacketRx event.

        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);

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.

Committer:
Mike Fiore
Date:
Thu Aug 04 15:11:24 2016 -0500
Revision:
16:b630e18103e5
update from libmDot-2.0.1-ARMCC.tar.gz

Who changed what in which revision?

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