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
587bf78a
Commit
587bf78a
authored
Jun 25, 2014
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mock mavlink plugin support
parent
23c77aef
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
4 deletions
+23
-4
MockUAS.cc
src/qgcunittest/MockUAS.cc
+13
-1
MockUAS.h
src/qgcunittest/MockUAS.h
+10
-3
No files found.
src/qgcunittest/MockUAS.cc
View file @
587bf78a
...
...
@@ -27,7 +27,8 @@ QString MockUAS::_bogusStaticString;
MockUAS
::
MockUAS
(
void
)
:
_systemType
(
MAV_TYPE_QUADROTOR
),
_systemId
(
1
)
_systemId
(
1
),
_mavlinkPlugin
(
NULL
)
{
}
...
...
@@ -41,4 +42,15 @@ void MockUAS::setMockParametersAndSignal(MockQGCUASParamManager::ParamMap_t& map
i
.
next
();
emit
parameterChanged
(
_systemId
,
0
,
i
.
key
(),
i
.
value
());
}
}
void
MockUAS
::
sendMessage
(
mavlink_message_t
message
)
{
Q_UNUSED
(
link
);
if
(
!
_mavlinkPlugin
)
{
Q_ASSERT
(
false
);
}
_mavlinkPlugin
->
sendMessage
(
message
);
}
\ No newline at end of file
src/qgcunittest/MockUAS.h
View file @
587bf78a
...
...
@@ -26,6 +26,7 @@
#include "UASInterface.h"
#include "MockQGCUASParamManager.h"
#include "MockMavlinkInterface.h"
#include <limits>
...
...
@@ -50,6 +51,9 @@ public:
virtual
int
getUASID
(
void
)
const
{
return
_systemId
;
}
virtual
QGCUASParamManagerInterface
*
getParamManager
()
{
return
&
_paramManager
;
};
// sendMessage is only supported if a mavlink plugin is installed.
virtual
void
sendMessage
(
mavlink_message_t
message
);
public:
// MockUAS methods
MockUAS
(
void
);
...
...
@@ -63,12 +67,15 @@ public:
/// allows you to simulate parameter input and validate parameter setting
MockQGCUASParamManager
*
getMockQGCUASParamManager
(
void
)
{
return
&
_paramManager
;
}
/// Sets the parameter map into the mock QGCUASParamManager and signals parameterChanged for
///
@brief
Sets the parameter map into the mock QGCUASParamManager and signals parameterChanged for
/// each param
void
setMockParametersAndSignal
(
MockQGCUASParamManager
::
ParamMap_t
&
map
);
void
emitRemoteControlChannelRawChanged
(
int
channel
,
float
raw
)
{
emit
remoteControlChannelRawChanged
(
channel
,
raw
);
}
/// @brief Installs a mavlink plugin. Only a single mavlink plugin is supported at a time.
void
setMockMavlinkPlugin
(
MockMavlinkInterface
*
mavlinkPlugin
)
{
_mavlinkPlugin
=
mavlinkPlugin
;
};
public:
// Unimplemented UASInterface overrides
virtual
QString
getUASName
()
const
{
Q_ASSERT
(
false
);
return
_bogusString
;
};
...
...
@@ -113,8 +120,6 @@ public:
/** @brief Send a message over this link (to this or to all UAS on this link) */
virtual
void
sendMessage
(
LinkInterface
*
link
,
mavlink_message_t
message
){
Q_UNUSED
(
link
);
Q_UNUSED
(
message
);
Q_ASSERT
(
false
);
}
/** @brief Send a message over all links this UAS can be reached with (!= all links) */
virtual
void
sendMessage
(
mavlink_message_t
message
)
{
Q_UNUSED
(
link
);
Q_UNUSED
(
message
);
Q_ASSERT
(
false
);
}
virtual
QString
getAutopilotTypeName
()
{
Q_ASSERT
(
false
);
return
_bogusString
;
};
virtual
void
setAutopilotType
(
int
apType
)
{
Q_UNUSED
(
apType
);
Q_ASSERT
(
false
);
};
virtual
QMap
<
int
,
QString
>
getComponents
()
{
Q_ASSERT
(
false
);
return
_bogusMapIntQString
;
};
...
...
@@ -182,6 +187,8 @@ private:
int
_systemId
;
MockQGCUASParamManager
_paramManager
;
MockMavlinkInterface
*
_mavlinkPlugin
;
///< Mock Mavlink plugin, NULL for none
// Bogus variables used for return types of NYI methods
QString
_bogusString
;
...
...
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