with 36errors
Dependencies: MTS-Serial libxDot-dev-mbed5-deprecated
Fork of Dot-AT-Firmware by
CmdJoinRetries.cpp
00001 #include "CmdJoinRetries.h" 00002 00003 CmdJoinRetries::CmdJoinRetries() 00004 : 00005 Command("Join Retries", "AT+JR", "US915/AU915 AUTO_OTA Frequency sub-band search retries (0:disable,1-255:attempts)", "(0-255)") { 00006 _queryable = true; 00007 } 00008 00009 uint32_t CmdJoinRetries::action(std::vector<std::string> args) { 00010 if (args.size() == 1) { 00011 CommandTerminal::Serial()->writef("%u\r\n", CommandTerminal::Dot()->getJoinRetries()); 00012 } else if (args.size() == 2) { 00013 00014 int retries; 00015 sscanf(args[1].c_str(), "%d", &retries); 00016 00017 if (CommandTerminal::Dot()->setJoinRetries(retries) != mDot::MDOT_OK) { 00018 CommandTerminal::setErrorMessage(CommandTerminal::Dot()->getLastError());; 00019 return 1; 00020 } 00021 } 00022 return 0; 00023 } 00024 00025 bool CmdJoinRetries::verify(std::vector<std::string> args) { 00026 if (args.size() == 1) 00027 return true; 00028 00029 if (args.size() == 2) { 00030 00031 int retries; 00032 if (sscanf(args[1].c_str(), "%d", &retries) == 1) { 00033 if (retries < 0 || retries > 255) { 00034 CommandTerminal::setErrorMessage("Invalid retries, expects (0-255)"); 00035 return false; 00036 } 00037 return true; 00038 } 00039 } 00040 00041 CommandTerminal::setErrorMessage("Invalid arguments"); 00042 return false; 00043 } 00044
Generated on Wed Jul 13 2022 06:20:58 by 1.7.2