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
CmdRxFrequency.cpp
00001 #include "CmdRxFrequency.h" 00002 00003 CmdRxFrequency::CmdRxFrequency() 00004 : 00005 Command("Rx Frequency", "AT+RXF", "Set the Rx frequency for +RECV,+RECVC", "SEE PLAN") 00006 { 00007 _queryable = true; 00008 } 00009 00010 uint32_t CmdRxFrequency::action(std::vector<std::string> args) { 00011 if (args.size() == 1) { 00012 CommandTerminal::Serial()->writef("%lu\r\n", CommandTerminal::Dot()->getRxFrequency()); 00013 } 00014 else if (args.size() == 2) 00015 { 00016 00017 int frequency = 0; 00018 sscanf(args[1].c_str(), "%d", &frequency); 00019 if (CommandTerminal::Dot()->setRxFrequency(frequency) != mDot::MDOT_OK) 00020 { 00021 00022 CommandTerminal::setErrorMessage(CommandTerminal::Dot()->getLastError()); 00023 ; 00024 return 1; 00025 } 00026 } 00027 00028 return 0; 00029 } 00030 00031 bool CmdRxFrequency::verify(std::vector<std::string> args) { 00032 if (args.size() == 1) 00033 return true; 00034 00035 if (args.size() == 2) 00036 { 00037 int frequency; 00038 if (sscanf(args[1].c_str(), "%d", &frequency) != 1) { 00039 CommandTerminal::setErrorMessage("Invalid argument"); 00040 return false; 00041 } 00042 00043 if (frequency != 0 && (frequency < int(CommandTerminal::Dot()->getMinFrequency()) || frequency > int(CommandTerminal::Dot()->getMaxFrequency()))) { 00044 char tmp[256]; 00045 sprintf(tmp, "Invalid frequency, expects (0,%lu-%lu)", CommandTerminal::Dot()->getMinFrequency(), CommandTerminal::Dot()->getMaxFrequency()); 00046 CommandTerminal::setErrorMessage(tmp); 00047 return false; 00048 } 00049 00050 return true; 00051 } 00052 00053 CommandTerminal::setErrorMessage("Invalid arguments"); 00054 return false; 00055 }
Generated on Tue Jul 12 2022 19:03:18 by
1.7.2
