Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: MTS-Serial libmDot-mbed5
Fork of Dot-AT-Firmware by
CmdReceiveOnce.cpp
00001 #include "CmdReceiveOnce.h" 00002 #include "CommandTerminal.h" 00003 00004 CmdReceiveOnce::CmdReceiveOnce() : Command("Receive Once", "AT+RECV", "Receive and display one packet.", "(string:242) or (hex:242)") 00005 00006 { 00007 } 00008 00009 uint32_t CmdReceiveOnce::action(std::vector<std::string> args) 00010 { 00011 std::vector<uint8_t> data; 00012 00013 if (CommandTerminal::Dot()->recv(data) == mDot::MDOT_OK) { 00014 if (!data.empty()) { 00015 if (CommandTerminal::Dot()->getRxOutput() == mDot::HEXADECIMAL) { 00016 for (size_t i = 0; i < data.size(); i++) { 00017 CommandTerminal::Serial()->writef("%02x", data[i]); 00018 } 00019 CommandTerminal::Serial()->writef("\r\n"); 00020 } else { 00021 CommandTerminal::Serial()->writef("%s\r\n", CommandTerminal::formatPacketData(data, CommandTerminal::Dot()->getRxOutput()).c_str()); 00022 } 00023 } 00024 } 00025 00026 return 0; 00027 } 00028 00029 bool CmdReceiveOnce::verify(std::vector<std::string> args) 00030 { 00031 if (args.size() == 1) 00032 return true; 00033 00034 CommandTerminal::setErrorMessage("Invalid arguments"); 00035 return false; 00036 }
Generated on Tue Jul 12 2022 20:40:04 by
