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
CmdReceiveContinuous.cpp
00001 #include "CmdReceiveContinuous.h" 00002 #include "CommandTerminal.h" 00003 00004 CmdReceiveContinuous::CmdReceiveContinuous(mDot* dot, mts::MTSSerial& serial) : 00005 Command(dot, "Receive Continuous", "AT+RECVC", "Continuously receive and display packets. (escape sequence: +++)"), 00006 _serial(serial) 00007 { 00008 _help = std::string(text()) + ": " + std::string(desc()); 00009 _usage = "in: (2000-2147483647) ms; out: (string:242) or (hex:242)"; 00010 } 00011 00012 uint32_t CmdReceiveContinuous::action(std::vector<std::string> args) 00013 { 00014 std::vector<uint8_t> data; 00015 00016 std::string escape_buffer; 00017 char ch; 00018 00019 while (true) 00020 { 00021 if (_dot->recv(data) == mDot::MDOT_OK) { 00022 if (_dot->getVerbose()) 00023 _serial.writef("Packet data:\r\n"); 00024 _serial.writef("%s\r\n", CommandTerminal::formatPacketData(data, _dot->getRxOutput()).c_str()); 00025 00026 data.clear(); 00027 } 00028 00029 while (_serial.readable()) { 00030 _serial.read(&ch, 1); 00031 escape_buffer += ch; 00032 if (escape_buffer == CommandTerminal::escape_sequence) 00033 return 0; 00034 00035 osDelay(50); 00036 } 00037 00038 escape_buffer.clear(); 00039 } 00040 00041 return 0; 00042 } 00043 00044 bool CmdReceiveContinuous::verify(std::vector<std::string> args) 00045 { 00046 if (args.size() == 1) 00047 return true; 00048 00049 setErrorMessage("Invalid arguments"); 00050 return false; 00051 }
Generated on Tue Jul 12 2022 21:40:57 by
 1.7.2
 1.7.2 
    