Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: libmDot-Custom MTS-Serial
Fork of mDot_AT_firmware_CUSTOM by
To change channel plans replace AS923 with AU915, EU868, KR920 or US915 on line 15
#define CHANNEL_PLAN CP_AS923
CommandTerminal/CmdJoinRx2Datarate.cpp
- Committer:
- jreiss
- Date:
- 2017-03-23
- Revision:
- 29:15b59b827ac7
- Parent:
- 15:36db31c18231
File content as of revision 29:15b59b827ac7:
#include "CmdJoinRx2Datarate.h" #include "CommandTerminal.h" CmdJoinRx2Datarate::CmdJoinRx2Datarate() : Command("Join Rx2 Datarate", "AT+JR2D", "Join Rx2 datarate", "(US:DR8-DR13,AU:DR8-DR13,EU:DR0-DR7)") { } uint32_t CmdJoinRx2Datarate::action(std::vector<std::string> args) { if (args.size() == 1) { CommandTerminal::Serial()->writef("%s\r\n", mDot::DataRateStr(CommandTerminal::Dot()->getJoinRx2DataRate()).c_str()); } else if (args.size() == 2) { std::string dr = mts::Text::toUpper(args[1]); int datarate = 0; uint8_t i; int res = sscanf(dr.c_str(), "%d", &datarate); if (res == 0) { for (i = 0; i < 16; i++) { if (mDot::DataRateStr(i).find(dr) != std::string::npos) { datarate = i; break; } } } if (CommandTerminal::Dot()->setJoinRx2DataRate(datarate) != mDot::MDOT_OK) { CommandTerminal::setErrorMessage(CommandTerminal::Dot()->getLastError()); return 1; } } return 0; } bool CmdJoinRx2Datarate::verify(std::vector<std::string> args) { if (args.size() == 1) return true; if (args.size() == 2) { return true; } CommandTerminal::setErrorMessage("Invalid arguments"); return false; }