![](/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
CommandTerminal/CmdJoinRequest.cpp
- Committer:
- Mike Fiore
- Date:
- 2016-11-04
- Revision:
- 14:f9a77400b622
- Parent:
- 9:ff62b20f7000
File content as of revision 14:f9a77400b622:
#include "CmdJoinRequest.h" #include "CommandTerminal.h" CmdJoinRequest::CmdJoinRequest() : Command("Join Network", "AT+JOIN", "Join network, provide argument of '1' to force join (acquire network address and session keys)", "(force:1)") { } uint32_t CmdJoinRequest::action(std::vector<std::string> args) { std::string buf; if (args.size() > 1 && args[1] == "1") CommandTerminal::Dot()->resetNetworkSession(); if (CommandTerminal::Dot()->getJoinMode() == 0) { CommandTerminal::Serial()->writef("Join not necessary for Manual Join Mode\r\n"); return 0; } else if (CommandTerminal::Dot()->getJoinMode() == 3) { CommandTerminal::Serial()->writef("Join not necessary for Peer-to-Peer\r\n"); return 0; } int32_t code = CommandTerminal::Dot()->joinNetworkOnce(); if (code == mDot::MDOT_OK) { CommandTerminal::Serial()->writef("Successfully joined network\r\n"); return 0; } else { std::string error = mDot::getReturnCodeString(code) + " - " + CommandTerminal::Dot()->getLastError(); CommandTerminal::setErrorMessage(CommandTerminal::Dot()->getLastError()); } return 1; } bool CmdJoinRequest::verify(std::vector<std::string> args) { if (args.size() == 1 || (args.size() == 2 && args[1] == "1")) return true; CommandTerminal::setErrorMessage("Invalid arguments"); return false; }