mDot AT-Firmware for testing
Dependencies: MTS-Serial libmDot-mbed5
Fork of Dot-AT-Firmware by
Diff: CommandTerminal/CmdRxDelay.cpp
- Revision:
- 14:f9a77400b622
- Parent:
- 9:ff62b20f7000
--- a/CommandTerminal/CmdRxDelay.cpp Fri Nov 04 19:10:24 2016 +0000 +++ b/CommandTerminal/CmdRxDelay.cpp Fri Nov 04 14:25:43 2016 -0500 @@ -7,13 +7,10 @@ #include "CmdRxDelay.h" -CmdRxDelay::CmdRxDelay(mDot* dot, mts::MTSSerial& serial) +CmdRxDelay::CmdRxDelay() : - Command(dot, "Rx Delay", "AT+RXD", "Number of seconds before receive windows are opened (1 - 15)"), - _serial(serial) + Command("Rx Delay", "AT+RXD", "Number of seconds before receive windows are opened (1 - 15)", "(1-15)") { - _help = std::string(text()) + ": " + std::string(desc()); - _usage = "(1-15)"; _queryable = true; } @@ -24,18 +21,15 @@ uint32_t CmdRxDelay::action(std::vector<std::string> args) { if (args.size() == 1) { - if (_dot->getVerbose()) - _serial.writef("Rx Delay: "); - - _serial.writef("%u\r\n", _dot->getRxDelay()); + CommandTerminal::Serial()->writef("%u\r\n", CommandTerminal::Dot()->getRxDelay()); } else if (args.size() == 2) { - int32_t code; + int rxDelay; sscanf(args[1].c_str(), "%d", &rxDelay); - if ((code = _dot->setRxDelay(rxDelay)) != mDot::MDOT_OK) { + if (CommandTerminal::Dot()->setRxDelay(rxDelay) != mDot::MDOT_OK) { - setErrorMessage(_dot->getLastError());; + CommandTerminal::setErrorMessage(CommandTerminal::Dot()->getLastError());; return 1; } } @@ -52,7 +46,7 @@ if (sscanf(args[1].c_str(), "%d", &rxDelay) == 1) { if (rxDelay > 15 || rxDelay < 1) { - setErrorMessage("Invalid rx delay, expects (1-15)"); + CommandTerminal::setErrorMessage("Invalid rx delay, expects (1-15)"); return false; } @@ -60,6 +54,6 @@ } } - setErrorMessage("Invalid arguments"); + CommandTerminal::setErrorMessage("Invalid arguments"); return false; }