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
7fb7aa16
Commit
7fb7aa16
authored
Nov 15, 2019
by
DonLakeFlyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parent
44fa02aa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
9 deletions
+11
-9
ADSBVehicleManager.cc
src/ADSB/ADSBVehicleManager.cc
+7
-6
ADSBVehicleManager.h
src/ADSB/ADSBVehicleManager.h
+4
-3
No files found.
src/ADSB/ADSBVehicleManager.cc
View file @
7fb7aa16
...
...
@@ -30,7 +30,7 @@ void ADSBVehicleManager::setToolbox(QGCToolbox* toolbox)
ADSBVehicleManagerSettings
*
settings
=
qgcApp
()
->
toolbox
()
->
settingsManager
()
->
adsbVehicleManagerSettings
();
if
(
settings
->
adsbServerConnectEnabled
()
->
rawValue
().
toBool
())
{
_tcpLink
=
new
ADSBTCPLink
(
this
);
_tcpLink
=
new
ADSBTCPLink
(
settings
->
adsbServerHostAddress
()
->
rawValue
().
toString
(),
settings
->
adsbServerPort
()
->
rawValue
().
toInt
(),
this
);
connect
(
_tcpLink
,
&
ADSBTCPLink
::
adsbVehicleUpdate
,
this
,
&
ADSBVehicleManager
::
adsbVehicleUpdate
,
Qt
::
QueuedConnection
);
}
}
...
...
@@ -41,6 +41,7 @@ void ADSBVehicleManager::_cleanupStaleVehicles()
for
(
int
i
=
_adsbVehicles
.
count
()
-
1
;
i
>=
0
;
i
--
)
{
ADSBVehicle
*
adsbVehicle
=
_adsbVehicles
.
value
<
ADSBVehicle
*>
(
i
);
if
(
adsbVehicle
->
expired
())
{
qCDebug
(
ADSBVehicleManagerLog
)
<<
"Expired"
<<
QStringLiteral
(
"%1"
).
arg
(
adsbVehicle
->
icaoAddress
(),
0
,
16
);
_adsbVehicles
.
removeAt
(
i
);
adsbVehicle
->
deleteLater
();
}
...
...
@@ -62,10 +63,11 @@ void ADSBVehicleManager::adsbVehicleUpdate(const ADSBVehicle::VehicleInfo_t vehi
}
}
ADSBTCPLink
::
ADSBTCPLink
(
QObject
*
parent
)
:
QThread
(
parent
)
ADSBTCPLink
::
ADSBTCPLink
(
const
QString
&
hostAddress
,
int
port
,
QObject
*
parent
)
:
QThread
(
parent
)
,
_hostAddress
(
hostAddress
)
,
_port
(
port
)
{
_settings
=
qgcApp
()
->
toolbox
()
->
settingsManager
()
->
adsbVehicleManagerSettings
();
moveToThread
(
this
);
start
();
}
...
...
@@ -74,7 +76,6 @@ ADSBTCPLink::~ADSBTCPLink(void)
{
if
(
_socket
)
{
_socket
->
disconnectFromHost
();
_socket
->
waitForDisconnected
();
_socket
->
deleteLater
();
_socket
=
nullptr
;
}
...
...
@@ -94,7 +95,7 @@ void ADSBTCPLink::_hardwareConnect()
QObject
::
connect
(
_socket
,
&
QTcpSocket
::
readyRead
,
this
,
&
ADSBTCPLink
::
_readBytes
);
_socket
->
connectToHost
(
_
settings
->
adsbServerHostAddress
()
->
rawValue
().
toString
(),
_settings
->
adsbServerPort
()
->
rawValue
().
toInt
()
);
_socket
->
connectToHost
(
_
hostAddress
,
_port
);
// Give the socket a second to connect to the other side otherwise error out
if
(
!
_socket
->
waitForConnected
(
1000
))
{
...
...
src/ADSB/ADSBVehicleManager.h
View file @
7fb7aa16
...
...
@@ -25,7 +25,7 @@ class ADSBTCPLink : public QThread
Q_OBJECT
public:
ADSBTCPLink
(
QObject
*
parent
);
ADSBTCPLink
(
const
QString
&
hostAddress
,
int
port
,
QObject
*
parent
);
~
ADSBTCPLink
();
signals:
...
...
@@ -42,8 +42,9 @@ private:
void
_hardwareConnect
(
void
);
void
_parseLine
(
const
QString
&
line
);
QTcpSocket
*
_socket
=
nullptr
;
ADSBVehicleManagerSettings
*
_settings
=
nullptr
;
QString
_hostAddress
;
int
_port
;
QTcpSocket
*
_socket
=
nullptr
;
};
class
ADSBVehicleManager
:
public
QGCTool
{
...
...
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