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
3565bfe3
Commit
3565bfe3
authored
Feb 05, 2016
by
Nate Weibley
Committed by
Nate Weibley
Feb 12, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch to hash table for gaps and reposition the file when starting to fill a new segment
parent
8e97b8f5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
18 deletions
+23
-18
LogDownloadController.cc
src/ViewWidgets/LogDownloadController.cc
+16
-11
LogDownloadController.h
src/ViewWidgets/LogDownloadController.h
+7
-7
No files found.
src/ViewWidgets/LogDownloadController.cc
View file @
3565bfe3
...
...
@@ -282,16 +282,7 @@ LogDownloadController::_logData(UASInterface* uas, uint32_t ofs, uint16_t id, ui
// Check for a gap
qint64
pos
=
_downloadData
->
file
.
pos
();
if
(
pos
!=
ofs
)
{
// Check for a gap collision
if
(
_downloadData
->
gaps
.
contains
(
ofs
))
{
// The gap is being filled. Shrink it
const
int32_t
gap
=
_downloadData
->
gaps
.
take
(
ofs
)
-
count
;
if
(
gap
>
0
)
{
_downloadData
->
gaps
[
ofs
+
count
]
=
qMax
(
static_cast
<
uint32_t
>
(
gap
),
_downloadData
->
gaps
.
value
(
ofs
+
count
,
0
));
}
else
{
timeout_time
=
20
;
}
}
else
if
(
pos
<
ofs
)
{
if
(
pos
<
ofs
)
{
// Mind the gap
uint32_t
gap
=
ofs
-
pos
;
_downloadData
->
gaps
[
pos
]
=
gap
;
...
...
@@ -304,6 +295,17 @@ LogDownloadController::_logData(UASInterface* uas, uint32_t ofs, uint16_t id, ui
}
}
// Check for a gap collision
if
(
_downloadData
->
gaps
.
contains
(
ofs
))
{
// The gap is being filled. Shrink it
const
int32_t
gap
=
_downloadData
->
gaps
.
take
(
ofs
)
-
count
;
if
(
gap
>
0
)
{
_downloadData
->
gaps
[
ofs
+
count
]
=
qMax
(
static_cast
<
uint32_t
>
(
gap
),
_downloadData
->
gaps
.
value
(
ofs
+
count
,
0
));
}
else
{
timeout_time
=
20
;
}
}
//-- Write chunk to file
if
(
_downloadData
->
file
.
write
((
const
char
*
)
data
,
count
))
{
_downloadData
->
written
+=
count
;
...
...
@@ -378,9 +380,12 @@ LogDownloadController::_findMissingData()
const
qint64
pos
=
_downloadData
->
file
.
pos
(),
size
=
_downloadData
->
entry
->
size
();
if
(
!
_downloadData
->
gaps
.
isEmpty
())
{
const
uint32_t
start
=
_downloadData
->
gaps
.
firstKey
();
auto
keys
=
_downloadData
->
gaps
.
keys
();
qSort
(
keys
);
const
uint32_t
start
=
keys
.
first
();
const
uint32_t
count
=
_downloadData
->
gaps
.
value
(
start
);
_downloadData
->
file
.
seek
(
start
);
//-- Request these log chunks again
_requestLogData
(
_downloadData
->
ID
,
start
,
count
);
}
else
if
(
pos
!=
size
)
{
...
...
src/ViewWidgets/LogDownloadController.h
View file @
3565bfe3
...
...
@@ -125,13 +125,13 @@ private:
//-----------------------------------------------------------------------------
struct
LogDownloadData
{
LogDownloadData
(
QGCLogEntry
*
entry
);
Q
Map
<
uint32_t
,
uint32_t
>
gaps
;
QFile
file
;
QString
filename
;
uint
ID
;
QGCLogEntry
*
entry
;
uint
written
;
QElapsedTimer
elapsed
;
Q
Hash
<
uint32_t
,
uint32_t
>
gaps
;
QFile
file
;
QString
filename
;
uint
ID
;
QGCLogEntry
*
entry
;
uint
written
;
QElapsedTimer
elapsed
;
};
//-----------------------------------------------------------------------------
...
...
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