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
99665bcc
Commit
99665bcc
authored
Nov 16, 2019
by
DonLakeFlyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parent
bb6768d8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
11 deletions
+13
-11
ADSBVehicleManager.cc
src/ADSB/ADSBVehicleManager.cc
+10
-9
ADSBVehicleManager.h
src/ADSB/ADSBVehicleManager.h
+3
-2
No files found.
src/ADSB/ADSBVehicleManager.cc
View file @
99665bcc
...
...
@@ -31,7 +31,8 @@ void ADSBVehicleManager::setToolbox(QGCToolbox* toolbox)
ADSBVehicleManagerSettings
*
settings
=
qgcApp
()
->
toolbox
()
->
settingsManager
()
->
adsbVehicleManagerSettings
();
if
(
settings
->
adsbServerConnectEnabled
()
->
rawValue
().
toBool
())
{
_tcpLink
=
new
ADSBTCPLink
(
settings
->
adsbServerHostAddress
()
->
rawValue
().
toString
(),
settings
->
adsbServerPort
()
->
rawValue
().
toInt
(),
this
);
connect
(
_tcpLink
,
&
ADSBTCPLink
::
adsbVehicleUpdate
,
this
,
&
ADSBVehicleManager
::
adsbVehicleUpdate
,
Qt
::
QueuedConnection
);
connect
(
_tcpLink
,
&
ADSBTCPLink
::
adsbVehicleUpdate
,
this
,
&
ADSBVehicleManager
::
adsbVehicleUpdate
,
Qt
::
QueuedConnection
);
connect
(
_tcpLink
,
&
ADSBTCPLink
::
error
,
this
,
&
ADSBVehicleManager
::
_tcpError
,
Qt
::
QueuedConnection
);
}
}
...
...
@@ -63,6 +64,12 @@ void ADSBVehicleManager::adsbVehicleUpdate(const ADSBVehicle::VehicleInfo_t vehi
}
}
void
ADSBVehicleManager
::
_tcpError
(
const
QString
errorMsg
)
{
qgcApp
()
->
showMessage
(
tr
(
"ADSB Server Error: %1"
).
arg
(
errorMsg
));
}
ADSBTCPLink
::
ADSBTCPLink
(
const
QString
&
hostAddress
,
int
port
,
QObject
*
parent
)
:
QThread
(
parent
)
,
_hostAddress
(
hostAddress
)
...
...
@@ -95,11 +102,12 @@ void ADSBTCPLink::_hardwareConnect()
QObject
::
connect
(
_socket
,
&
QTcpSocket
::
readyRead
,
this
,
&
ADSBTCPLink
::
_readBytes
);
_socket
->
connectToHost
(
_hostAddress
,
_port
);
_socket
->
connectToHost
(
_hostAddress
,
static_cast
<
quint16
>
(
_port
)
);
// Give the socket a second to connect to the other side otherwise error out
if
(
!
_socket
->
waitForConnected
(
1000
))
{
qCDebug
(
ADSBVehicleManagerLog
)
<<
"ADSB Socket failed to connect"
;
emit
error
(
_socket
->
errorString
());
delete
_socket
;
_socket
=
nullptr
;
return
;
...
...
@@ -116,13 +124,6 @@ void ADSBTCPLink::_readBytes(void)
}
}
void
ADSBTCPLink
::
_socketError
(
QAbstractSocket
::
SocketError
socketError
)
{
QString
error
=
_socket
->
errorString
();
qDebug
()
<<
_socket
->
errorString
();
}
void
ADSBTCPLink
::
_parseLine
(
const
QString
&
line
)
{
if
(
line
.
startsWith
(
QStringLiteral
(
"MSG"
)))
{
...
...
src/ADSB/ADSBVehicleManager.h
View file @
99665bcc
...
...
@@ -30,13 +30,13 @@ public:
signals:
void
adsbVehicleUpdate
(
const
ADSBVehicle
::
VehicleInfo_t
vehicleInfo
);
void
error
(
const
QString
errorMsg
);
protected:
void
run
(
void
)
final
;
private
slots
:
void
_readBytes
(
void
);
void
_socketError
(
QAbstractSocket
::
SocketError
socketError
);
private:
void
_hardwareConnect
(
void
);
...
...
@@ -61,7 +61,8 @@ public:
void
setToolbox
(
QGCToolbox
*
toolbox
)
final
;
public
slots
:
void
adsbVehicleUpdate
(
const
ADSBVehicle
::
VehicleInfo_t
vehicleInfo
);
void
adsbVehicleUpdate
(
const
ADSBVehicle
::
VehicleInfo_t
vehicleInfo
);
void
_tcpError
(
const
QString
errorMsg
);
private
slots
:
void
_cleanupStaleVehicles
(
void
);
...
...
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