AT command firmware for MultiTech Dot devices.
Fork of mDot_AT_firmware by
CmdRxOutput.cpp
00001 #include "CmdRxOutput.h" 00002 00003 CmdRxOutput::CmdRxOutput() : 00004 #if MTS_CMD_TERM_VERBOSE 00005 Command("Rx Output", "AT+RXO", "Set the Rx output type (0:hexadecimal, 1:raw, 2:extended, 3:extended_hex)", "(0-3)") 00006 #else 00007 Command("AT+RXO") 00008 #endif 00009 { 00010 _queryable = true; 00011 } 00012 00013 uint32_t CmdRxOutput::action(const std::vector<std::string>& args) 00014 { 00015 if (args.size() == 1) 00016 { 00017 CommandTerminal::Serial()->writef("%u\r\n", CommandTerminal::Dot()->getRxOutput()); 00018 } 00019 else if (args.size() == 2) 00020 { 00021 uint8_t output = 0xFF; 00022 00023 if(args[1] == "0") output = 0; 00024 else if(args[1] == "1") output = 1; 00025 else if(args[1] == "2") output = 2; 00026 else if(args[1] == "3") output = 3; 00027 00028 if (CommandTerminal::Dot()->setRxOutput(output) != mDot::MDOT_OK) 00029 { 00030 return 1; 00031 } 00032 } 00033 00034 return 0; 00035 } 00036 00037 bool CmdRxOutput::verify(const std::vector<std::string>& args) 00038 { 00039 if (args.size() == 1) 00040 return true; 00041 00042 if (args.size() == 2) 00043 { 00044 if (!(args[1] == "0" || args[1] == "1" || args[1] == "2" || args[1] == "3")) { 00045 #if MTS_CMD_TERM_VERBOSE 00046 CommandTerminal::setErrorMessage("Invalid type, expects (0:hexadecimal, 1:raw, 2:extended, 3:extended_hex)"); 00047 #endif 00048 return false; 00049 } 00050 00051 return true; 00052 } 00053 00054 #if MTS_CMD_TERM_VERBOSE 00055 CommandTerminal::setErrorMessage("Invalid arguments"); 00056 #endif 00057 return false; 00058 }
Generated on Wed Dec 6 2023 19:34:05 by 1.7.2