AT command firmware for MultiTech Dot devices.
Fork of mDot_AT_firmware by
CmdFrequencySubBand.cpp
00001 #include "CmdFrequencySubBand.h" 00002 00003 CmdFrequencySubBand::CmdFrequencySubBand() : 00004 #if MTS_CMD_TERM_VERBOSE 00005 Command("Frequency Sub-band", "AT+FSB", "Set the frequency sub-band for US915 and AU915, (0:ALL, 1-8)", "(0-8)") 00006 #else 00007 Command("AT+FSB") 00008 #endif 00009 { 00010 _queryable = true; 00011 } 00012 00013 uint32_t CmdFrequencySubBand::action(const std::vector<std::string>& args) 00014 { 00015 00016 if (args.size() == 1) 00017 { 00018 CommandTerminal::Serial()->writef("%u\r\n", CommandTerminal::Dot()->getFrequencySubBand()); 00019 } 00020 else if (args.size() == 2) 00021 { 00022 uint32_t band; 00023 sscanf(args[1].c_str(), "%" SCNu32, &band); 00024 00025 if (CommandTerminal::Dot()->setFrequencySubBand(band) != mDot::MDOT_OK) { 00026 return 1; 00027 } 00028 } 00029 00030 return 0; 00031 } 00032 00033 bool CmdFrequencySubBand::verify(const std::vector<std::string>& args) 00034 { 00035 if (args.size() == 1) 00036 return true; 00037 00038 if (args.size() == 2) 00039 { 00040 int band; 00041 if (sscanf(args[1].c_str(), "%d", &band) != 1) { 00042 #if MTS_CMD_TERM_VERBOSE 00043 CommandTerminal::setErrorMessage("Invalid arguments"); 00044 #endif 00045 return false; 00046 } 00047 00048 if (band < mDot::FSB_ALL || band > mDot::FSB_8) { 00049 00050 #if MTS_CMD_TERM_VERBOSE 00051 CommandTerminal::setErrorMessage("Invalid channel band, expects (0-8)"); 00052 #endif 00053 return false; 00054 } 00055 00056 return true; 00057 } 00058 00059 #if MTS_CMD_TERM_VERBOSE 00060 CommandTerminal::setErrorMessage("Invalid arguments"); 00061 #endif 00062 return false; 00063 }
Generated on Wed Dec 6 2023 19:34:05 by 1.7.2