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
CmdFrequencySubBand.cpp
00001 #include "CmdFrequencySubBand.h" 00002 00003 CmdFrequencySubBand::CmdFrequencySubBand() : 00004 Command("Frequency Sub-band", "AT+FSB", "Set the frequency sub-band for US915 and AU915, (0:ALL, 1-8)", "(0-8)") 00005 { 00006 _queryable = true; 00007 } 00008 00009 uint32_t CmdFrequencySubBand::action(std::vector<std::string> args) 00010 { 00011 00012 if (args.size() == 1) 00013 { 00014 CommandTerminal::Serial()->writef("%u\r\n", CommandTerminal::Dot()->getFrequencySubBand()); 00015 } 00016 else if (args.size() == 2) 00017 { 00018 uint32_t band; 00019 sscanf(args[1].c_str(), "%lu", &band); 00020 00021 if (CommandTerminal::Dot()->setFrequencySubBand(band) != mDot::MDOT_OK) { 00022 CommandTerminal::setErrorMessage(CommandTerminal::Dot()->getLastError());; 00023 return 1; 00024 } 00025 } 00026 00027 return 0; 00028 } 00029 00030 bool CmdFrequencySubBand::verify(std::vector<std::string> args) 00031 { 00032 if (args.size() == 1) 00033 return true; 00034 00035 if (args.size() == 2) 00036 { 00037 int band; 00038 if (sscanf(args[1].c_str(), "%d", &band) != 1) { 00039 CommandTerminal::setErrorMessage("Invalid arguments"); 00040 return false; 00041 } 00042 00043 if (band < mDot::FSB_ALL || band > mDot::FSB_8) { 00044 CommandTerminal::setErrorMessage("Invalid channel band, expects (0-8)"); 00045 return false; 00046 } 00047 00048 return true; 00049 } 00050 00051 CommandTerminal::setErrorMessage("Invalid arguments"); 00052 return false; 00053 }
Generated on Tue Jul 12 2022 20:40:03 by
