Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mDot_AT_firmware by
CmdJoinNonceValidation.cpp
00001 #include "CmdJoinNonceValidation.h" 00002 00003 CmdJoinNonceValidation::CmdJoinNonceValidation() : 00004 #if MTS_CMD_TERM_VERBOSE 00005 Command("Join Nonce Validation", "AT+JNV", "Enable/disable join nonce validation", "(0,1)") 00006 #else 00007 Command("AT+JNV") 00008 #endif 00009 { 00010 _queryable = true; 00011 } 00012 00013 uint32_t CmdJoinNonceValidation::action(const std::vector<std::string>& args) { 00014 if (args.size() == 1) { 00015 CommandTerminal::Serial()->writef("%u\r\n", CommandTerminal::Dot()->getJoinNonceValidation()); 00016 } else if (args.size() == 2) { 00017 00018 int retries; 00019 sscanf(args[1].c_str(), "%d", &retries); 00020 00021 if (CommandTerminal::Dot()->setJoinNonceValidation(retries) != mDot::MDOT_OK) { 00022 return 1; 00023 } 00024 } 00025 return 0; 00026 } 00027 00028 bool CmdJoinNonceValidation::verify(const std::vector<std::string>& args) { 00029 if (args.size() == 1) 00030 return true; 00031 00032 if (args.size() == 2) { 00033 00034 int retries; 00035 if (sscanf(args[1].c_str(), "%d", &retries) == 1) { 00036 if (retries < 0 || retries > 1) { 00037 #if MTS_CMD_TERM_VERBOSE 00038 CommandTerminal::setErrorMessage("Invalid parameter, expects (0: off, 1: on)"); 00039 #endif 00040 return false; 00041 } 00042 return true; 00043 } 00044 } 00045 00046 #if MTS_CMD_TERM_VERBOSE 00047 CommandTerminal::setErrorMessage("Invalid arguments"); 00048 #endif 00049 return false; 00050 } 00051
Generated on Wed Jan 15 2025 16:10:47 by
1.7.2


