AT command firmware for MultiTech Dot devices.

Fork of mDot_AT_firmware by MultiTech

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers CmdTxWait.cpp Source File

CmdTxWait.cpp

00001 #include "CmdTxWait.h"
00002 
00003 CmdTxWait::CmdTxWait() :
00004 #if MTS_CMD_TERM_VERBOSE
00005     Command("Tx Wait", "AT+TXW", "Enable/disable waiting for rx windows to expire after send. (0: off, 1: on)", "(0,1)")
00006 #else
00007     Command("AT+TXW")
00008 #endif
00009 {
00010     _queryable = true;
00011 }
00012 
00013 uint32_t CmdTxWait::action(const std::vector<std::string>& args)
00014 {
00015     if (args.size() == 1)
00016     {
00017         CommandTerminal::Serial()->writef("%u\r\n", CommandTerminal::Dot()->getTxWait());
00018     }
00019     else if (args.size() == 2)
00020     {
00021         if (CommandTerminal::Dot()->setTxWait(args[1] == "1") != mDot::MDOT_OK)
00022         {
00023             return 1;
00024         }
00025     }
00026 
00027     return 0;
00028 }
00029 
00030 bool CmdTxWait::verify(const std::vector<std::string>& args)
00031 {
00032     if (args.size() == 1)
00033         return true;
00034 
00035     if (args.size() == 2)
00036     {
00037         if (args[1] != "0" && args[1] != "1") {
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 }