few changes for RTS/CTS control
Dependencies: MTS-Serial libmDot mbed-rtos mbed
Fork of mDot_AT_firmware by
CommandTerminal/CmdPing.cpp@11:77b7911263da, 2016-10-25 (annotated)
- Committer:
- serg838
- Date:
- Tue Oct 25 05:39:39 2016 +0000
- Revision:
- 11:77b7911263da
- Parent:
- 9:ff62b20f7000
RTS/CTS changes
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Mike Fiore |
1:e52ae6584f1c | 1 | #include "CmdPing.h" |
Mike Fiore |
1:e52ae6584f1c | 2 | |
Mike Fiore |
1:e52ae6584f1c | 3 | CmdPing::CmdPing(mDot* dot, mts::MTSSerial& serial) : Command(dot, "Send Ping", "AT+PING", "Sends ping and displays the servers received rssi and snr"), _serial(serial) |
Mike Fiore |
1:e52ae6584f1c | 4 | { |
Mike Fiore |
1:e52ae6584f1c | 5 | _help = std::string(text()) + ": " + std::string(desc()); |
Mike Fiore |
1:e52ae6584f1c | 6 | _usage = "(-140-0),(-20.0-20.0)"; |
Mike Fiore |
1:e52ae6584f1c | 7 | } |
Mike Fiore |
1:e52ae6584f1c | 8 | |
Mike Fiore |
1:e52ae6584f1c | 9 | uint32_t CmdPing::action(std::vector<std::string> args) |
Mike Fiore |
1:e52ae6584f1c | 10 | { |
Mike Fiore |
1:e52ae6584f1c | 11 | mDot::ping_response response; |
Mike Fiore |
1:e52ae6584f1c | 12 | response = _dot->ping(); |
Mike Fiore |
1:e52ae6584f1c | 13 | if (response.status != mDot::MDOT_OK) { |
Mike Fiore |
1:e52ae6584f1c | 14 | std::string error = mDot::getReturnCodeString(response.status); |
Mike Fiore |
1:e52ae6584f1c | 15 | |
Mike Fiore |
1:e52ae6584f1c | 16 | if (response.status != mDot::MDOT_NOT_JOINED) |
Mike Fiore |
1:e52ae6584f1c | 17 | error += + " - " + _dot->getLastError(); |
Mike Fiore |
1:e52ae6584f1c | 18 | |
Mike Fiore |
9:ff62b20f7000 | 19 | setErrorMessage(_dot->getLastError());; |
Mike Fiore |
1:e52ae6584f1c | 20 | return 1; |
Mike Fiore |
1:e52ae6584f1c | 21 | } |
Mike Fiore |
1:e52ae6584f1c | 22 | |
Mike Fiore |
1:e52ae6584f1c | 23 | _serial.writef("%d,%d.%d\r\n", response.rssi, response.snr / 10, abs(response.snr) % 10); |
Mike Fiore |
1:e52ae6584f1c | 24 | |
Mike Fiore |
1:e52ae6584f1c | 25 | return 0; |
Mike Fiore |
1:e52ae6584f1c | 26 | } |
Mike Fiore |
1:e52ae6584f1c | 27 |