Bleeding edge development version of the mDot library for mbed 5. This version of the library is not guaranteed to be stable or well tested and should not be used in production or deployment scenarios.

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.

README.txt

Committer:
Mike Fiore
Date:
2015-06-24
Revision:
1:9f30fbe9e9c1
Child:
2:6385bf37bfe7

File content as of revision 1:9f30fbe9e9c1:

---------------------------------------
Getting Started with the mDot Library
---------------------------------------

This README should get you started using the mDot library with your MultiTech mDot.

License information can be found in the accompanying LICENSE file.

The mDot header has documentation for all the public functions that will be useful to consumers of
the library.

The following source code provides an example application which configures the mDot, connects to a
MultiTech Conduit gateway with matching configuration, and sends data packets to the gateway.

/**************
  SAMPLE CODE
**************/

#include "mbed.h"
#include "mDot.h"
#include <string>
#include <vector>

// these options must match the settings on your Conduit in
// /var/config/lora/lora-network-server.conf
static std::string config_network_name = "my_lora_network";
static std::string config_network_pass = "my_network_password";
static uint8_t config_frequency_sub_band = 1;

void log_error(mDot* dot, const char* msg, int32_t retval);

int main() {
    int32_t ret;
    mDot* dot;
    std::vector<uint8_t> data;
    std::string data_str = "hello world!";

    // get a mDot handle
    dot = mDot::getInstance();

    // reset to default config so we know what state we're in
    dot->resetConfig();

    // print library version information
    printf("version: %s\r\n", dot->getId().c_str());

    // set up the mDot with our network information
    printf("setting frequency sub band\r\n");
    if ((ret = dot->setFrequencySubBand(config_frequency_sub_band)) != mDot::MDOT_OK) {
        log_error(dot, "failed to set frequency sub band", ret);
    }
    printf("setting network name\r\n");
    if ((ret = dot->setNetworkName(config_network_name)) != mDot::MDOT_OK) {
        log_error(dot, "failed to set network name", ret);
    }
    printf("setting network password\r\n");
    if ((ret = dot->setNetworkPassphrase(config_network_pass)) != mDot::MDOT_OK) {
        log_error(dot, "failed to set network password", ret);
    }

    // attempt to join the network
    printf("joining network\r\n");
    if ((ret = dot->joinNetwork()) != mDot::MDOT_OK) {
        log_error(dot, "failed to join network", ret);
    }

    // format data for sending to the gateway
    for (std::string::iterator it = data_str.begin(); it != data_str.end(); it++)
        data.push_back((uint8_t) *it);

    while (true) {
        // send the data
        // ACKs are enabled by default, so we're expecting to get one back
        if ((ret = dot->send(data)) != mDot::MDOT_OK) {
            log_error(dot, "failed to send", ret);
        } else {
            printf("successfully sent data to gateway\r\n");
        }

        wait(5);
    }

    return 0;
}

void log_error(mDot* dot, const char* msg, int32_t retval) {
    printf("%s - %ld:%s, %s\r\n", msg, retval, mDot::getReturnCodeString(retval).c_str(), dot->getLastError().c_str());
}