AT command firmware for MultiTech Dot devices.
Fork of mDot_AT_firmware by
CmdTimeOnAir.cpp
00001 #include "CmdTimeOnAir.h" 00002 00003 CmdTimeOnAir::CmdTimeOnAir() : 00004 #if MTS_CMD_TERM_VERBOSE 00005 Command("Time on air", "AT+TOA", "Get time in ms of packet tx with current datarate", "(0-242)") 00006 #else 00007 Command("AT+TOA") 00008 #endif 00009 { 00010 _queryable = true; 00011 } 00012 00013 uint32_t CmdTimeOnAir::action(const std::vector<std::string>& args) { 00014 00015 int bytes; 00016 00017 sscanf(args[1].c_str(), "%d", &bytes); 00018 00019 CommandTerminal::Serial()->writef("%lu\r\n", CommandTerminal::Dot()->getTimeOnAir(bytes + 13)); 00020 00021 return 0; 00022 } 00023 00024 bool CmdTimeOnAir::verify(const std::vector<std::string>& args) { 00025 00026 if (args.size() < 2) { 00027 #if MTS_CMD_TERM_VERBOSE 00028 CommandTerminal::setErrorMessage("Invalid parameter, expects (0-242)"); 00029 #endif 00030 return false; 00031 } 00032 00033 int bytes; 00034 00035 sscanf(args[1].c_str(), "%d", &bytes); 00036 00037 if (bytes < 0 || bytes > 242) { 00038 #if MTS_CMD_TERM_VERBOSE 00039 CommandTerminal::setErrorMessage("Invalid parameter, expects (0-242)"); 00040 #endif 00041 return false; 00042 } 00043 00044 return true; 00045 }
Generated on Wed Dec 6 2023 19:34:05 by 1.7.2