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 mbed-rtos mbed-src
Fork of mDot_AT_firmware by
CmdReceiveOnce.cpp
00001 #include "CmdReceiveOnce.h" 00002 #include "CommandTerminal.h" 00003 00004 CmdReceiveOnce::CmdReceiveOnce(mDot* dot, mts::MTSSerial& serial) : Command(dot, "Receive Once", "AT+RECV", "Receive and display one packet."), 00005 _serial(serial) 00006 { 00007 _help = std::string(text()) + ": " + std::string(desc()); 00008 _usage = "(string:242) or (hex:242)"; 00009 } 00010 00011 uint32_t CmdReceiveOnce::action(std::vector<std::string> args) 00012 { 00013 std::vector<uint8_t> data; 00014 00015 if (_dot->recv(data) == mDot::MDOT_OK) { 00016 if (_dot->getVerbose()) 00017 _serial.writef("Packet data:\r\n"); 00018 00019 if (!data.empty()) 00020 _serial.writef("%s\r\n", CommandTerminal::formatPacketData(data, _dot->getRxOutput()).c_str()); 00021 } 00022 00023 return 0; 00024 } 00025 00026 bool CmdReceiveOnce::verify(std::vector<std::string> args) 00027 { 00028 if (args.size() == 1) 00029 return true; 00030 00031 setErrorMessage("Invalid arguments"); 00032 return false; 00033 }
Generated on Tue Jul 12 2022 21:40:57 by
1.7.2
