with 36errors
Dependencies: MTS-Serial libxDot-dev-mbed5-deprecated
Fork of Dot-AT-Firmware by
Diff: CommandTerminal/CmdWakeMode.cpp
- Revision:
- 9:ff62b20f7000
- Parent:
- 4:666017851052
- Child:
- 14:f9a77400b622
--- a/CommandTerminal/CmdWakeMode.cpp Mon Apr 04 13:17:44 2016 +0000 +++ b/CommandTerminal/CmdWakeMode.cpp Mon Apr 04 09:00:31 2016 -0500 @@ -1,11 +1,11 @@ #include "CmdWakeMode.h" CmdWakeMode::CmdWakeMode(mDot* dot, mts::MTSSerial& serial) : - Command(dot, "Wake Mode", "AT+WM", "Wakeup mode, INTERRUPT uses DIO7 as wake-up pin (0:INTERVAL,1:INTERRUPT)"), + Command(dot, "Wake Mode", "AT+WM", "Wakeup mode, INTERRUPT uses DIO7 as wake-up pin (0:INTERVAL,1:INTERRUPT,2:INTERVAL_OR_INTERRUPT)"), _serial(serial) { _help = std::string(text()) + ": " + std::string(desc()); - _usage = "(0:INTERVAL,1:INTERRUPT)"; + _usage = "(0:INTERVAL,1:INTERRUPT,2:INTERVAL_OR_INTERRUPT)"; _queryable = true; } @@ -21,12 +21,12 @@ else if (args.size() == 2) { int32_t code; - uint32_t mode; - sscanf(args[1].c_str(), "%lu", &mode); + int mode; + sscanf(args[1].c_str(), "%d", &mode); if ((code = _dot->setWakeMode(mode)) != mDot::MDOT_OK) { - std::string error = mDot::getReturnCodeString(code) + " - " + _dot->getLastError(); - setErrorMessage(error); + + setErrorMessage(_dot->getLastError());; return 1; } } @@ -40,14 +40,14 @@ return true; if (args.size() == 2) { - uint32_t mode; - if (sscanf(args[1].c_str(), "%lu", &mode) != 1) { + int mode; + if (sscanf(args[1].c_str(), "%d", &mode) != 1) { setErrorMessage("Invalid argument"); return false; } - if (mode != 0 && mode != 1) { - setErrorMessage("Invalid interval, expects (0:INTERVAL,1:INTERRUPT)"); + if (mode != 0 && mode != 1 && mode != 2) { + setErrorMessage("Invalid mode, expects (0:INTERVAL,1:INTERRUPT,2:INTERVAL_OR_INTERRUPT)"); return false; }