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.
Dependencies: MTS-Serial libmDot mbed-rtos mbed-src
Fork of mDot_AT_firmware by
CmdJoinRequest.cpp
00001 #include "CmdJoinRequest.h" 00002 #include "CommandTerminal.h" 00003 00004 CmdJoinRequest::CmdJoinRequest(mDot* dot, mts::MTSSerial& serial) 00005 : 00006 Command(dot, "Join Network", "AT+JOIN", "Join network, provide argument of '1' to force join (acquire network address and session keys)"), 00007 _serial(serial) { 00008 _help = std::string(text()) + ": " + std::string(desc()); 00009 _usage = "(force:1)"; 00010 } 00011 00012 uint32_t CmdJoinRequest::action(std::vector<std::string> args) { 00013 int32_t code; 00014 std::string buf; 00015 char ch; 00016 00017 if (args.size() > 1 && args[1] == "1") 00018 _dot->resetNetworkSession(); 00019 00020 code = _dot->joinNetworkOnce(); 00021 00022 if (code == mDot::MDOT_OK) { 00023 _serial.writef("Successfully joined network\r\n"); 00024 return 0; 00025 } else { 00026 std::string error = mDot::getReturnCodeString(code) + " - " + _dot->getLastError(); 00027 setErrorMessage(error); 00028 } 00029 00030 return 1; 00031 } 00032 00033 bool CmdJoinRequest::verify(std::vector<std::string> args) { 00034 if (args.size() == 1 || (args.size() == 2 && args[1] == "1")) 00035 return true; 00036 00037 setErrorMessage("Invalid arguments"); 00038 return false; 00039 }
Generated on Tue Jul 12 2022 21:40:57 by
1.7.2
