AT command firmware for MultiTech Dot devices.
Fork of mDot_AT_firmware by
CmdPreserveSession.cpp
00001 /* 00002 * CmdPreserveSession.cpp 00003 * 00004 * Created on: Nov 4, 2015 00005 * Author: jreiss 00006 */ 00007 00008 #include "CmdPreserveSession.h" 00009 00010 CmdPreserveSession::CmdPreserveSession() : 00011 #if MTS_CMD_TERM_VERBOSE 00012 Command("Preserve Session", "AT+PS", "Save network session info through reset or power down in AUTO_OTA mode (0:off, 1:on)", "(0,1)") 00013 #else 00014 Command("AT+PS") 00015 #endif 00016 { 00017 _queryable = true; 00018 } 00019 00020 CmdPreserveSession::~CmdPreserveSession() 00021 { 00022 // TODO Auto-generated destructor stub 00023 } 00024 00025 uint32_t CmdPreserveSession::action(const std::vector<std::string>& args) { 00026 00027 if (args.size() == 1) { 00028 CommandTerminal::Serial()->writef("%u\r\n", CommandTerminal::Dot()->getPreserveSession()); 00029 } else { 00030 CommandTerminal::Dot()->setPreserveSession(args[1] == "1"); 00031 } 00032 00033 return mDot::MDOT_OK; 00034 } 00035 00036 bool CmdPreserveSession::verify(const std::vector<std::string>& args) { 00037 if (args.size() == 1) 00038 return true; 00039 00040 if (args.size() == 2) { 00041 00042 if (args[1] != "1" && args[1] != "0") { 00043 #if MTS_CMD_TERM_VERBOSE 00044 CommandTerminal::setErrorMessage("Invalid parameter, expects (0: off, 1: on)"); 00045 #endif 00046 return false; 00047 } 00048 00049 return true; 00050 } 00051 00052 #if MTS_CMD_TERM_VERBOSE 00053 CommandTerminal::setErrorMessage("Invalid arguments"); 00054 #endif 00055 return false; 00056 }
Generated on Wed Dec 6 2023 19:34:05 by 1.7.2