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
8ce31541
Commit
8ce31541
authored
Mar 31, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add reconnectAfterWait API
parent
a5341222
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
0 deletions
+33
-0
QGCApplication.cc
src/QGCApplication.cc
+23
-0
QGCApplication.h
src/QGCApplication.h
+10
-0
No files found.
src/QGCApplication.cc
View file @
8ce31541
...
...
@@ -581,3 +581,26 @@ void QGCApplication::_loadCurrentStyle(void)
// Finally restore the cursor before returning.
restoreOverrideCursor
();
}
void
QGCApplication
::
reconnectAfterWait
(
int
waitSeconds
)
{
LinkManager
*
linkManager
=
LinkManager
::
instance
();
Q_ASSERT
(
linkManager
);
Q_ASSERT
(
linkManager
->
getLinks
().
count
()
==
1
);
LinkInterface
*
link
=
linkManager
->
getLinks
()[
0
];
// Save the link configuration so we can restart the link laster
_reconnectLinkConfig
=
linkManager
->
getLinks
()[
0
]
->
getLinkConfiguration
();
// Disconnect and wait
linkManager
->
disconnectLink
(
link
);
QTimer
::
singleShot
(
waitSeconds
*
1000
,
this
,
&
QGCApplication
::
_reconnect
);
}
void
QGCApplication
::
_reconnect
(
void
)
{
qgcApp
()
->
restoreOverrideCursor
();
LinkManager
::
instance
()
->
createConnectedLink
(
_reconnectLinkConfig
);
}
\ No newline at end of file
src/QGCApplication.h
View file @
8ce31541
...
...
@@ -34,6 +34,8 @@
#include <QApplication>
#include "LinkConfiguration.h"
#ifdef QGC_RTLAB_ENABLED
#include "OpalLink.h"
#endif
...
...
@@ -93,6 +95,9 @@ public:
/// Set the current UI style
void
setStyle
(
bool
styleIsDark
);
/// Disconnects the current link and waits for the specified number of seconds before reconnecting.
void
reconnectAfterWait
(
int
waitSeconds
);
public
slots
:
/// You can connect to this slot to show an information message box from a different thread.
void
informationMessageBoxOnMainThread
(
const
QString
&
title
,
const
QString
&
msg
);
...
...
@@ -132,6 +137,9 @@ public:
static
QGCApplication
*
_app
;
///< Our own singleton. Should be reference directly by qgcApp
private
slots
:
void
_reconnect
(
void
);
private:
void
_createSingletons
(
void
);
void
_destroySingletons
(
void
);
...
...
@@ -153,6 +161,8 @@ private:
static
const
char
*
_lightStyleFile
;
bool
_styleIsDark
;
///< true: dark style, false: light style
LinkConfiguration
*
_reconnectLinkConfig
;
///< Configuration to reconnect for reconnectAfterWai
/// Unit Test have access to creating and destroying singletons
friend
class
UnitTest
;
};
...
...
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