AT command firmware for MultiTech Dot devices.
Fork of mDot_AT_firmware by
CmdLinkCheckThreshold.cpp
00001 #include "CmdLinkCheckThreshold.h" 00002 00003 CmdLinkCheckThreshold::CmdLinkCheckThreshold() : 00004 #if MTS_CMD_TERM_VERBOSE 00005 Command("Link Check Threshold", "AT+LCT", "Set threshold for number of link check or ACK failures to tolerate, (0: off, N: number of failures)", "(0-255)") 00006 #else 00007 Command("AT+LCT") 00008 #endif 00009 { 00010 _queryable = true; 00011 } 00012 00013 uint32_t CmdLinkCheckThreshold::action(const std::vector<std::string>& args) 00014 { 00015 if (args.size() == 1) 00016 { 00017 CommandTerminal::Serial()->writef("%u\r\n", CommandTerminal::Dot()->getLinkCheckThreshold()); 00018 } 00019 else if (args.size() == 2) 00020 { 00021 int count; 00022 sscanf(args[1].c_str(), "%d", &count); 00023 00024 if (CommandTerminal::Dot()->setLinkCheckThreshold(count) != mDot::MDOT_OK) 00025 { 00026 return 1; 00027 } 00028 } 00029 00030 return 0; 00031 } 00032 00033 bool CmdLinkCheckThreshold::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 count; 00041 sscanf(args[1].c_str(), "%d", &count); 00042 00043 if (count < 0 || count > 255) { 00044 #if MTS_CMD_TERM_VERBOSE 00045 CommandTerminal::setErrorMessage("Invalid count, expects (0-255))"); 00046 #endif 00047 return false; 00048 } 00049 00050 return true; 00051 } 00052 00053 #if MTS_CMD_TERM_VERBOSE 00054 CommandTerminal::setErrorMessage("Invalid arguments"); 00055 #endif 00056 return false; 00057 }
Generated on Wed Dec 6 2023 19:34:05 by 1.7.2