MicroLabo / Mbed OS mbed-Dot-AT-Firmware

Dependencies:   MTS-Serial libmDot-mbed5

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