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
7bf37616
Commit
7bf37616
authored
May 20, 2020
by
Jacob Dahl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moved mavlink forwarding logic to MAVLinkProtocol:receiveBytes
parent
66590562
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
16 deletions
+15
-16
LinkManager.cc
src/comm/LinkManager.cc
+0
-15
MAVLinkProtocol.cc
src/comm/MAVLinkProtocol.cc
+14
-0
UDPLink.cc
src/comm/UDPLink.cc
+1
-1
No files found.
src/comm/LinkManager.cc
View file @
7bf37616
...
@@ -1016,21 +1016,6 @@ void LinkManager::_freeMavlinkChannel(int channel)
...
@@ -1016,21 +1016,6 @@ void LinkManager::_freeMavlinkChannel(int channel)
void
LinkManager
::
_mavlinkMessageReceived
(
LinkInterface
*
link
,
mavlink_message_t
message
)
{
void
LinkManager
::
_mavlinkMessageReceived
(
LinkInterface
*
link
,
mavlink_message_t
message
)
{
link
->
startMavlinkMessagesTimer
(
message
.
sysid
);
link
->
startMavlinkMessagesTimer
(
message
.
sysid
);
// Walk the list of Links. If mavlink forwarding is enabled for a given link then send the data out.
for
(
int
i
=
0
;
i
<
_sharedLinks
.
count
();
i
++
)
{
LinkConfiguration
*
linkConfig
=
_sharedLinks
[
i
]
->
getLinkConfiguration
();
bool
isUniqueLink
=
linkConfig
->
link
()
!=
link
;
// We do not want to send messages back on the link from which they originated
bool
forwardMavlink
=
isUniqueLink
&&
linkConfig
->
isForwardMavlink
();
if
(
forwardMavlink
)
{
qCDebug
(
LinkManagerLog
)
<<
"Forwarding mavlink packet"
;
uint8_t
buffer
[
MAVLINK_MAX_PACKET_LEN
];
int
len
=
mavlink_msg_to_send_buffer
(
buffer
,
&
message
);
_sharedLinks
[
i
]
->
writeBytesSafe
((
const
char
*
)
buffer
,
len
);
}
}
}
}
LogReplayLink
*
LinkManager
::
startLogReplay
(
const
QString
&
logFile
)
LogReplayLink
*
LinkManager
::
startLogReplay
(
const
QString
&
logFile
)
...
...
src/comm/MAVLinkProtocol.cc
View file @
7bf37616
...
@@ -208,6 +208,20 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
...
@@ -208,6 +208,20 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
return
;
return
;
}
}
// Walk the list of Links. If mavlink forwarding is enabled for a given link then send the data out.
QList
<
LinkInterface
*>
links
=
_linkMgr
->
links
();
for
(
int
i
=
0
;
i
<
links
.
count
();
i
++
)
{
LinkConfiguration
*
linkConfig
=
links
[
i
]
->
getLinkConfiguration
();
bool
isUniqueLink
=
links
[
i
]
!=
link
;
// We do not want to send messages back on the link from which they originated
bool
forwardMavlink
=
isUniqueLink
&&
linkConfig
->
isForwardMavlink
();
if
(
forwardMavlink
)
{
qDebug
()
<<
"Forwarding mavlink packet on: "
<<
linkConfig
->
name
();
links
[
i
]
->
writeBytesSafe
(
b
.
data
(),
b
.
length
());
}
}
uint8_t
mavlinkChannel
=
link
->
mavlinkChannel
();
uint8_t
mavlinkChannel
=
link
->
mavlinkChannel
();
static
int
nonmavlinkCount
=
0
;
static
int
nonmavlinkCount
=
0
;
...
...
src/comm/UDPLink.cc
View file @
7bf37616
...
@@ -185,7 +185,7 @@ void UDPLink::_writeBytes(const QByteArray data)
...
@@ -185,7 +185,7 @@ void UDPLink::_writeBytes(const QByteArray data)
void
UDPLink
::
_writeDataGram
(
const
QByteArray
data
,
const
UDPCLient
*
target
)
void
UDPLink
::
_writeDataGram
(
const
QByteArray
data
,
const
UDPCLient
*
target
)
{
{
//qDebug() << "UDP Out" << target->address << target->port;
//
qDebug() << "UDP Out" << target->address << target->port;
if
(
_socket
->
writeDatagram
(
data
,
target
->
address
,
target
->
port
)
<
0
)
{
if
(
_socket
->
writeDatagram
(
data
,
target
->
address
,
target
->
port
)
<
0
)
{
qWarning
()
<<
"Error writing to"
<<
target
->
address
<<
target
->
port
;
qWarning
()
<<
"Error writing to"
<<
target
->
address
<<
target
->
port
;
}
else
{
}
else
{
...
...
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