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-mbed5
Fork of Dot-AT-Firmware by
CmdPublicNetwork.cpp
00001 #include "CmdPublicNetwork.h" 00002 00003 CmdPublicNetwork::CmdPublicNetwork() : 00004 Command("Public Network", "AT+PN", "Enable/disable public network mode. (0: off, 1: on)", "(0,1)") 00005 { 00006 _queryable = true; 00007 } 00008 00009 uint32_t CmdPublicNetwork::action(std::vector<std::string> args) 00010 { 00011 if (args.size() == 1) 00012 { 00013 CommandTerminal::Serial()->writef("%d\r\n", CommandTerminal::Dot()->getPublicNetwork()); 00014 } 00015 else if (args.size() == 2) 00016 { 00017 bool enable = (args[1] == "1"); 00018 00019 if (CommandTerminal::Dot()->setPublicNetwork(enable) != mDot::MDOT_OK) { 00020 CommandTerminal::setErrorMessage(CommandTerminal::Dot()->getLastError());; 00021 return 1; 00022 } 00023 } 00024 00025 return 0; 00026 } 00027 00028 bool CmdPublicNetwork::verify(std::vector<std::string> args) 00029 { 00030 if (args.size() == 1) 00031 return true; 00032 00033 if (args.size() == 2) 00034 { 00035 if (args[1] != "1" && args[1] != "0") { 00036 CommandTerminal::setErrorMessage("Invalid parameter, expects (0: off, 1: on)"); 00037 return false; 00038 } 00039 00040 return true; 00041 } 00042 00043 CommandTerminal::setErrorMessage("Invalid arguments"); 00044 return false; 00045 }
Generated on Tue Jul 12 2022 20:40:04 by
