* @brief Starts a YMODEM file transfer. */
| 53 | * @brief Starts a YMODEM file transfer. |
| 54 | */ |
| 55 | void IO::Protocols::YMODEM::startTransfer(const QString& filePath) |
| 56 | { |
| 57 | if (isActive()) |
| 58 | cancelTransfer(); |
| 59 | |
| 60 | m_file.setFileName(filePath); |
| 61 | if (!m_file.open(QIODevice::ReadOnly)) { |
| 62 | Q_EMIT finished(false, tr("Cannot open file: %1").arg(m_file.errorString())); |
| 63 | return; |
| 64 | } |
| 65 | |
| 66 | m_filePath = filePath; |
| 67 | m_fileSize = m_file.size(); |
| 68 | m_bytesSent = 0; |
| 69 | m_blockNumber = 0; |
| 70 | m_retryCount = 0; |
| 71 | m_yState = YState::WaitingForInitialC; |
| 72 | m_state = State::WaitingForStart; |
| 73 | |
| 74 | Q_EMIT statusMessage(tr("Waiting for receiver…")); |
| 75 | Q_EMIT progressChanged(0, m_fileSize); |
| 76 | |
| 77 | m_timeoutTimer.start(m_timeoutMs); |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * @brief Reacts to a byte received while waiting for ACK of block 0. |
nothing calls this directly
no test coverage detected