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
f8b8503c
Commit
f8b8503c
authored
Aug 01, 2015
by
Lorenz Meier
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1754 from mavlink/uas_threading_fix
UAS: Connect message sending via buffered signals
parents
8113009a
78bdc052
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
0 deletions
+27
-0
UAS.cc
src/uas/UAS.cc
+21
-0
UAS.h
src/uas/UAS.h
+6
-0
No files found.
src/uas/UAS.cc
View file @
f8b8503c
...
...
@@ -165,6 +165,8 @@ UAS::UAS(MAVLinkProtocol* protocol, int id) : UASInterface(),
componentMulti
[
i
]
=
false
;
}
connect
(
this
,
&
UAS
::
_sendMessageOnThread
,
this
,
&
UAS
::
_sendMessage
,
Qt
::
QueuedConnection
);
connect
(
this
,
&
UAS
::
_sendMessageOnThreadLink
,
this
,
&
UAS
::
_sendMessageLink
,
Qt
::
QueuedConnection
);
connect
(
mavlink
,
SIGNAL
(
messageReceived
(
LinkInterface
*
,
mavlink_message_t
)),
&
fileManager
,
SLOT
(
receiveMessage
(
LinkInterface
*
,
mavlink_message_t
)));
// Store a list of available actions for this UAS.
...
...
@@ -1728,6 +1730,15 @@ void UAS::setModeArm(uint8_t newBaseMode, uint32_t newCustomMode)
* @param message that is to be sent
*/
void
UAS
::
sendMessage
(
mavlink_message_t
message
)
{
emit
_sendMessageOnThread
(
message
);
}
/**
* Send a message to every link that is connected.
* @param message that is to be sent
*/
void
UAS
::
_sendMessage
(
mavlink_message_t
message
)
{
if
(
!
LinkManager
::
instance
())
{
...
...
@@ -1756,6 +1767,16 @@ void UAS::sendMessage(mavlink_message_t message)
* @message that is to be sent
*/
void
UAS
::
sendMessage
(
LinkInterface
*
link
,
mavlink_message_t
message
)
{
emit
_sendMessageOnThreadLink
(
link
,
message
);
}
/**
* Send a message to the link that is connected.
* @param link that the message will be sent to
* @message that is to be sent
*/
void
UAS
::
_sendMessageLink
(
LinkInterface
*
link
,
mavlink_message_t
message
)
{
if
(
!
link
)
return
;
// Create buffer
...
...
src/uas/UAS.h
View file @
f8b8503c
...
...
@@ -894,6 +894,8 @@ signals:
void
groundSpeedChanged
(
double
val
,
QString
name
);
void
airSpeedChanged
(
double
val
,
QString
name
);
void
bearingToWaypointChanged
(
double
val
,
QString
name
);
void
_sendMessageOnThread
(
mavlink_message_t
message
);
void
_sendMessageOnThreadLink
(
LinkInterface
*
link
,
mavlink_message_t
message
);
protected:
/** @brief Get the UNIX timestamp in milliseconds, enter microseconds */
quint64
getUnixTime
(
quint64
time
=
0
);
...
...
@@ -924,6 +926,10 @@ protected slots:
void
writeSettings
();
/** @brief Read settings from disk */
void
readSettings
();
/** @brief Send a message over this link (to this or to all UAS on this link) */
void
_sendMessageLink
(
LinkInterface
*
link
,
mavlink_message_t
message
);
/** @brief Send a message over all links this UAS can be reached with (!= all links) */
void
_sendMessage
(
mavlink_message_t
message
);
private
slots
:
void
_linkDisconnected
(
LinkInterface
*
link
);
...
...
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