![](/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/CmdReceiveOnce.cpp
- Committer:
- pferland
- Date:
- 2018-03-02
- Revision:
- 18:f5d28d621bb0
- Parent:
- 14:f9a77400b622
File content as of revision 18:f5d28d621bb0:
#include "CmdReceiveOnce.h" #include "CommandTerminal.h" CmdReceiveOnce::CmdReceiveOnce() : Command("Receive Once", "AT+RECV", "Receive and display one packet.", "(string:242) or (hex:242)") { } uint32_t CmdReceiveOnce::action(std::vector<std::string> args) { std::vector<uint8_t> data; if (CommandTerminal::Dot()->recv(data) == mDot::MDOT_OK) { if (!data.empty()) { if (CommandTerminal::Dot()->getRxOutput() == mDot::HEXADECIMAL) { for (size_t i = 0; i < data.size(); i++) { CommandTerminal::Serial()->writef("%02x", data[i]); } CommandTerminal::Serial()->writef("\r\n"); } else { CommandTerminal::Serial()->writef("%s\r\n", CommandTerminal::formatPacketData(data, CommandTerminal::Dot()->getRxOutput()).c_str()); } } } return 0; } bool CmdReceiveOnce::verify(std::vector<std::string> args) { if (args.size() == 1) return true; CommandTerminal::setErrorMessage("Invalid arguments"); return false; }