MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / processInput

Method processInput

app/src/IO/FileTransmission/XMODEM.cpp:194–226  ·  view source on GitHub ↗

* @brief Processes bytes received from the remote device. */

Source from the content-addressed store, hash-verified

192 * @brief Processes bytes received from the remote device.
193 */
194void IO::Protocols::XMODEM::processInput(const QByteArray& data)
195{
196 Q_ASSERT(!data.isEmpty());
197 Q_ASSERT(isActive());
198
199 for (const char byte : data) {
200 const quint8 ch = static_cast<quint8>(byte);
201
202 switch (m_state) {
203 case State::WaitingForStart:
204 if (ch == kCRC) {
205 m_timeoutTimer.stop();
206 m_state = State::SendingBlocks;
207 Q_EMIT statusMessage(tr("Receiver ready (CRC mode), sending data…"));
208 sendBlock();
209 }
210 break;
211
212 case State::WaitingForAck:
213 if (!handleAckByte(ch))
214 return;
215
216 break;
217
218 case State::WaitingForEOTAck:
219 handleEotAckByte(ch);
220 break;
221
222 default:
223 break;
224 }
225 }
226}
227
228//--------------------------------------------------------------------------------------------------
229// Configuration

Callers

nothing calls this directly

Calls 2

isEmptyMethod · 0.80
stopMethod · 0.45

Tested by

no test coverage detected