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: MTS-Serial libmDot-mbed5
Fork of Dot-AT-Firmware by
CmdAdaptiveDataRate.cpp
00001 #include "CmdAdaptiveDataRate.h" 00002 00003 00004 CmdAdaptiveDataRate::CmdAdaptiveDataRate() : 00005 Command("Adaptive Data Rate", "AT+ADR", "Enable/disable Adaptive Data Rate (0: off, 1: on)", "(0,1)") 00006 { 00007 _queryable = true; 00008 } 00009 00010 uint32_t CmdAdaptiveDataRate::action(std::vector<std::string> args) 00011 { 00012 if (args.size() == 1) 00013 { 00014 CommandTerminal::Serial()->writef("%d\r\n", CommandTerminal::Dot()->getAdr()); 00015 } 00016 else if (args.size() == 2) 00017 { 00018 bool enable = (args[1] == "1"); 00019 if (CommandTerminal::Dot()->setAdr(enable) != mDot::MDOT_OK) 00020 { 00021 CommandTerminal::setErrorMessage(CommandTerminal::Dot()->getLastError());; 00022 return 1; 00023 } 00024 } 00025 00026 return 0; 00027 } 00028 00029 bool CmdAdaptiveDataRate::verify(std::vector<std::string> args) 00030 { 00031 if (args.size() == 1) 00032 return true; 00033 00034 if (args.size() == 2) 00035 { 00036 if (args[1] != "1" && args[1] != "0") { 00037 CommandTerminal::setErrorMessage("Invalid parameter, expects (0: off, 1: on)"); 00038 return false; 00039 } 00040 00041 return true; 00042 } 00043 00044 CommandTerminal::setErrorMessage("Invalid arguments"); 00045 return false; 00046 }
Generated on Tue Jul 12 2022 20:40:03 by
