![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
AT terminal for the mDot using the USB debug port instead of the serial port.
Dependencies: MTS-Serial libmDot-mbed5
Fork of Dot-AT-Firmware by
Diff: CommandTerminal/CmdWakeInterval.cpp
- Revision:
- 14:f9a77400b622
- Parent:
- 9:ff62b20f7000
--- a/CommandTerminal/CmdWakeInterval.cpp Fri Nov 04 19:10:24 2016 +0000 +++ b/CommandTerminal/CmdWakeInterval.cpp Fri Nov 04 14:25:43 2016 -0500 @@ -1,11 +1,7 @@ #include "CmdWakeInterval.h" -CmdWakeInterval::CmdWakeInterval(mDot* dot, mts::MTSSerial& serial) : - Command(dot, "Wake Interval", "AT+WI", "Wakeup interval (seconds)"), - _serial(serial) -{ - _help = std::string(text()) + ": " + std::string(desc()); - _usage = "(2-2147483647) s"; +CmdWakeInterval::CmdWakeInterval() : + Command("Wake Interval", "AT+WI", "Wakeup interval (seconds)", "(2-2147483646) s") { _queryable = true; } @@ -13,19 +9,15 @@ { if (args.size() == 1) { - if (_dot->getVerbose()) - _serial.writef("%s: ", name()); - - _serial.writef("%lu\r\n", _dot->getWakeInterval()); + CommandTerminal::Serial()->writef("%lu\r\n", CommandTerminal::Dot()->getWakeInterval()); } else if (args.size() == 2) { - int32_t code; int timeout; sscanf(args[1].c_str(), "%d", &timeout); - if ((code = _dot->setWakeInterval(timeout)) != mDot::MDOT_OK) { - setErrorMessage(_dot->getLastError());; + if (CommandTerminal::Dot()->setWakeInterval(timeout) != mDot::MDOT_OK) { + CommandTerminal::setErrorMessage(CommandTerminal::Dot()->getLastError());; return 1; } } @@ -41,18 +33,18 @@ if (args.size() == 2) { int timeout; if (sscanf(args[1].c_str(), "%d", &timeout) != 1) { - setErrorMessage("Invalid argument"); + CommandTerminal::setErrorMessage("Invalid argument"); return false; } - if (timeout < 2 || timeout > INT_MAX) { - setErrorMessage("Invalid interval, expects (2-2147483647) s"); + if (timeout < 2 || timeout > INT_MAX-1) { + CommandTerminal::setErrorMessage("Invalid interval, expects (2-2147483646) s"); return false; } return true; } - setErrorMessage("Invalid arguments"); + CommandTerminal::setErrorMessage("Invalid arguments"); return false; }