AT command firmware for MultiTech Dot devices.
Fork of mDot_AT_firmware by
CmdSendContinuous.cpp
00001 #include "CmdSendContinuous.h" 00002 #include "CommandTerminal.h" 00003 00004 CmdSendContinuous::CmdSendContinuous() : 00005 #if MTS_CMD_TERM_VERBOSE 00006 Command("Send Continuous", "AT+SENDC", "Send un-modulated data continuously", "[TIMEOUT],[FREQUENCY],[POWER]") 00007 #else 00008 Command("AT+SENDC") 00009 #endif 00010 { 00011 } 00012 00013 uint32_t CmdSendContinuous::action(const std::vector<std::string>& args) { 00014 00015 int timeout = 0; 00016 int frequency = 0; 00017 int power = -1; 00018 00019 if (args.size() > 1) { 00020 sscanf(args[1].c_str(), "%d", &timeout); 00021 } 00022 if (args.size() > 2) { 00023 sscanf(args[2].c_str(), "%d", &frequency); 00024 } 00025 if (args.size() > 3) { 00026 sscanf(args[3].c_str(), "%d", &power); 00027 } 00028 00029 CommandTerminal::Dot()->sendContinuous(true, timeout, frequency, power); 00030 CommandTerminal::Serial()->clearEscaped(); 00031 return 0; 00032 } 00033 00034 bool CmdSendContinuous::verify(const std::vector<std::string>& args) 00035 { 00036 int arg; 00037 00038 if (args.size() == 1) 00039 return true; 00040 00041 // Verify all optional arguments are valid numbers 00042 // No range checking because this command is for test use 00043 for (size_t i = 1; i < args.size(); ++i) { 00044 if (sscanf(args[i].c_str(), "%d", &arg) != 1) { 00045 #if MTS_CMD_TERM_VERBOSE 00046 CommandTerminal::setErrorMessage("Invalid argument"); 00047 #endif 00048 return false; 00049 } 00050 } 00051 00052 return true; 00053 }
Generated on Wed Dec 6 2023 19:34:05 by 1.7.2