27 void setFileList(
const QStringList &fileList) { _fileList = fileList; }
41 QList<LogFile>
logFiles()
const {
return _logFiles; }
98 QByteArray
uploadedFileContents(
const QString& remotePath)
const {
return _uploadedFiles.value(remotePath); }
160 void _sendAck(quint32 targetSystemId, uint8_t targetComponentId, uint16_t seqNumber,
162 void _sendNak(quint32 targetSystemId, uint8_t targetComponentId,
MavlinkFTP::ErrorCode_t error, uint16_t seqNumber,
164 void _sendNakErrno(quint32 targetSystemId, uint8_t targetComponentId, uint8_t nakErrno, uint16_t seqNumber,
167 void _sendResponse(quint32 targetSystemId, uint8_t targetComponentId, MavlinkFTP::Request* request,
169 void _sendLastReply();
171 void _listCommand(quint32 senderSystemId, uint8_t senderComponentId, MavlinkFTP::Request* request,
172 uint16_t seqNumber,
bool withTime);
173 void _openCommand(quint32 senderSystemId, uint8_t senderComponentId, MavlinkFTP::Request* request,
175 void _createFileCommand(quint32 senderSystemId, uint8_t senderComponentId, MavlinkFTP::Request* request,
177 void _openFileWOCommand(quint32 senderSystemId, uint8_t senderComponentId, MavlinkFTP::Request* request,
179 void _readCommand(quint32 senderSystemId, uint8_t senderComponentId, MavlinkFTP::Request* request,
181 void _burstReadCommand(quint32 senderSystemId, uint8_t senderComponentId, MavlinkFTP::Request* request,
183 void _removeFileCommand(quint32 senderSystemId, uint8_t senderComponentId, MavlinkFTP::Request* request,
185 void _terminateCommand(quint32 senderSystemId, uint8_t senderComponentId, MavlinkFTP::Request* request,
187 void _resetCommand(quint32 senderSystemId, uint8_t senderComponentId, uint16_t seqNumber);
188 void _writeCommand(quint32 senderSystemId, uint8_t senderComponentId, MavlinkFTP::Request* request,
190 void _finalizeActiveUpload();
193 uint16_t _nextSeqNumber(uint16_t seqNumber)
const;
194 static QString _createTestTempFile(
int size);
195 QString _generateParamPck(
bool withDefaults);
196 QString _logFileTempPath(
const QString &name);
198 std::optional<QStringList> _logDirectoryEntries(
const QString& subdir,
bool withTime)
const;
199 static QByteArray _generateLogFileContents(
const QString &name,
int size);
202 static void ensureNullTemination(MavlinkFTP::Request *request);
204 const quint32 _systemIdServer;
205 const uint8_t _componentIdServer;
208 bool _lastReplyValid =
false;
209 bool _randomDropsEnabled =
false;
210 int _responseDelayMs = 0;
211 int _burstReadDelayMs = 0;
213 bool _listDirectoryWithTimeSupported =
true;
215 bool _logDirEntriesWithTime =
false;
216 bool _logDirDotEntries =
false;
217 bool _paramPckEnabled =
true;
218 bool _singleSessionEnforced =
false;
219 bool _ignoreResetSessions =
false;
220 int _expireSessionAfterBursts = 0;
221 int _burstsServed = 0;
222 uint32_t _dropBurstPacketOffset = 0;
223 bool _dropBurstPacketPending =
false;
224 uint32_t _reorderBurstPacketOffset = 0;
225 bool _reorderBurstPacketPending =
false;
226 int _openFileROCount = 0;
227 int _readFileCount = 0;
228 int _lastBurstReadRequestSize = -1;
229 int _lastReadFileRequestSize = -1;
232 QString _paramPckTempFile;
233 struct UploadSession {
244 UploadSession _uploadSession;
245 QHash<QString, QByteArray> _uploadedFiles;
246 QStringList _fileList;
247 QList<LogFile> _logFiles;
248 QHash<QString, QString> _logFileTempPaths;
249 uint16_t _lastReplySequence = 0;
251 static constexpr uint8_t _sessionId = 1;