AT command firmware for MultiTech Dot devices.
Fork of mDot_AT_firmware by
CmdSerialClearOnError.cpp
00001 #include "CmdSerialClearOnError.h" 00002 00003 CmdSerialClearOnError::CmdSerialClearOnError() : 00004 #if MTS_CMD_TERM_VERBOSE 00005 Command("Clear On Error", "AT+SDCE", "Serial clear on error if enabled data that cannot be sent will be discarded", "(0:off,1:on)") 00006 #else 00007 Command("AT+SDCE") 00008 #endif 00009 { 00010 _queryable = true; 00011 } 00012 00013 uint32_t CmdSerialClearOnError::action(const std::vector<std::string>& args) 00014 { 00015 if (args.size() == 1) 00016 { 00017 CommandTerminal::Serial()->writef("%d\r\n", CommandTerminal::Dot()->getSerialClearOnError()); 00018 } 00019 else if (args.size() == 2) 00020 { 00021 bool enable = (args[1] == "1"); 00022 00023 if (CommandTerminal::Dot()->setSerialClearOnError(enable) != mDot::MDOT_OK) { 00024 return 1; 00025 } 00026 } 00027 00028 return 0; 00029 } 00030 00031 bool CmdSerialClearOnError::verify(const std::vector<std::string>& args) 00032 { 00033 if (args.size() == 1) 00034 return true; 00035 00036 if (args.size() == 2) { 00037 if (args[1] != "1" && args[1] != "0") { 00038 #if MTS_CMD_TERM_VERBOSE 00039 CommandTerminal::setErrorMessage("Invalid parameter, expects (0: off, 1: on)"); 00040 #endif 00041 return false; 00042 } 00043 00044 return true; 00045 } 00046 00047 #if MTS_CMD_TERM_VERBOSE 00048 CommandTerminal::setErrorMessage("Invalid arguments"); 00049 #endif 00050 return false; 00051 }
Generated on Wed Dec 6 2023 19:34:05 by 1.7.2