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
e79c7162
Commit
e79c7162
authored
Dec 24, 2014
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix generic metadata loading
parent
c041e95b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
7 deletions
+14
-7
FactLoader.cc
src/FactSystem/FactLoader.cc
+14
-7
No files found.
src/FactSystem/FactLoader.cc
View file @
e79c7162
...
...
@@ -82,18 +82,18 @@ void FactLoader::_parameterChanged(int uas, int component, QString parameterName
Q_ASSERT
(
component
==
_lastSeenComponent
);
}
bool
setMetaData
=
false
;
if
(
!
_mapParameterName2Variant
.
contains
(
parameterName
))
{
qCDebug
(
FactLoaderLog
)
<<
"Adding new fact"
<<
parameterName
;
Fact
*
fact
=
new
Fact
(
parameterName
,
this
);
setMetaData
=
true
;
_mapParameterName2Variant
[
parameterName
]
=
QVariant
::
fromValue
(
fact
);
_mapFact2ParameterName
[
fact
]
=
parameterName
;
// We need to know when the fact changes from QML so that we can send the new value to the parameter manager
connect
(
fact
,
&
Fact
::
_containerValueChanged
,
this
,
&
FactLoader
::
_valueUpdated
);
_addMetaDataToFact
(
fact
);
}
Q_ASSERT
(
_mapParameterName2Variant
.
contains
(
parameterName
));
...
...
@@ -103,6 +103,10 @@ void FactLoader::_parameterChanged(int uas, int component, QString parameterName
Fact
*
fact
=
_mapParameterName2Variant
[
parameterName
].
value
<
Fact
*>
();
Q_ASSERT
(
fact
);
fact
->
_containerSetValue
(
value
);
if
(
setMetaData
)
{
_addMetaDataToFact
(
fact
);
}
}
/// Connected to Fact::valueUpdated
...
...
@@ -122,23 +126,26 @@ void FactLoader::_valueUpdated(QVariant value)
case
FactMetaData
:
:
valueTypeInt8
:
case
FactMetaData
:
:
valueTypeInt16
:
case
FactMetaData
:
:
valueTypeInt32
:
typedValue
=
QVariant
(
value
.
value
<
int
>
());
typedValue
.
setValue
(
QVariant
(
value
.
toInt
()));
break
;
case
FactMetaData
:
:
valueTypeUint8
:
case
FactMetaData
:
:
valueTypeUint16
:
case
FactMetaData
:
:
valueTypeUint32
:
typedValue
=
QVariant
(
value
.
value
<
uint
>
());
typedValue
.
setValue
(
value
.
toUInt
());
break
;
case
FactMetaData
:
:
valueTypeFloat
:
typedValue
=
QVariant
(
value
.
toFloat
());
typedValue
.
setValue
(
value
.
toFloat
());
break
;
case
FactMetaData
:
:
valueTypeDouble
:
typedValue
=
QVariant
(
value
.
toDouble
());
typedValue
.
setValue
(
value
.
toDouble
());
break
;
}
qCDebug
(
FactLoaderLog
)
<<
"Set parameter"
<<
fact
->
name
()
<<
typedValue
;
_paramMgr
->
setParameter
(
_lastSeenComponent
,
_mapFact2ParameterName
[
fact
],
typedValue
);
_paramMgr
->
sendPendingParameters
(
true
/* persistAfterSend */
,
false
/* forceSend */
);
}
...
...
@@ -191,7 +198,7 @@ void FactLoader::_addMetaDataToFact(Fact* fact)
break
;
default:
q
CWarning
(
FactLoaderLog
)
<<
"Invalid variant type"
<<
fact
->
value
().
type
();
q
Warning
()
<<
fact
->
name
(
)
<<
"Invalid variant type"
<<
fact
->
value
().
type
();
break
;
}
...
...
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