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
c615f477
Commit
c615f477
authored
Oct 25, 2016
by
Gus Grubba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finished. Needs testing and debugging.
parent
4d23912a
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
197 additions
and
55 deletions
+197
-55
MavlinkLogManager.cc
src/uas/MavlinkLogManager.cc
+130
-42
MavlinkLogManager.h
src/uas/MavlinkLogManager.h
+47
-6
MavlinkSettings.qml
src/ui/preferences/MavlinkSettings.qml
+20
-7
No files found.
src/uas/MavlinkLogManager.cc
View file @
c615f477
This diff is collapsed.
Click to expand it.
src/uas/MavlinkLogManager.h
View file @
c615f477
...
...
@@ -31,25 +31,31 @@ public:
MavlinkLogFiles
(
MavlinkLogManager
*
manager
,
const
QString
&
filePath
);
Q_PROPERTY
(
QString
name
READ
name
CONSTANT
)
Q_PROPERTY
(
quint32
size
READ
size
CONSTANT
)
Q_PROPERTY
(
quint32
size
READ
size
NOTIFY
sizeChanged
)
Q_PROPERTY
(
bool
selected
READ
selected
WRITE
setSelected
NOTIFY
selectedChanged
)
Q_PROPERTY
(
bool
uploading
READ
uploading
NOTIFY
uploadingChanged
)
Q_PROPERTY
(
qreal
progress
READ
progress
NOTIFY
progressChanged
)
Q_PROPERTY
(
bool
writing
READ
writing
NOTIFY
writingChanged
)
QString
name
()
{
return
_name
;
}
quint32
size
()
{
return
_size
;
}
bool
selected
()
{
return
_selected
;
}
bool
uploading
()
{
return
_uploading
;
}
qreal
progress
()
{
return
_progress
;
}
bool
writing
()
{
return
_writing
;
}
void
setSelected
(
bool
selected
);
void
setUploading
(
bool
uploading
);
void
setProgress
(
qreal
progress
);
void
setWriting
(
bool
writing
);
void
setSize
(
quint32
size
);
signals:
void
sizeChanged
();
void
selectedChanged
();
void
uploadingChanged
();
void
progressChanged
();
void
writingChanged
();
private:
MavlinkLogManager
*
_manager
;
...
...
@@ -58,8 +64,37 @@ private:
bool
_selected
;
bool
_uploading
;
qreal
_progress
;
bool
_writing
;
};
//-----------------------------------------------------------------------------
class
CurrentRunningLog
{
public:
CurrentRunningLog
()
:
fd
(
NULL
)
,
record
(
NULL
)
,
written
(
0
)
{
}
~
CurrentRunningLog
()
{
close
();
}
void
close
()
{
if
(
fd
)
{
fclose
(
fd
);
fd
=
NULL
;
}
}
FILE
*
fd
;
QString
fileName
;
MavlinkLogFiles
*
record
;
quint32
written
;
};
//-----------------------------------------------------------------------------
class
MavlinkLogManager
:
public
QGCTool
{
Q_OBJECT
...
...
@@ -73,7 +108,8 @@ public:
Q_PROPERTY
(
QString
uploadURL
READ
uploadURL
WRITE
setUploadURL
NOTIFY
uploadURLChanged
)
Q_PROPERTY
(
bool
enableAutoUpload
READ
enableAutoUpload
WRITE
setEnableAutoUpload
NOTIFY
enableAutoUploadChanged
)
Q_PROPERTY
(
bool
enableAutoStart
READ
enableAutoStart
WRITE
setEnableAutoStart
NOTIFY
enableAutoStartChanged
)
Q_PROPERTY
(
bool
busy
READ
busy
NOTIFY
busyChanged
)
Q_PROPERTY
(
bool
deleteAfterUpload
READ
deleteAfterUpload
WRITE
setDeleteAfterUpload
NOTIFY
deleteAfterUploadChanged
)
Q_PROPERTY
(
bool
uploading
READ
uploading
NOTIFY
uploadingChanged
)
Q_PROPERTY
(
bool
logRunning
READ
logRunning
NOTIFY
logRunningChanged
)
Q_PROPERTY
(
bool
canStartLog
READ
canStartLog
NOTIFY
canStartLogChanged
)
Q_PROPERTY
(
QmlObjectListModel
*
logFiles
READ
logFiles
NOTIFY
logFilesChanged
)
...
...
@@ -89,9 +125,10 @@ public:
QString
uploadURL
()
{
return
_uploadURL
;
}
bool
enableAutoUpload
()
{
return
_enableAutoUpload
;
}
bool
enableAutoStart
()
{
return
_enableAutoStart
;
}
bool
busy
();
bool
uploading
();
bool
logRunning
()
{
return
_logRunning
;
}
bool
canStartLog
()
{
return
_vehicle
!=
NULL
;
}
bool
deleteAfterUpload
()
{
return
_deleteAfterUpload
;
}
QmlObjectListModel
*
logFiles
()
{
return
&
_logFiles
;
}
...
...
@@ -100,6 +137,7 @@ public:
void
setUploadURL
(
QString
url
);
void
setEnableAutoUpload
(
bool
enable
);
void
setEnableAutoStart
(
bool
enable
);
void
setDeleteAfterUpload
(
bool
enable
);
// Override from QGCTool
void
setToolbox
(
QGCToolbox
*
toolbox
);
...
...
@@ -112,13 +150,14 @@ signals:
void
enableAutoStartChanged
();
void
logFilesChanged
();
void
selectedCountChanged
();
void
busy
Changed
();
void
uploading
Changed
();
void
readyRead
(
QByteArray
data
);
void
failed
();
void
succeed
();
void
abortUpload
();
void
logRunningChanged
();
void
canStartLogChanged
();
void
deleteAfterUploadChanged
();
private
slots
:
void
_uploadFinished
();
...
...
@@ -133,6 +172,8 @@ private:
bool
_processUploadResponse
(
int
http_code
,
QByteArray
&
data
);
bool
_createNewLog
();
int
_getFirstSelected
();
void
_insertNewLog
(
MavlinkLogFiles
*
newLog
);
void
_deleteLog
(
MavlinkLogFiles
*
log
);
private:
QString
_description
;
...
...
@@ -147,9 +188,9 @@ private:
Vehicle
*
_vehicle
;
bool
_logRunning
;
bool
_loggingDisabled
;
FILE
*
_currentSavingFileFd
;
QString
_currentSavingFileStr
;
CurrentRunningLog
*
_currentSavingFile
;
uint16_t
_sequence
;
bool
_deleteAfterUpload
;
};
#endif
src/ui/preferences/MavlinkSettings.qml
View file @
c615f477
...
...
@@ -262,6 +262,7 @@ Rectangle {
//-----------------------------------------------------------------
//-- Automatic Upload
QGCCheckBox
{
id
:
autoUploadCheck
text
:
qsTr
(
"
Enable automatic log uploads
"
)
checked
:
QGroundControl
.
mavlinkLogManager
.
enableAutoUpload
enabled
:
emailField
.
text
!==
""
&&
urlField
!==
""
...
...
@@ -269,6 +270,16 @@ Rectangle {
QGroundControl
.
mavlinkLogManager
.
enableAutoUpload
=
checked
}
}
//-----------------------------------------------------------------
//-- Delete log after upload
QGCCheckBox
{
text
:
qsTr
(
"
Delete log file after uploading
"
)
checked
:
QGroundControl
.
mavlinkLogManager
.
deleteAfterUpload
enabled
:
emailField
.
text
!==
""
&&
urlField
!==
""
&&
autoUploadCheck
.
checked
onClicked
:
{
QGroundControl
.
mavlinkLogManager
.
deleteAfterUpload
=
checked
}
}
}
}
//-----------------------------------------------------------------
...
...
@@ -327,11 +338,13 @@ Rectangle {
QGCLabel
{
text
:
object
.
name
width
:
ScreenTools
.
defaultFontPixelWidth
*
28
color
:
object
.
writing
?
qgcPal
.
warningText
:
qgcPal
.
text
}
QGCLabel
{
text
:
Number
(
object
.
size
).
toLocaleString
(
Qt
.
locale
(),
'
f
'
,
0
)
visible
:
!
object
.
uploading
width
:
ScreenTools
.
defaultFontPixelWidth
*
20
;
color
:
object
.
writing
?
qgcPal
.
warningText
:
qgcPal
.
text
horizontalAlignment
:
Text
.
AlignRight
}
ProgressBar
{
...
...
@@ -352,7 +365,7 @@ Rectangle {
anchors.horizontalCenter
:
parent
.
horizontalCenter
QGCButton
{
text
:
"
Check All
"
enabled
:
!
QGroundControl
.
mavlinkLogManager
.
busy
enabled
:
!
QGroundControl
.
mavlinkLogManager
.
uploading
&&
!
QGroundControl
.
mavlinkLogManager
.
logRunning
onClicked
:
{
for
(
var
i
=
0
;
i
<
QGroundControl
.
mavlinkLogManager
.
logFiles
.
count
;
i
++
)
{
var
logFile
=
QGroundControl
.
mavlinkLogManager
.
logFiles
.
get
(
i
)
...
...
@@ -362,7 +375,7 @@ Rectangle {
}
QGCButton
{
text
:
"
Check None
"
enabled
:
!
QGroundControl
.
mavlinkLogManager
.
busy
enabled
:
!
QGroundControl
.
mavlinkLogManager
.
uploading
&&
!
QGroundControl
.
mavlinkLogManager
.
logRunning
onClicked
:
{
for
(
var
i
=
0
;
i
<
QGroundControl
.
mavlinkLogManager
.
logFiles
.
count
;
i
++
)
{
var
logFile
=
QGroundControl
.
mavlinkLogManager
.
logFiles
.
get
(
i
)
...
...
@@ -372,7 +385,7 @@ Rectangle {
}
QGCButton
{
text
:
"
Delete Selected
"
enabled
:
_selectedCount
>
0
&&
!
QGroundControl
.
mavlinkLogManager
.
busy
enabled
:
_selectedCount
>
0
&&
!
QGroundControl
.
mavlinkLogManager
.
uploading
&&
!
QGroundControl
.
mavlinkLogManager
.
logRunning
onClicked
:
deleteDialog
.
open
()
MessageDialog
{
id
:
deleteDialog
...
...
@@ -388,8 +401,8 @@ Rectangle {
}
QGCButton
{
text
:
"
Upload Selected
"
enabled
:
_selectedCount
>
0
&&
!
QGroundControl
.
mavlinkLogManager
.
busy
visible
:
!
QGroundControl
.
mavlinkLogManager
.
busy
enabled
:
_selectedCount
>
0
&&
!
QGroundControl
.
mavlinkLogManager
.
uploading
&&
!
QGroundControl
.
mavlinkLogManager
.
logRunning
visible
:
!
QGroundControl
.
mavlinkLogManager
.
uploading
onClicked
:
{
QGroundControl
.
mavlinkLogManager
.
emailAddress
=
emailField
.
text
if
(
QGroundControl
.
mavlinkLogManager
.
emailAddress
===
""
)
...
...
@@ -411,8 +424,8 @@ Rectangle {
}
QGCButton
{
text
:
"
Cancel
"
enabled
:
QGroundControl
.
mavlinkLogManager
.
busy
visible
:
QGroundControl
.
mavlinkLogManager
.
busy
enabled
:
QGroundControl
.
mavlinkLogManager
.
uploading
&&
!
QGroundControl
.
mavlinkLogManager
.
logRunning
visible
:
QGroundControl
.
mavlinkLogManager
.
uploading
onClicked
:
cancelDialog
.
open
()
MessageDialog
{
id
:
cancelDialog
...
...
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