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
4992f93d
Commit
4992f93d
authored
Jul 07, 2014
by
Lorenz Meier
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #748 from DonLakeFlyer/FTPTimeout
FTP: Better timeout handling
parents
973b9c0c
d9bc4cb2
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
6 deletions
+47
-6
QGCUASFileManager.cc
src/uas/QGCUASFileManager.cc
+5
-1
QGCUASFileView.cc
src/ui/QGCUASFileView.cc
+34
-5
QGCUASFileView.h
src/ui/QGCUASFileView.h
+8
-0
No files found.
src/uas/QGCUASFileManager.cc
View file @
4992f93d
...
...
@@ -471,15 +471,19 @@ void QGCUASFileManager::_clearAckTimeout(void)
/// @brief Called when ack timeout timer fires
void
QGCUASFileManager
::
_ackTimeout
(
void
)
{
_emitErrorMessage
(
tr
(
"Timeout waiting for ack"
));
// Make sure to set _currentOperation state before emitting error message. Code may respond
// to error message signal by sending another command, which will fail if state is not back
// to idle. FileView UI works this way with the List command.
switch
(
_currentOperation
)
{
case
kCORead
:
_currentOperation
=
kCOAck
;
_emitErrorMessage
(
tr
(
"Timeout waiting for ack: Sending Terminate command"
));
_sendTerminateCommand
();
break
;
default:
_currentOperation
=
kCOIdle
;
_emitErrorMessage
(
tr
(
"Timeout waiting for ack"
));
break
;
}
}
...
...
src/ui/QGCUASFileView.cc
View file @
4992f93d
...
...
@@ -40,7 +40,9 @@ QGCUASFileView::QGCUASFileView(QWidget *parent, QGCUASFileManager *manager) :
Q_ASSERT
(
success
);
success
=
connect
(
_ui
.
treeWidget
,
SIGNAL
(
currentItemChanged
(
QTreeWidgetItem
*
,
QTreeWidgetItem
*
)),
this
,
SLOT
(
_currentItemChanged
(
QTreeWidgetItem
*
,
QTreeWidgetItem
*
)));
Q_ASSERT
(
success
);
Q_UNUSED
(
success
);
success
=
connect
(
&
_listCompleteTimer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
_listCompleteTimeout
()));
Q_ASSERT
(
success
);
Q_UNUSED
(
success
);
// Silence retail unused variable error
}
void
QGCUASFileView
::
_downloadFiles
(
void
)
...
...
@@ -88,8 +90,7 @@ void QGCUASFileView::_refreshTree(void)
// Don't queue up more than once
_ui
.
listFilesButton
->
setEnabled
(
false
);
qDebug
()
<<
"List: /"
;
_manager
->
listDirectory
(
"/"
);
_requestDirectoryList
(
"/"
);
}
void
QGCUASFileView
::
_treeStatusMessage
(
const
QString
&
msg
)
...
...
@@ -128,6 +129,8 @@ void QGCUASFileView::_treeErrorMessage(const QString& msg)
void
QGCUASFileView
::
_listComplete
(
void
)
{
_clearListCompleteTimeout
();
// Walk the current items, traversing down into directories
Again:
...
...
@@ -159,8 +162,7 @@ Again:
QTreeWidgetItem
*
item
=
_walkItemStack
[
i
];
dir
.
append
(
"/"
+
item
->
text
(
0
));
}
qDebug
()
<<
"List:"
<<
dir
;
_manager
->
listDirectory
(
dir
);
_requestDirectoryList
(
dir
);
}
else
{
// We have run out of items at the this level, pop the stack and keep going at that level
_walkIndexStack
.
removeLast
();
...
...
@@ -192,3 +194,30 @@ void QGCUASFileView::_currentItemChanged(QTreeWidgetItem* current, QTreeWidgetIt
Q_UNUSED
(
previous
);
_ui
.
downloadButton
->
setEnabled
(
current
?
(
current
->
type
()
==
_typeFile
)
:
false
);
}
void
QGCUASFileView
::
_setupListCompleteTimeout
(
void
)
{
Q_ASSERT
(
!
_listCompleteTimer
.
isActive
());
_listCompleteTimer
.
setSingleShot
(
true
);
_listCompleteTimer
.
start
(
_listCompleteTimerTimeoutMsecs
);
}
void
QGCUASFileView
::
_clearListCompleteTimeout
(
void
)
{
Q_ASSERT
(
_listCompleteTimer
.
isActive
());
_listCompleteTimer
.
stop
();
}
void
QGCUASFileView
::
_listCompleteTimeout
(
void
)
{
_treeErrorMessage
(
tr
(
"Timeout waiting for listComplete signal"
));
}
void
QGCUASFileView
::
_requestDirectoryList
(
const
QString
&
dir
)
{
qDebug
()
<<
"List:"
<<
dir
;
_setupListCompleteTimeout
();
_manager
->
listDirectory
(
dir
);
}
src/ui/QGCUASFileView.h
View file @
4992f93d
...
...
@@ -48,12 +48,20 @@ private slots:
void
_listComplete
(
void
);
void
_downloadStatusMessage
(
const
QString
&
msg
);
void
_currentItemChanged
(
QTreeWidgetItem
*
current
,
QTreeWidgetItem
*
previous
);
void
_listCompleteTimeout
(
void
);
private:
void
_setupListCompleteTimeout
(
void
);
void
_clearListCompleteTimeout
(
void
);
void
_requestDirectoryList
(
const
QString
&
dir
);
static
const
int
_typeFile
=
QTreeWidgetItem
::
UserType
+
1
;
static
const
int
_typeDir
=
QTreeWidgetItem
::
UserType
+
2
;
static
const
int
_typeError
=
QTreeWidgetItem
::
UserType
+
3
;
QTimer
_listCompleteTimer
;
///> Used to signal a timeout waiting for a listComplete signal
static
const
int
_listCompleteTimerTimeoutMsecs
=
5000
;
///> Timeout in msecs for listComplete timer
QList
<
int
>
_walkIndexStack
;
QList
<
QTreeWidgetItem
*>
_walkItemStack
;
Ui
::
QGCUASFileView
_ui
;
...
...
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