![](/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/CmdNetworkLinkCheck.cpp
- Revision:
- 1:e52ae6584f1c
- Child:
- 14:f9a77400b622
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CommandTerminal/CmdNetworkLinkCheck.cpp Thu Jun 25 10:23:41 2015 -0500 @@ -0,0 +1,32 @@ +#include "CmdNetworkLinkCheck.h" +#include "CommandTerminal.h" + +CmdNetworkLinkCheck::CmdNetworkLinkCheck(mDot* dot, mts::MTSSerial& serial) +: + Command(dot, "Network Link Check", "AT+NLC", "Perform network link check, displays dBm above floor, number of gateways in range and optional packet payload if received"), + _serial(serial) { + _help = std::string(text()) + ": " + std::string(desc()); + _usage = "(-20.0-20.0),(1-)"; +} + +uint32_t CmdNetworkLinkCheck::action(std::vector<std::string> args) { + mDot::link_check lc; + + lc = _dot->networkLinkCheck(); + if (lc.status) { + if (_dot->getVerbose()) + _serial.writef("%s:", name()); + + _serial.writef("%d,%lu\r\n", lc.dBm, lc.gateways); + + if (!lc.payload.empty()) + _serial.writef("%s\r\n", CommandTerminal::formatPacketData(lc.payload, _dot->getRxOutput()).c_str()); + + } else { + setErrorMessage(_dot->getLastError()); + return 1; + } + + return 0; +} +