firm newest
Dependencies: MTS-Serial libmDot-dev-mbed5-deprecated
Diff: CommandTerminal/CmdNetworkLinkCheck.cpp
- Revision:
- 0:3c869a8cb8f8
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CommandTerminal/CmdNetworkLinkCheck.cpp Thu Oct 18 04:18:48 2018 +0000 @@ -0,0 +1,27 @@ +#include "CmdNetworkLinkCheck.h" +#include "CommandTerminal.h" + +CmdNetworkLinkCheck::CmdNetworkLinkCheck() +: + Command("Network Link Check", "AT+NLC", "Perform network link check, displays dBm above floor, number of gateways in range and optional packet payload if received", "(-20.0-20.0),(1-)") { + +} + +uint32_t CmdNetworkLinkCheck::action(std::vector<std::string> args) { + mDot::link_check lc; + + lc = CommandTerminal::Dot()->networkLinkCheck(); + if (lc.status) { + CommandTerminal::Serial()->writef("%d,%lu\r\n", lc.dBm, lc.gateways); + + if (!lc.payload.empty()) + CommandTerminal::Serial()->writef("%s\r\n", CommandTerminal::formatPacketData(lc.payload, CommandTerminal::Dot()->getRxOutput()).c_str()); + + } else { + CommandTerminal::setErrorMessage(CommandTerminal::Dot()->getLastError()); + return 1; + } + + return 0; +} +