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
14ab96cd
Commit
14ab96cd
authored
Aug 26, 2020
by
DonLakeFlyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parent
efd714cb
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
109 additions
and
78 deletions
+109
-78
CompInfoParam.cc
src/Vehicle/CompInfoParam.cc
+42
-14
CompInfoParam.h
src/Vehicle/CompInfoParam.h
+3
-0
MockLink.Parameter.MetaData.json
src/comm/MockLink.Parameter.MetaData.json
+64
-64
No files found.
src/Vehicle/CompInfoParam.cc
View file @
14ab96cd
...
...
@@ -76,30 +76,58 @@ void CompInfoParam::setJson(const QString& metadataJsonFileName, const QString&
}
FactMetaData
*
newMetaData
=
FactMetaData
::
createFromJsonObject
(
parameterValue
.
toObject
(),
emptyDefineMap
,
this
);
QRegularExpression
regexNameIncludesRegex
(
"/
\\
(.+
\\
)/"
);
QRegularExpressionMatch
match
=
regexNameIncludesRegex
.
match
(
newMetaData
->
name
());
if
(
match
.
hasMatch
())
{
QString
regexParamName
=
newMetaData
->
name
();
regexParamName
.
replace
(
QRegularExpression
(
"/(
\\
(.+
\\
))/"
),
"
\\
1"
);
newMetaData
->
setName
(
regexParamName
);
_regexNameMetaDataList
.
append
(
RegexFactMetaDataPair_t
(
newMetaData
->
name
(),
newMetaData
));
}
else
{
_nameToMetaDataMap
[
newMetaData
->
name
()]
=
newMetaData
;
}
}
}
FactMetaData
*
CompInfoParam
::
factMetaDataForName
(
const
QString
&
name
,
FactMetaData
::
ValueType_t
type
)
{
FactMetaData
*
factMetaData
=
nullptr
;
if
(
_opaqueParameterMetaData
)
{
return
vehicle
->
firmwarePlugin
()
->
_getMetaDataForFact
(
_opaqueParameterMetaData
,
name
,
type
,
vehicle
->
vehicleType
());
factMetaData
=
vehicle
->
firmwarePlugin
()
->
_getMetaDataForFact
(
_opaqueParameterMetaData
,
name
,
type
,
vehicle
->
vehicleType
());
}
else
{
if
(
_nameToMetaDataMap
.
contains
(
name
))
{
factMetaData
=
_nameToMetaDataMap
[
name
];
}
else
{
QString
indexTagName
=
name
;
if
(
!
_nameToMetaDataMap
.
contains
(
name
))
{
// Checked for indexed parameter names: "FOO<#>_BAR" will match "FOO1_BAR"
QRegularExpression
regex
(
"
\\
d+"
);
indexTagName
=
indexTagName
.
replace
(
regex
,
_parameterIndexTag
);
if
(
!
_nameToMetaDataMap
.
contains
(
indexTagName
))
{
indexTagName
.
clear
();
for
(
int
i
=
0
;
i
<
_regexNameMetaDataList
.
count
();
i
++
)
{
const
RegexFactMetaDataPair_t
&
pair
=
_regexNameMetaDataList
[
i
];
QString
regexParamName
=
pair
.
first
;
QRegularExpression
regex
(
regexParamName
);
QRegularExpressionMatch
match
=
regex
.
match
(
name
);
QStringList
captured
=
match
.
capturedTexts
();
if
(
captured
.
count
()
==
2
)
{
factMetaData
=
new
FactMetaData
(
*
pair
.
second
,
this
);
factMetaData
->
setName
(
name
);
QString
shortDescription
=
factMetaData
->
shortDescription
();
shortDescription
.
replace
(
"/1"
,
captured
[
1
]);
factMetaData
->
setShortDescription
(
shortDescription
);
QString
longDescription
=
factMetaData
->
shortDescription
();
longDescription
.
replace
(
"/1"
,
captured
[
1
]);
factMetaData
->
setLongDescription
(
longDescription
);
}
}
if
(
indexTagName
.
isEmpty
())
{
indexTagName
=
name
;
_nameToMetaDataMap
[
name
]
=
new
FactMetaData
(
type
,
this
);
if
(
!
factMetaData
)
{
factMetaData
=
new
FactMetaData
(
type
,
this
);
}
_nameToMetaDataMap
[
name
]
=
factMetaData
;
}
return
_nameToMetaDataMap
[
indexTagName
];
}
return
factMetaData
;
}
bool
CompInfoParam
::
_isParameterVolatile
(
const
QString
&
name
)
...
...
src/Vehicle/CompInfoParam.h
View file @
14ab96cd
...
...
@@ -44,8 +44,11 @@ private:
static
FirmwarePlugin
*
_anyVehicleTypeFirmwarePlugin
(
MAV_AUTOPILOT
firmwareType
);
static
QString
_parameterMetaDataFile
(
Vehicle
*
vehicle
,
MAV_AUTOPILOT
firmwareType
,
int
wantedMajorVersion
,
int
&
majorVersion
,
int
&
minorVersion
);
typedef
QPair
<
QString
/* regexName */
,
FactMetaData
*>
RegexFactMetaDataPair_t
;
bool
_noJsonMetadata
=
true
;
FactMetaData
::
NameToMetaDataMap_t
_nameToMetaDataMap
;
QList
<
RegexFactMetaDataPair_t
>
_regexNameMetaDataList
;
QObject
*
_opaqueParameterMetaData
=
nullptr
;
static
const
char
*
_cachedMetaDataFilePrefix
;
...
...
src/comm/MockLink.Parameter.MetaData.json
View file @
14ab96cd
This diff is collapsed.
Click to expand it.
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