AT command firmware for MultiTech Dot devices.

Fork of mDot_AT_firmware by MultiTech

Dot Library Not Included!

Because these example programs can be used for both mDot and xDot devices, the LoRa stack is not included. The libmDot library should be imported if building for mDot devices. The libxDot library should be imported if building for xDot devices. Check the commit messages of the Dot library version used to find the correct mbed-os version to use with it. The mbed-os version must match the version used in that version of Dot library or it will likely cause it to fail to compile or have unexpected problems while running.

Dot Library Version 3 Updates

Dot Library versions 3.x.x require a channel plan to be injected into the stack. The Dot-Examples and Dot-AT-Firmware do this by defining a macro called "CHANNEL_PLAN" that controls the channel plan that will be used in the examples. Available channel plans will be in the Dot Library repository in the plans folder.

Revision 20 and earlier of Dot-Examples and revision 15 and earlier of Dot-AT-Firmware should be used with Dot Library versions prior to 3.0.0.

Fota Library

Th Fota Library must be added to compile for mDot 3.1.0 with Fota support. Latest dev libraries and 3.2.0 release will include Fota with libmDot/libxDot.

AT Firmware Description

This AT Firmware is what ships on mDot and xDot devices. It provides an AT command interface for using the mDot or xDot for LoRa communication.

AT command documentation can be found on Multitech.com.

The firmware changelog can be found here. The library changelog can be found here.

Dot Libraries

Dot Library Limitations

The commit messages in libmDot-mbed5 and libmDot-dev-mbed5 specify the version of the Dot library the commit contains and the version of mbed-os it was compiled against. We recommend building your application with the version of mbed-os specified in the commit message of the version of the Dot library you're using. This will ensure that you don't run into any runtime issues caused by differences in the mbed-os versions.

Stable and development libraries are available for both mDot and xDot platforms. The library chosen must match the target platform. Compiling for the mDot platform with the xDot library or vice versa will not succeed.

mDot Library

Development library for mDot.

libmDot-dev

Stable library for mDot.

libmDot

xDot Library

Development library for xDot.

libxDot-dev

Stable library for xDot.

libxDot

Committer:
Jason Reiss
Date:
Fri Sep 11 13:16:33 2020 -0500
Revision:
27:5fafd3b26ac3
Child:
28:c222ca8383f4
Update to Dot 3.3.6

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jason Reiss 27:5fafd3b26ac3 1 #include "CmdMulticastRx.h"
Jason Reiss 27:5fafd3b26ac3 2
Jason Reiss 27:5fafd3b26ac3 3 CmdMulticastRx::CmdMulticastRx()
Jason Reiss 27:5fafd3b26ac3 4 :
Jason Reiss 27:5fafd3b26ac3 5 Command("Muticast Rx Settings", "AT+MCRX",
Jason Reiss 27:5fafd3b26ac3 6 #if defined(TARGET_MTS_MDOT_F411RE)
Jason Reiss 27:5fafd3b26ac3 7 "Multicast Rx Settings",
Jason Reiss 27:5fafd3b26ac3 8 #else
Jason Reiss 27:5fafd3b26ac3 9 "",
Jason Reiss 27:5fafd3b26ac3 10 #endif
Jason Reiss 27:5fafd3b26ac3 11 "(1-8),(DR0-DR15),(FREQ),(-1-7:PERIOD,-1:CLASS_C)")
Jason Reiss 27:5fafd3b26ac3 12
Jason Reiss 27:5fafd3b26ac3 13 {
Jason Reiss 27:5fafd3b26ac3 14 _queryable = true;
Jason Reiss 27:5fafd3b26ac3 15 }
Jason Reiss 27:5fafd3b26ac3 16
Jason Reiss 27:5fafd3b26ac3 17 uint32_t CmdMulticastRx::action(const std::vector<std::string>& args) {
Jason Reiss 27:5fafd3b26ac3 18 if (args.size() == 2) {
Jason Reiss 27:5fafd3b26ac3 19 int index = 0;
Jason Reiss 27:5fafd3b26ac3 20
Jason Reiss 27:5fafd3b26ac3 21 sscanf(args[1].c_str(), "%d", &index);
Jason Reiss 27:5fafd3b26ac3 22
Jason Reiss 27:5fafd3b26ac3 23 index -= 1;
Jason Reiss 27:5fafd3b26ac3 24 CommandTerminal::Serial()->writef("DR%d,%lu,%d\r\n", CommandTerminal::Dot()->getMulticastDatarate(index), CommandTerminal::Dot()->getMulticastFrequency(index), CommandTerminal::Dot()->getMulticastPeriodicity(index));
Jason Reiss 27:5fafd3b26ac3 25 }
Jason Reiss 27:5fafd3b26ac3 26 else if (args.size() == 5) {
Jason Reiss 27:5fafd3b26ac3 27 int index = 0;
Jason Reiss 27:5fafd3b26ac3 28 int datarate = 0;
Jason Reiss 27:5fafd3b26ac3 29 int period = 0;
Jason Reiss 27:5fafd3b26ac3 30
Jason Reiss 27:5fafd3b26ac3 31 sscanf(args[1].c_str(), "%d", &index);
Jason Reiss 27:5fafd3b26ac3 32 sscanf(args[4].c_str(), "%d", &period);
Jason Reiss 27:5fafd3b26ac3 33
Jason Reiss 27:5fafd3b26ac3 34 std::string dr = mts::Text::toUpper(args[2]);
Jason Reiss 27:5fafd3b26ac3 35
Jason Reiss 27:5fafd3b26ac3 36 uint8_t i;
Jason Reiss 27:5fafd3b26ac3 37
Jason Reiss 27:5fafd3b26ac3 38 int res = sscanf(dr.c_str(), "%d", &datarate);
Jason Reiss 27:5fafd3b26ac3 39
Jason Reiss 27:5fafd3b26ac3 40 if (res == 0) {
Jason Reiss 27:5fafd3b26ac3 41 for (i = 0; i < 24; i++) {
Jason Reiss 27:5fafd3b26ac3 42 if (mDot::DataRateStr(i).find(dr) != std::string::npos) {
Jason Reiss 27:5fafd3b26ac3 43 datarate = i;
Jason Reiss 27:5fafd3b26ac3 44 break;
Jason Reiss 27:5fafd3b26ac3 45 }
Jason Reiss 27:5fafd3b26ac3 46 }
Jason Reiss 27:5fafd3b26ac3 47 }
Jason Reiss 27:5fafd3b26ac3 48
Jason Reiss 27:5fafd3b26ac3 49 index -= 1;
Jason Reiss 27:5fafd3b26ac3 50
Jason Reiss 27:5fafd3b26ac3 51 if (CommandTerminal::Dot()->setMulticastDatarate(index, datarate) != mDot::MDOT_OK) {
Jason Reiss 27:5fafd3b26ac3 52 CommandTerminal::setErrorMessage(CommandTerminal::Dot()->getLastError());;
Jason Reiss 27:5fafd3b26ac3 53 return 1;
Jason Reiss 27:5fafd3b26ac3 54 }
Jason Reiss 27:5fafd3b26ac3 55
Jason Reiss 27:5fafd3b26ac3 56 int frequency = ULONG_MAX;
Jason Reiss 27:5fafd3b26ac3 57 sscanf(args[3].c_str(), "%d", &frequency);
Jason Reiss 27:5fafd3b26ac3 58
Jason Reiss 27:5fafd3b26ac3 59 if (CommandTerminal::Dot()->setMulticastFrequency(index, frequency) != mDot::MDOT_OK) {
Jason Reiss 27:5fafd3b26ac3 60 CommandTerminal::setErrorMessage(CommandTerminal::Dot()->getLastError());;
Jason Reiss 27:5fafd3b26ac3 61 return 1;
Jason Reiss 27:5fafd3b26ac3 62 }
Jason Reiss 27:5fafd3b26ac3 63
Jason Reiss 27:5fafd3b26ac3 64 if (CommandTerminal::Dot()->setMulticastPeriodicity(index, period) != mDot::MDOT_OK) {
Jason Reiss 27:5fafd3b26ac3 65 CommandTerminal::setErrorMessage(CommandTerminal::Dot()->getLastError());;
Jason Reiss 27:5fafd3b26ac3 66 return 1;
Jason Reiss 27:5fafd3b26ac3 67 }
Jason Reiss 27:5fafd3b26ac3 68
Jason Reiss 27:5fafd3b26ac3 69 }
Jason Reiss 27:5fafd3b26ac3 70
Jason Reiss 27:5fafd3b26ac3 71 return 0;
Jason Reiss 27:5fafd3b26ac3 72 }
Jason Reiss 27:5fafd3b26ac3 73
Jason Reiss 27:5fafd3b26ac3 74 bool CmdMulticastRx::verify(const std::vector<std::string>& args) {
Jason Reiss 27:5fafd3b26ac3 75 if (args.size() == 2) {
Jason Reiss 27:5fafd3b26ac3 76 int value = 0;
Jason Reiss 27:5fafd3b26ac3 77
Jason Reiss 27:5fafd3b26ac3 78 int res = sscanf(args[1].c_str(), "%d", &value);
Jason Reiss 27:5fafd3b26ac3 79
Jason Reiss 27:5fafd3b26ac3 80 if (res == 0 || value < 1 || value > 8) {
Jason Reiss 27:5fafd3b26ac3 81 CommandTerminal::setErrorMessage("Invalid index, expects (1-8)");;
Jason Reiss 27:5fafd3b26ac3 82 return false;
Jason Reiss 27:5fafd3b26ac3 83 }
Jason Reiss 27:5fafd3b26ac3 84
Jason Reiss 27:5fafd3b26ac3 85 return true;
Jason Reiss 27:5fafd3b26ac3 86 }
Jason Reiss 27:5fafd3b26ac3 87
Jason Reiss 27:5fafd3b26ac3 88 if (args.size() == 5) {
Jason Reiss 27:5fafd3b26ac3 89 int value = 0;
Jason Reiss 27:5fafd3b26ac3 90
Jason Reiss 27:5fafd3b26ac3 91 int res = sscanf(args[1].c_str(), "%d", &value);
Jason Reiss 27:5fafd3b26ac3 92
Jason Reiss 27:5fafd3b26ac3 93 if (res == 0 || value < 1 || value > 8) {
Jason Reiss 27:5fafd3b26ac3 94 CommandTerminal::setErrorMessage("Invalid index, expects (1-8)");;
Jason Reiss 27:5fafd3b26ac3 95 return false;
Jason Reiss 27:5fafd3b26ac3 96 }
Jason Reiss 27:5fafd3b26ac3 97
Jason Reiss 27:5fafd3b26ac3 98 res = sscanf(args[4].c_str(), "%d", &value);
Jason Reiss 27:5fafd3b26ac3 99
Jason Reiss 27:5fafd3b26ac3 100 if (res == 0 || value < -1 || value > 7) {
Jason Reiss 27:5fafd3b26ac3 101 CommandTerminal::setErrorMessage("Invalid period, expects (-1-7,-1:CLASS_C)");
Jason Reiss 27:5fafd3b26ac3 102 return false;
Jason Reiss 27:5fafd3b26ac3 103 }
Jason Reiss 27:5fafd3b26ac3 104
Jason Reiss 27:5fafd3b26ac3 105 int frequency = ULONG_MAX;
Jason Reiss 27:5fafd3b26ac3 106 if (sscanf(args[3].c_str(), "%d", &frequency) != 1) {
Jason Reiss 27:5fafd3b26ac3 107 CommandTerminal::setErrorMessage("Invalid argument");
Jason Reiss 27:5fafd3b26ac3 108 return false;
Jason Reiss 27:5fafd3b26ac3 109 }
Jason Reiss 27:5fafd3b26ac3 110
Jason Reiss 27:5fafd3b26ac3 111 if (frequency != 0 && (frequency < int(CommandTerminal::Dot()->getMinFrequency()) || frequency > int(CommandTerminal::Dot()->getMaxFrequency()))) {
Jason Reiss 27:5fafd3b26ac3 112 char tmp[256];
Jason Reiss 27:5fafd3b26ac3 113 sprintf(tmp, "Invalid frequency, expects (0,%lu-%lu)", CommandTerminal::Dot()->getMinFrequency(), CommandTerminal::Dot()->getMaxFrequency());
Jason Reiss 27:5fafd3b26ac3 114 CommandTerminal::setErrorMessage(tmp);
Jason Reiss 27:5fafd3b26ac3 115 return false;
Jason Reiss 27:5fafd3b26ac3 116 }
Jason Reiss 27:5fafd3b26ac3 117 return true;
Jason Reiss 27:5fafd3b26ac3 118 }
Jason Reiss 27:5fafd3b26ac3 119
Jason Reiss 27:5fafd3b26ac3 120 CommandTerminal::setErrorMessage("Invalid arguments");
Jason Reiss 27:5fafd3b26ac3 121 return false;
Jason Reiss 27:5fafd3b26ac3 122 }