Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: MTS-Serial libxDot-dev-mbed5-deprecated
Fork of Dot-AT-Firmware by
Diff: CommandTerminal/CmdWakeTimeout.cpp
- Revision:
- 14:f9a77400b622
- Parent:
- 9:ff62b20f7000
--- a/CommandTerminal/CmdWakeTimeout.cpp Fri Nov 04 19:10:24 2016 +0000
+++ b/CommandTerminal/CmdWakeTimeout.cpp Fri Nov 04 14:25:43 2016 -0500
@@ -1,10 +1,8 @@
#include "CmdWakeTimeout.h"
-CmdWakeTimeout::CmdWakeTimeout(mDot* dot, mts::MTSSerial& serial) :
- Command(dot, "Wake Timeout", "AT+WTO", "Read serial data until timeout (milliseconds)"), _serial(serial)
+CmdWakeTimeout::CmdWakeTimeout() :
+ Command("Wake Timeout", "AT+WTO", "Read serial data until timeout (milliseconds)", "(0-65000) ms")
{
- _help = std::string(text()) + ": " + std::string(desc());
- _usage = "(0-65000) ms";
_queryable = true;
}
@@ -12,20 +10,16 @@
{
if (args.size() == 1)
{
- if (_dot->getVerbose())
- _serial.writef("%s: ", name());
-
- _serial.writef("%lu\r\n", _dot->getWakeTimeout());
+ CommandTerminal::Serial()->writef("%lu\r\n", CommandTerminal::Dot()->getWakeTimeout());
}
else if (args.size() == 2)
{
- int32_t code;
int timeout;
sscanf(args[1].c_str(), "%d", &timeout);
- if ((code = _dot->setWakeTimeout(timeout)) != mDot::MDOT_OK) {
+ if (CommandTerminal::Dot()->setWakeTimeout(timeout) != mDot::MDOT_OK) {
- setErrorMessage(_dot->getLastError());;
+ CommandTerminal::setErrorMessage(CommandTerminal::Dot()->getLastError());;
return 1;
}
}
@@ -42,18 +36,18 @@
{
int timeout;
if (sscanf(args[1].c_str(), "%d", &timeout) != 1) {
- setErrorMessage("Invalid argument");
+ CommandTerminal::setErrorMessage("Invalid argument");
return false;
}
if (timeout < 0 || timeout > 65000) {
- setErrorMessage("Invalid timeout, expects (0-65000) ms");
+ CommandTerminal::setErrorMessage("Invalid timeout, expects (0-65000) ms");
return false;
}
return true;
}
- setErrorMessage("Invalid arguments");
+ CommandTerminal::setErrorMessage("Invalid arguments");
return false;
}
