firm newest
Dependencies: MTS-Serial libmDot-dev-mbed5-deprecated
CommandTerminal/CmdNetworkLinkCheck.cpp@0:3c869a8cb8f8, 2018-10-18 (annotated)
- Committer:
- nguyenhoang9x5555
- Date:
- Thu Oct 18 04:18:48 2018 +0000
- Revision:
- 0:3c869a8cb8f8
DOT AT FIRMWARE 18102018
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
nguyenhoang9x5555 | 0:3c869a8cb8f8 | 1 | #include "CmdNetworkLinkCheck.h" |
nguyenhoang9x5555 | 0:3c869a8cb8f8 | 2 | #include "CommandTerminal.h" |
nguyenhoang9x5555 | 0:3c869a8cb8f8 | 3 | |
nguyenhoang9x5555 | 0:3c869a8cb8f8 | 4 | CmdNetworkLinkCheck::CmdNetworkLinkCheck() |
nguyenhoang9x5555 | 0:3c869a8cb8f8 | 5 | : |
nguyenhoang9x5555 | 0:3c869a8cb8f8 | 6 | 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-)") { |
nguyenhoang9x5555 | 0:3c869a8cb8f8 | 7 | |
nguyenhoang9x5555 | 0:3c869a8cb8f8 | 8 | } |
nguyenhoang9x5555 | 0:3c869a8cb8f8 | 9 | |
nguyenhoang9x5555 | 0:3c869a8cb8f8 | 10 | uint32_t CmdNetworkLinkCheck::action(std::vector<std::string> args) { |
nguyenhoang9x5555 | 0:3c869a8cb8f8 | 11 | mDot::link_check lc; |
nguyenhoang9x5555 | 0:3c869a8cb8f8 | 12 | |
nguyenhoang9x5555 | 0:3c869a8cb8f8 | 13 | lc = CommandTerminal::Dot()->networkLinkCheck(); |
nguyenhoang9x5555 | 0:3c869a8cb8f8 | 14 | if (lc.status) { |
nguyenhoang9x5555 | 0:3c869a8cb8f8 | 15 | CommandTerminal::Serial()->writef("%d,%lu\r\n", lc.dBm, lc.gateways); |
nguyenhoang9x5555 | 0:3c869a8cb8f8 | 16 | |
nguyenhoang9x5555 | 0:3c869a8cb8f8 | 17 | if (!lc.payload.empty()) |
nguyenhoang9x5555 | 0:3c869a8cb8f8 | 18 | CommandTerminal::Serial()->writef("%s\r\n", CommandTerminal::formatPacketData(lc.payload, CommandTerminal::Dot()->getRxOutput()).c_str()); |
nguyenhoang9x5555 | 0:3c869a8cb8f8 | 19 | |
nguyenhoang9x5555 | 0:3c869a8cb8f8 | 20 | } else { |
nguyenhoang9x5555 | 0:3c869a8cb8f8 | 21 | CommandTerminal::setErrorMessage(CommandTerminal::Dot()->getLastError()); |
nguyenhoang9x5555 | 0:3c869a8cb8f8 | 22 | return 1; |
nguyenhoang9x5555 | 0:3c869a8cb8f8 | 23 | } |
nguyenhoang9x5555 | 0:3c869a8cb8f8 | 24 | |
nguyenhoang9x5555 | 0:3c869a8cb8f8 | 25 | return 0; |
nguyenhoang9x5555 | 0:3c869a8cb8f8 | 26 | } |
nguyenhoang9x5555 | 0:3c869a8cb8f8 | 27 |