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
5b3e8eb2
Commit
5b3e8eb2
authored
May 15, 2014
by
Lorenz Meier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More cleanup on threading
parent
eaf61cb1
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
45 additions
and
4 deletions
+45
-4
MAVLinkProtocol.cc
src/comm/MAVLinkProtocol.cc
+17
-1
MAVLinkProtocol.h
src/comm/MAVLinkProtocol.h
+2
-0
ProtocolInterface.h
src/comm/ProtocolInterface.h
+1
-1
QGCXPlaneLink.cc
src/comm/QGCXPlaneLink.cc
+5
-0
SerialLink.cc
src/comm/SerialLink.cc
+6
-0
TCPLink.cc
src/comm/TCPLink.cc
+6
-0
UDPLink.cc
src/comm/UDPLink.cc
+6
-0
QGCMAVLinkUASFactory.cc
src/uas/QGCMAVLinkUASFactory.cc
+1
-0
UAS.cc
src/uas/UAS.cc
+0
-1
MAVLinkDecoder.cc
src/ui/MAVLinkDecoder.cc
+1
-1
No files found.
src/comm/MAVLinkProtocol.cc
View file @
5b3e8eb2
...
...
@@ -64,7 +64,7 @@ MAVLinkProtocol::MAVLinkProtocol() :
m_authKey
=
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
;
loadSettings
();
//start(QThread::LowPriority
);
moveToThread
(
this
);
// Start heartbeat timer, emitting a heartbeat at the configured rate
connect
(
heartbeatTimer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
sendHeartbeat
()));
heartbeatTimer
->
start
(
1000
/
heartbeatRate
);
...
...
@@ -81,6 +81,8 @@ MAVLinkProtocol::MAVLinkProtocol() :
}
}
start
(
QThread
::
HighPriority
);
emit
versionCheckChanged
(
m_enable_version_check
);
}
...
...
@@ -166,6 +168,20 @@ MAVLinkProtocol::~MAVLinkProtocol()
delete
m_logfile
;
m_logfile
=
NULL
;
}
// Tell the thread to exit
quit
();
// Wait for it to exit
wait
();
}
/**
* @brief Runs the thread
*
**/
void
MAVLinkProtocol
::
run
()
{
exec
();
}
QString
MAVLinkProtocol
::
getLogfileName
()
...
...
src/comm/MAVLinkProtocol.h
View file @
5b3e8eb2
...
...
@@ -150,6 +150,8 @@ public:
*/
virtual
void
resetMetadataForLink
(
const
LinkInterface
*
link
);
void
run
();
public
slots
:
/** @brief Receive bytes from a communication interface */
void
receiveBytes
(
LinkInterface
*
link
,
QByteArray
b
);
...
...
src/comm/ProtocolInterface.h
View file @
5b3e8eb2
...
...
@@ -46,7 +46,7 @@ This file is part of the PIXHAWK project
* @see LinkManager.
*
**/
class
ProtocolInterface
:
public
Q
Object
class
ProtocolInterface
:
public
Q
Thread
{
Q_OBJECT
public:
...
...
src/comm/QGCXPlaneLink.cc
View file @
5b3e8eb2
...
...
@@ -74,6 +74,11 @@ QGCXPlaneLink::QGCXPlaneLink(UASInterface* mav, QString remoteHost, QHostAddress
QGCXPlaneLink
::~
QGCXPlaneLink
()
{
storeSettings
();
// Tell the thread to exit
quit
();
// Wait for it to exit
wait
();
// if(connectState) {
// disconnectSimulation();
// }
...
...
src/comm/SerialLink.cc
View file @
5b3e8eb2
...
...
@@ -87,6 +87,11 @@ SerialLink::~SerialLink()
disconnect
();
if
(
m_port
)
delete
m_port
;
m_port
=
NULL
;
// Tell the thread to exit
quit
();
// Wait for it to exit
wait
();
}
QList
<
QString
>
SerialLink
::
getCurrentPorts
()
...
...
@@ -455,6 +460,7 @@ bool SerialLink::hardwareConnect(QString &type)
qDebug
()
<<
"SerialLink: hardwareConnect to "
<<
m_portName
;
m_port
=
new
QSerialPort
(
m_portName
);
m_port
->
moveToThread
(
this
);
if
(
!
m_port
)
{
emit
communicationUpdate
(
getName
(),
"Error opening port: "
+
m_portName
);
...
...
src/comm/TCPLink.cc
View file @
5b3e8eb2
...
...
@@ -56,6 +56,12 @@ TCPLink::TCPLink(QHostAddress hostAddress, quint16 socketPort) :
TCPLink
::~
TCPLink
()
{
disconnect
();
// Tell the thread to exit
quit
();
// Wait for it to exit
wait
();
deleteLater
();
}
...
...
src/comm/UDPLink.cc
View file @
5b3e8eb2
...
...
@@ -60,6 +60,12 @@ UDPLink::UDPLink(QHostAddress host, quint16 port) :
UDPLink
::~
UDPLink
()
{
disconnect
();
// Tell the thread to exit
quit
();
// Wait for it to exit
wait
();
this
->
deleteLater
();
}
...
...
src/uas/QGCMAVLinkUASFactory.cc
View file @
5b3e8eb2
...
...
@@ -132,6 +132,7 @@ UASInterface* QGCMAVLinkUASFactory::createUAS(MAVLinkProtocol* mavlink, LinkInte
UASManager
::
instance
()
->
addUAS
(
uas
);
worker
->
start
(
QThread
::
HighPriority
);
connect
(
uas
,
SIGNAL
(
destroyed
()),
worker
,
SLOT
(
quit
()));
return
uas
;
}
src/uas/UAS.cc
View file @
5b3e8eb2
...
...
@@ -172,7 +172,6 @@ UAS::UAS(MAVLinkProtocol* protocol, int id) : UASInterface(),
componentMulti
[
i
]
=
false
;
}
// Store a list of available actions for this UAS.
// Basically everything exposted as a SLOT with no return value or arguments.
...
...
src/ui/MAVLinkDecoder.cc
View file @
5b3e8eb2
...
...
@@ -2,7 +2,7 @@
#include "UASManager.h"
MAVLinkDecoder
::
MAVLinkDecoder
(
MAVLinkProtocol
*
protocol
,
QObject
*
parent
)
:
QThread
(
parent
)
QThread
()
{
// We're doing it wrong - because the Qt folks got the API wrong:
// http://blog.qt.digia.com/blog/2010/06/17/youre-doing-it-wrong/
...
...
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