Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
277c1ae1
Commit
277c1ae1
authored
May 06, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1542 from DonLakeFlyer/FileManager
Cleanup FileManager
parents
2e3088b8
5e36ee5f
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
201 additions
and
263 deletions
+201
-263
FileManagerTest.h
src/qgcunittest/FileManagerTest.h
+5
-11
FileManager.cc
src/uas/FileManager.cc
+77
-55
FileManager.h
src/uas/FileManager.h
+20
-29
QGCUASFileView.cc
src/ui/QGCUASFileView.cc
+85
-152
QGCUASFileView.h
src/ui/QGCUASFileView.h
+14
-16
No files found.
src/qgcunittest/FileManagerTest.h
View file @
277c1ae1
...
...
@@ -53,13 +53,11 @@ private slots:
void
cleanup
(
void
);
// Test cases
#if 0
void
_ackTest
(
void
);
void
_noAckTest
(
void
);
void
_resetTest
(
void
);
void
_listTest
(
void
);
void
_readDownloadTest
(
void
);
#endif
void
_streamDownloadTest
(
void
);
// Connected to FileManager listEntry signal
...
...
@@ -70,19 +68,15 @@ private:
enum
{
listEntrySignalIndex
=
0
,
listCompleteSignalIndex
,
downloadFileLengthSignalIndex
,
downloadFileCompleteSignalIndex
,
errorMessageSignalIndex
,
commandCompleteSignalIndex
,
commandErrorSignalIndex
,
maxSignalIndex
};
enum
{
listEntrySignalMask
=
1
<<
listEntrySignalIndex
,
listCompleteSignalMask
=
1
<<
listCompleteSignalIndex
,
downloadFileLengthSignalMask
=
1
<<
downloadFileLengthSignalIndex
,
downloadFileCompleteSignalMask
=
1
<<
downloadFileCompleteSignalIndex
,
errorMessageSignalMask
=
1
<<
errorMessageSignalIndex
,
listEntrySignalMask
=
1
<<
listEntrySignalIndex
,
commandCompleteSignalMask
=
1
<<
commandCompleteSignalIndex
,
commandErrorSignalMask
=
1
<<
errorMessageSignalIndex
,
};
static
const
uint8_t
_systemIdQGC
=
255
;
...
...
src/uas/FileManager.cc
View file @
277c1ae1
This diff is collapsed.
Click to expand it.
src/uas/FileManager.h
View file @
277c1ae1
...
...
@@ -35,6 +35,7 @@ Q_DECLARE_LOGGING_CATEGORY(FileManagerLog)
class
FileManager
:
public
QObject
{
Q_OBJECT
public:
FileManager
(
QObject
*
parent
,
UASInterface
*
uas
,
uint8_t
unitTestSystemIdQGC
=
0
);
...
...
@@ -65,38 +66,23 @@ public:
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
);
// Signals associated with the listDirectory method
///
@brief
Signalled to indicate a new directory entry was received.
/// Signalled to indicate a new directory entry was received.
void
listEntry
(
const
QString
&
entry
);
/// @brief Signalled after listDirectory completes. If an error occurs during directory listing this signal will not be emitted.
void
listComplete
(
void
);
// Signals associated with all commands
// Signals associated with the downloadPath method
/// Signalled after a command has completed
void
commandComplete
(
void
);
/// @brief Signalled after downloadPath is called to indicate length of file being downloaded
void
downloadFileLength
(
unsigned
int
length
);
/// Signalled when an error occurs during a command. In this case a commandComplete signal will
/// not be sent.
void
commandError
(
const
QString
&
msg
);
/// @brief Signalled during file download to indicate download progress
/// @param bytesReceived Number of bytes currently received from file
void
downloadFileProgress
(
unsigned
int
bytesReceived
);
/// @brief Signaled to indicate completion of file download. If an error occurs during download this signal will not be emitted.
void
downloadFileComplete
(
void
);
/// @brief Signalled after createFile acknowledge is returned to indicate length of file being downloaded
void
uploadFileLength
(
unsigned
int
length
);
/// @brief Signalled during file upload to indicate progress
/// @param bytesReceived Number of bytes currently transmitted to file
void
uploadFileProgress
(
unsigned
int
bytesReceived
);
/// @brief Signaled to indicate completion of file upload. If an error occurs during download this signal will not be emitted.
void
uploadFileComplete
(
void
);
/// Signalled during a lengthy command to show progress
/// @param value Amount of progress: 0.0 = none, 1.0 = complete
void
commandProgress
(
int
value
);
public
slots
:
void
receiveMessage
(
LinkInterface
*
link
,
mavlink_message_t
message
);
...
...
@@ -184,7 +170,7 @@ private:
kCOAck
,
// waiting for an Ack
kCOList
,
// waiting for List response
kCOOpenRead
,
// waiting for Open response followed by Read download
kCOOpen
Stream
,
// waiting for Open response, followed by Stream
download
kCOOpen
Burst
,
// waiting for Open response, followed by Burst
download
kCORead
,
// waiting for Read response
kCOBurst
,
// waiting for Burst response
kCOWrite
,
// waiting for Write response
...
...
@@ -205,8 +191,9 @@ private:
void
_writeAckResponse
(
Request
*
writeAck
);
void
_writeFileDatablock
(
void
);
void
_sendListCommand
(
void
);
void
_send
Terminate
Command
(
void
);
void
_send
Reset
Command
(
void
);
void
_closeDownloadSession
(
bool
success
);
void
_closeUploadSession
(
bool
success
);
void
_downloadWorker
(
const
QString
&
from
,
const
QDir
&
downloadDir
,
bool
readFile
);
static
QString
errorString
(
uint8_t
errorCode
);
...
...
@@ -222,15 +209,19 @@ private:
QString
_listPath
;
///< path for the current List operation
uint8_t
_activeSession
;
///< currently active session, 0 for none
uint32_t
_readOffset
;
///< current read offset
uint32_t
_writeOffset
;
///< current write offset
uint32_t
_writeSize
;
///< current write data size
uint32_t
_writeFileSize
;
///< current write file size
uint32_t
_writeFileSize
;
///< Size of file being uploaded
QByteArray
_writeFileAccumulator
;
///< Holds file being uploaded
uint32_t
_downloadOffset
;
///< current download offset
QByteArray
_readFileAccumulator
;
///< Holds file being downloaded
QByteArray
_writeFileAccumulator
;
///< Holds file being uploaded
QDir
_readFileDownloadDir
;
///< Directory to download file to
QString
_readFileDownloadFilename
;
///< Filename (no path) for download file
uint32_t
_downloadFileSize
;
///< Size of file being downloaded
uint8_t
_systemIdQGC
;
///< System ID for QGC
uint8_t
_systemIdServer
;
///< System ID for server
...
...
src/ui/QGCUASFileView.cc
View file @
277c1ae1
This diff is collapsed.
Click to expand it.
src/ui/QGCUASFileView.h
View file @
277c1ae1
...
...
@@ -41,26 +41,22 @@ protected:
FileManager
*
_manager
;
private
slots
:
void
_refreshTree
(
void
);
void
_listEntryReceived
(
const
QString
&
entry
);
void
_listErrorMessage
(
const
QString
&
msg
);
void
_listComplete
(
void
);
void
_refreshTree
(
void
);
void
_downloadFile
(
void
);
void
_uploadFile
(
void
);
void
_downloadLength
(
unsigned
int
length
);
void
_
downloadProgress
(
unsigned
int
length
);
void
_
downloadErrorMessage
(
const
QString
&
msg
);
void
_
downloa
dComplete
(
void
);
void
_
commandProgress
(
int
value
);
void
_
commandError
(
const
QString
&
msg
);
void
_
comman
dComplete
(
void
);
void
_currentItemChanged
(
QTreeWidgetItem
*
current
,
QTreeWidgetItem
*
previous
);
private:
void
_connectDownloadSignals
(
void
);
void
_disconnectDownloadSignals
(
void
);
void
_connectListSignals
(
void
);
void
_disconnectListSignals
(
void
);
void
_listComplete
(
void
);
void
_requestDirectoryList
(
const
QString
&
dir
);
void
_setAllButtonsEnabled
(
bool
enabled
);
static
const
int
_typeFile
=
QTreeWidgetItem
::
UserType
+
1
;
static
const
int
_typeDir
=
QTreeWidgetItem
::
UserType
+
2
;
...
...
@@ -70,12 +66,14 @@ private:
QList
<
QTreeWidgetItem
*>
_walkItemStack
;
Ui
::
QGCUASFileView
_ui
;
QString
_downloadFilename
;
///< File currently being downloaded, not including path
QTime
_downloadStartTime
;
///< Time at which download started
enum
CommandState
{
commandNone
,
///< No command active
commandList
,
///< List command active
commandDownload
,
///< Download command active
commandUpload
///< Upload command active
};
bool
_listInProgress
;
///< Indicates that a listDirectory command is in progress
bool
_downloadInProgress
;
///< Indicates that a downloadPath command is in progress
bool
_uploadInProgress
;
///< Indicates that a upload command is in progress
CommandState
_currentCommand
;
///< Current active command
};
#endif // QGCUASFILEVIEW_H
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment