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 Command("Rx Frequency", "AT+RXF", "Set the Rx frequency for +RECV,+RECVC", "US:(0,902000000-928000000) EU:(0,863000000-870000000)") 00005 { 00006 _queryable = true; 00007 } 00008 00009 uint32_t CmdRxFrequency::action(std::vector<std::string> args) 00010 { 00011 if (args.size() == 1) 00012 { 00013 CommandTerminal::Serial()->writef("%lu\r\n", CommandTerminal::Dot()->getRxFrequency()); 00014 } 00015 else if (args.size() == 2) 00016 { 00017 00018 int frequency = 0; 00019 sscanf(args[1].c_str(), "%d", &frequency); 00020 if (CommandTerminal::Dot()->setRxFrequency(frequency) != mDot::MDOT_OK) 00021 { 00022 00023 CommandTerminal::setErrorMessage(CommandTerminal::Dot()->getLastError());; 00024 return 1; 00025 } 00026 } 00027 00028 return 0; 00029 } 00030 00031 bool CmdRxFrequency::verify(std::vector<std::string> args) 00032 { 00033 if (args.size() == 1) 00034 return true; 00035 00036 if (args.size() == 2) 00037 { 00038 int frequency; 00039 if (sscanf(args[1].c_str(), "%d", &frequency) != 1) { 00040 CommandTerminal::setErrorMessage("Invalid argument"); 00041 return false; 00042 } 00043 00044 00045 if (frequency != 0 && (frequency < int(CommandTerminal::Dot()->getMinFrequency()) || frequency > int(CommandTerminal::Dot()->getMaxFrequency()))) { 00046 if (CommandTerminal::Dot()->getFrequencyBand() == mDot::FB_EU868) 00047 CommandTerminal::setErrorMessage("Invalid frequency, expects (0,863000000-870000000)"); 00048 else if (CommandTerminal::Dot()->getFrequencyBand() == mDot::FB_AU915) 00049 CommandTerminal::setErrorMessage("Invalid frequency, expects (0,915000000-928000000)"); 00050 else 00051 CommandTerminal::setErrorMessage("Invalid frequency, expects (0,902000000-928000000)"); 00052 00053 return false; 00054 } 00055 00056 return true; 00057 } 00058 00059 CommandTerminal::setErrorMessage("Invalid arguments"); 00060 return false; 00061 }
Generated on Tue Jul 12 2022 20:40:04 by
