diff --git a/src/uas/FileManager.cc b/src/uas/FileManager.cc index cb0c5f2cd49358e6ae0eaddee7e7d90fc65a311b..2c8ccfa9f22f37e270eda0e50daa06d7b114109f 100644 --- a/src/uas/FileManager.cc +++ b/src/uas/FileManager.cc @@ -379,7 +379,7 @@ void FileManager::receiveMessage(LinkInterface* link, mavlink_message_t message) // This is not an error, just the end of the download loop _closeDownloadSession(true /* success */); return; - } else if (previousOperation == kCOCreate) { + } else if (request->hdr.req_opcode == kCmdCreateFile) { // End a failed create file operation _sendTerminateCommand(); _emitErrorMessage(tr("Nak received creating file, error: %1").arg(errorString(request->data[0]))); @@ -614,14 +614,14 @@ void FileManager::_ackTimeout(void) case kCOCreate: _currentOperation = kCOAck; _writeFileAccumulator.clear(); - _emitErrorMessage(tr("Timeout waiting for ack: Sending Create command")); + _emitErrorMessage(tr("Timeout waiting for ack: Sending Terminate command")); _sendTerminateCommand(); break; case kCOWrite: _currentOperation = kCOAck; _writeFileAccumulator.clear(); - _emitErrorMessage(tr("Timeout waiting for ack: Sending Write command")); + _emitErrorMessage(tr("Timeout waiting for ack: Sending Terminate command")); _sendTerminateCommand(); break; diff --git a/src/uas/FileManager.h b/src/uas/FileManager.h index ba397707dcee51e90e5ad4b3092c505845cb2973..71edcd3d1eb77dc11ad1cb5c1aa6fad7cde659b3 100644 --- a/src/uas/FileManager.h +++ b/src/uas/FileManager.h @@ -61,6 +61,10 @@ public: /// @param dirPath Fully qualified path to list void listDirectory(const QString& dirPath); + + /// Upload the specified file to the specified location + void uploadPath(const QString& toPath, const QFileInfo& uploadFile); + signals: /// @brief Signalled whenever an error occurs during the listDirectory or downloadPath methods. void errorMessage(const QString& msg); @@ -97,9 +101,6 @@ signals: public slots: void receiveMessage(LinkInterface* link, mavlink_message_t message); - void listDirectory(const QString& dirPath); - void downloadPath(const QString& from, const QDir& downloadDir); - void uploadPath(const QString& toPath, const QFileInfo& uploadFile); private slots: void _ackTimeout(void); @@ -188,6 +189,7 @@ private: kCORead, // waiting for Read response kCOBurst, // waiting for Burst response kCOWrite, // waiting for Write response + kCOCreate, // waiting for Create response }; bool _sendOpcodeOnlyCmd(uint8_t opcode, OperationState newOpState);