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
6228c751
Commit
6228c751
authored
Sep 07, 2012
by
Lorenz Meier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed link forwarding
parent
e6bf7fab
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
6 deletions
+31
-6
MAVLinkProtocol.cc
src/comm/MAVLinkProtocol.cc
+25
-2
MAVLinkProtocol.h
src/comm/MAVLinkProtocol.h
+3
-1
UDPLink.cc
src/comm/UDPLink.cc
+0
-2
MAVLinkSettingsWidget.cc
src/ui/MAVLinkSettingsWidget.cc
+3
-1
No files found.
src/comm/MAVLinkProtocol.cc
View file @
6228c751
...
...
@@ -429,7 +429,7 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
{
// Only forward this message to the other links,
// not the link the message was received on
if
(
currLink
!=
link
)
sendMessage
(
currLink
,
message
);
if
(
currLink
!=
link
)
sendMessage
(
currLink
,
message
,
message
.
sysid
,
message
.
compid
);
}
}
}
...
...
@@ -475,7 +475,7 @@ void MAVLinkProtocol::sendMessage(mavlink_message_t message)
for
(
i
=
links
.
begin
();
i
!=
links
.
end
();
++
i
)
{
sendMessage
(
*
i
,
message
);
//
qDebug() << __FILE__ << __LINE__ << "SENT MESSAGE OVER" << ((LinkInterface*)*i)->getName() << "LIST SIZE:" << links.size();
qDebug
()
<<
__FILE__
<<
__LINE__
<<
"SENT MESSAGE OVER"
<<
((
LinkInterface
*
)
*
i
)
->
getName
()
<<
"LIST SIZE:"
<<
links
.
size
();
}
}
...
...
@@ -500,6 +500,29 @@ void MAVLinkProtocol::sendMessage(LinkInterface* link, mavlink_message_t message
}
}
/**
* @param link the link to send the message over
* @param message message to send
* @param systemid id of the system the message is originating from
* @param componentid id of the component the message is originating from
*/
void
MAVLinkProtocol
::
sendMessage
(
LinkInterface
*
link
,
mavlink_message_t
message
,
quint8
systemid
,
quint8
componentid
)
{
// Create buffer
static
uint8_t
buffer
[
MAVLINK_MAX_PACKET_LEN
];
// Rewriting header to ensure correct link ID is set
static
uint8_t
messageKeys
[
256
]
=
MAVLINK_MESSAGE_CRCS
;
if
(
link
->
getId
()
!=
0
)
mavlink_finalize_message_chan
(
&
message
,
systemid
,
componentid
,
link
->
getId
(),
message
.
len
,
messageKeys
[
message
.
msgid
]);
// Write message into buffer, prepending start sign
int
len
=
mavlink_msg_to_send_buffer
(
buffer
,
&
message
);
// If link is connected
if
(
link
->
isConnected
())
{
// Send the portion of the buffer now occupied by the message
link
->
writeBytes
((
const
char
*
)
buffer
,
len
);
}
}
/**
* The heartbeat is sent out of order and does not reset the
* periodic heartbeat emission. It will be just sent in addition.
...
...
src/comm/MAVLinkProtocol.h
View file @
6228c751
...
...
@@ -130,8 +130,10 @@ public slots:
void
receiveBytes
(
LinkInterface
*
link
,
QByteArray
b
);
/** @brief Send MAVLink message through serial interface */
void
sendMessage
(
mavlink_message_t
message
);
/** @brief Send MAVLink message
through serial interface
*/
/** @brief Send MAVLink message */
void
sendMessage
(
LinkInterface
*
link
,
mavlink_message_t
message
);
/** @brief Send MAVLink message with correct system / component ID */
void
sendMessage
(
LinkInterface
*
link
,
mavlink_message_t
message
,
quint8
systemid
,
quint8
componentid
);
/** @brief Set the rate at which heartbeats are emitted */
void
setHeartbeatRate
(
int
rate
);
/** @brief Set the system id of this application */
...
...
src/comm/UDPLink.cc
View file @
6228c751
...
...
@@ -123,11 +123,9 @@ void UDPLink::addHost(const QString& host)
}
}
hosts
.
append
(
address
);
this
->
setAddress
(
address
);
//qDebug() << "Address:" << address.toString();
// Set port according to user input
ports
.
append
(
host
.
split
(
":"
).
last
().
toInt
());
this
->
setPort
(
host
.
split
(
":"
).
last
().
toInt
());
}
}
else
...
...
src/ui/MAVLinkSettingsWidget.cc
View file @
6228c751
...
...
@@ -186,9 +186,11 @@ void MAVLinkSettingsWidget::chooseLogfileName()
void
MAVLinkSettingsWidget
::
enableDroneOS
(
bool
enable
)
{
// Enable multiplexing
protocol
->
enableMultiplexing
(
enable
);
// Get current selected host and port
QString
hostString
=
m_ui
->
droneOSComboBox
->
currentText
();
QString
host
=
hostString
.
split
(
":"
).
first
();
//
QString host = hostString.split(":").first();
// Delete from all lists first
UDPLink
*
firstUdp
=
NULL
;
...
...
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