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

Method sendLine

app/src/IO/FileTransmission.cpp:587–612  ·  view source on GitHub ↗

* @brief Sends the next line from the file (plain text mode). */

Source from the content-addressed store, hash-verified

585 * @brief Sends the next line from the file (plain text mode).
586 */
587void IO::FileTransmission::sendLine()
588{
589 if (!active())
590 return;
591
592 if (!IO::ConnectionManager::instance().isConnected())
593 return;
594
595 if (m_stream && !m_stream->atEnd()) {
596 auto line = m_stream->readLine();
597 if (!line.isEmpty()) {
598 if (!line.endsWith("\n"))
599 line.append("\n");
600
601 auto data = line.toUtf8();
602 (void)IO::ConnectionManager::instance().writeData(data);
603 m_bytesSent = m_stream->pos();
604 Q_EMIT progressChanged();
605 }
606 } else {
607 stopTransmission();
608 m_statusText = tr("Transmission complete");
609 Q_EMIT statusTextChanged();
610 appendLog(tr("Plain text transmission complete"));
611 }
612}
613
614//--------------------------------------------------------------------------------------------------
615// Raw binary transmission

Callers

nothing calls this directly

Calls 6

isEmptyMethod · 0.80
posMethod · 0.80
isConnectedMethod · 0.45
atEndMethod · 0.45
appendMethod · 0.45
writeDataMethod · 0.45

Tested by

no test coverage detected