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
ed807d4f
Commit
ed807d4f
authored
Dec 04, 2014
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mock param mgr is created with full set of params
parent
9d20690a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
1 deletion
+53
-1
MockQGCUASParamManager.cc
src/qgcunittest/MockQGCUASParamManager.cc
+51
-1
MockQGCUASParamManager.h
src/qgcunittest/MockQGCUASParamManager.h
+2
-0
No files found.
src/qgcunittest/MockQGCUASParamManager.cc
View file @
ed807d4f
...
...
@@ -22,6 +22,8 @@
======================================================================*/
#include "MockQGCUASParamManager.h"
#include "mavlink.h"
#include <QTest>
#include <QDebug>
...
...
@@ -29,7 +31,7 @@ Q_LOGGING_CATEGORY(MockQGCUASParamManagerLog, "MockQGCUASParamManagerLog")
MockQGCUASParamManager
::
MockQGCUASParamManager
(
void
)
{
_loadParams
();
}
bool
MockQGCUASParamManager
::
getParameterValue
(
int
component
,
const
QString
&
parameter
,
QVariant
&
value
)
const
...
...
@@ -52,3 +54,51 @@ void MockQGCUASParamManager::setParameter(int component, QString parameterName,
_mapParams
[
parameterName
]
=
value
;
emit
parameterUpdated
(
_defaultComponentId
,
parameterName
,
value
);
}
void
MockQGCUASParamManager
::
_loadParams
(
void
)
{
QFile
paramFile
(
":/unittest/MockLink.param"
);
bool
success
=
paramFile
.
open
(
QFile
::
ReadOnly
);
Q_UNUSED
(
success
);
Q_ASSERT
(
success
);
QTextStream
paramStream
(
&
paramFile
);
while
(
!
paramStream
.
atEnd
())
{
QString
line
=
paramStream
.
readLine
();
if
(
line
.
startsWith
(
"#"
))
{
continue
;
}
QStringList
paramData
=
line
.
split
(
"
\t
"
);
Q_ASSERT
(
paramData
.
count
()
==
5
);
QString
paramName
=
paramData
.
at
(
2
);
QString
valStr
=
paramData
.
at
(
3
);
uint
paramType
=
paramData
.
at
(
4
).
toUInt
();
QVariant
paramValue
;
switch
(
paramType
)
{
case
MAV_PARAM_TYPE_REAL32
:
paramValue
=
QVariant
(
valStr
.
toFloat
());
break
;
case
MAV_PARAM_TYPE_UINT32
:
paramValue
=
QVariant
(
valStr
.
toUInt
());
break
;
case
MAV_PARAM_TYPE_INT32
:
paramValue
=
QVariant
(
valStr
.
toInt
());
break
;
case
MAV_PARAM_TYPE_INT8
:
paramValue
=
QVariant
((
unsigned
char
)
valStr
.
toUInt
());
break
;
default:
Q_ASSERT
(
false
);
break
;
}
Q_ASSERT
(
!
_mapParams
.
contains
(
paramName
));
_mapParams
[
paramName
]
=
paramValue
;
}
}
src/qgcunittest/MockQGCUASParamManager.h
View file @
ed807d4f
...
...
@@ -97,6 +97,8 @@ public slots:
virtual
void
copyPersistentParamsToVolatile
()
{
Q_ASSERT
(
false
);
}
private:
void
_loadParams
(
void
);
ParamMap_t
_mapParams
;
static
const
int
_defaultComponentId
=
50
;
...
...
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