few changes for RTS/CTS control
Dependencies: MTS-Serial libmDot mbed-rtos mbed
Fork of mDot_AT_firmware by
Diff: CommandTerminal/CmdNetworkJoinMode.cpp
- Revision:
- 9:ff62b20f7000
- Parent:
- 1:e52ae6584f1c
--- a/CommandTerminal/CmdNetworkJoinMode.cpp Mon Apr 04 13:17:44 2016 +0000 +++ b/CommandTerminal/CmdNetworkJoinMode.cpp Mon Apr 04 09:00:31 2016 -0500 @@ -1,11 +1,11 @@ #include "CmdNetworkJoinMode.h" CmdNetworkJoinMode::CmdNetworkJoinMode(mDot* dot, mts::MTSSerial& serial) : - Command(dot, "Network Join Mode", "AT+NJM", "0: Manual configuration, 1: OTA Network Join, 2: Auto OTA Network Join on start up (default: 1)"), + Command(dot, "Network Join Mode", "AT+NJM", "0: Manual configuration, 1: OTA Network Join, 2: Auto OTA Network Join on start up, 3: Peer-to-Peer (default: 1)"), _serial(serial) { _help = std::string(text()) + ": " + std::string(desc()); - _usage = "(0-2)"; + _usage = "(0-3)"; _queryable = true; } @@ -23,12 +23,15 @@ int32_t code; uint8_t mode = (args[1] == "1") ? 1 : 0; mode = (args[1] == "2" ? 2 : mode); + mode = (args[1] == "3" ? 3 : mode); + if ((code = _dot->setJoinMode(mode)) != mDot::MDOT_OK) { - std::string error = mDot::getReturnCodeString(code) + " - " + _dot->getLastError(); - setErrorMessage(error); + + setErrorMessage(_dot->getLastError());; return 1; } + } return 0; @@ -41,9 +44,9 @@ if (args.size() == 2) { - if (!(args[1] == "0" || args[1] == "1" || args[1] == "2")) + if (!(args[1] == "0" || args[1] == "1" || args[1] == "2" || args[1] == "3")) { - setErrorMessage("Invalid parameter, expects (0: Manual, 1: OTA, 2: Auto OTA)"); + setErrorMessage("Invalid parameter, expects (0: Manual, 1: OTA, 2: Auto OTA, 3:Peer-to-Peer)"); return false; }