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
5d435d39
Commit
5d435d39
authored
Feb 24, 2018
by
Gus Grubba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for 64-bit metadata values
parent
eba58fe3
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
129 additions
and
4 deletions
+129
-4
QGCCameraIO.cc
src/Camera/QGCCameraIO.cc
+24
-0
QGCCameraIO.h
src/Camera/QGCCameraIO.h
+3
-0
FactMetaData.cc
src/FactSystem/FactMetaData.cc
+70
-4
FactMetaData.h
src/FactSystem/FactMetaData.h
+2
-0
ParameterManager.cc
src/FactSystem/ParameterManager.cc
+24
-0
APMParameterMetaData.cc
src/FirmwarePlugin/APM/APMParameterMetaData.cc
+4
-0
PX4ParameterMetaData.cc
src/FirmwarePlugin/PX4/PX4ParameterMetaData.cc
+2
-0
No files found.
src/Camera/QGCCameraIO.cc
View file @
5d435d39
...
...
@@ -57,9 +57,18 @@ QGCCameraParamIO::QGCCameraParamIO(QGCCameraControl *control, Fact* fact, Vehicl
case
FactMetaData
:
:
valueTypeUint32
:
_mavParamType
=
MAV_PARAM_EXT_TYPE_UINT32
;
break
;
case
FactMetaData
:
:
valueTypeUint64
:
_mavParamType
=
MAV_PARAM_EXT_TYPE_UINT64
;
break
;
case
FactMetaData
:
:
valueTypeInt64
:
_mavParamType
=
MAV_PARAM_EXT_TYPE_INT64
;
break
;
case
FactMetaData
:
:
valueTypeFloat
:
_mavParamType
=
MAV_PARAM_EXT_TYPE_REAL32
;
break
;
case
FactMetaData
:
:
valueTypeDouble
:
_mavParamType
=
MAV_PARAM_EXT_TYPE_REAL64
;
break
;
//-- String and custom are the same for now
case
FactMetaData
:
:
valueTypeString
:
case
FactMetaData
:
:
valueTypeCustom
:
...
...
@@ -145,9 +154,18 @@ QGCCameraParamIO::_sendParameter()
case
FactMetaData
:
:
valueTypeUint32
:
union_value
.
param_uint32
=
(
uint32_t
)
_fact
->
rawValue
().
toUInt
();
break
;
case
FactMetaData
:
:
valueTypeInt64
:
union_value
.
param_int64
=
(
int64_t
)
_fact
->
rawValue
().
toLongLong
();
break
;
case
FactMetaData
:
:
valueTypeUint64
:
union_value
.
param_uint64
=
(
uint64_t
)
_fact
->
rawValue
().
toULongLong
();
break
;
case
FactMetaData
:
:
valueTypeFloat
:
union_value
.
param_float
=
_fact
->
rawValue
().
toFloat
();
break
;
case
FactMetaData
:
:
valueTypeDouble
:
union_value
.
param_double
=
_fact
->
rawValue
().
toDouble
();
break
;
//-- String and custom are the same for now
case
FactMetaData
:
:
valueTypeString
:
case
FactMetaData
:
:
valueTypeCustom
:
...
...
@@ -282,6 +300,12 @@ QGCCameraParamIO::_valueFromMessage(const char* value, uint8_t param_type)
case
MAV_PARAM_EXT_TYPE_INT32
:
var
=
QVariant
(
u
.
param_int32
);
break
;
case
MAV_PARAM_EXT_TYPE_UINT64
:
var
=
QVariant
(
u
.
param_uint64
);
break
;
case
MAV_PARAM_EXT_TYPE_INT64
:
var
=
QVariant
(
u
.
param_int64
);
break
;
case
MAV_PARAM_EXT_TYPE_CUSTOM
:
var
=
QVariant
(
QByteArray
(
value
,
MAVLINK_MSG_PARAM_EXT_SET_FIELD_PARAM_VALUE_LEN
));
break
;
...
...
src/Camera/QGCCameraIO.h
View file @
5d435d39
...
...
@@ -19,6 +19,9 @@ MAVPACKED(
typedef
struct
{
union
{
float
param_float
;
double
param_double
;
int64_t
param_int64
;
uint64_t
param_uint64
;
int32_t
param_int32
;
uint32_t
param_uint32
;
int16_t
param_int16
;
...
...
src/FactSystem/FactMetaData.cc
View file @
5d435d39
...
...
@@ -254,9 +254,13 @@ QVariant FactMetaData::_minForType(void) const
case
valueTypeInt16
:
return
QVariant
(
std
::
numeric_limits
<
short
int
>::
min
());
case
valueTypeUint32
:
return
QVariant
(
std
::
numeric_limits
<
u
nsigned
in
t
>::
min
());
return
QVariant
(
std
::
numeric_limits
<
u
int32_
t
>::
min
());
case
valueTypeInt32
:
return
QVariant
(
std
::
numeric_limits
<
int
>::
min
());
return
QVariant
(
std
::
numeric_limits
<
int32_t
>::
min
());
case
valueTypeUint64
:
return
QVariant
(
std
::
numeric_limits
<
uint64_t
>::
min
());
case
valueTypeInt64
:
return
QVariant
(
std
::
numeric_limits
<
int64_t
>::
min
());
case
valueTypeFloat
:
return
QVariant
(
-
std
::
numeric_limits
<
float
>::
max
());
case
valueTypeDouble
:
...
...
@@ -287,9 +291,13 @@ QVariant FactMetaData::_maxForType(void) const
case
valueTypeInt16
:
return
QVariant
(
std
::
numeric_limits
<
short
int
>::
max
());
case
valueTypeUint32
:
return
QVariant
(
std
::
numeric_limits
<
u
nsigned
in
t
>::
max
());
return
QVariant
(
std
::
numeric_limits
<
u
int32_
t
>::
max
());
case
valueTypeInt32
:
return
QVariant
(
std
::
numeric_limits
<
int
>::
max
());
return
QVariant
(
std
::
numeric_limits
<
int32_t
>::
max
());
case
valueTypeUint64
:
return
QVariant
(
std
::
numeric_limits
<
uint64_t
>::
max
());
case
valueTypeInt64
:
return
QVariant
(
std
::
numeric_limits
<
int64_t
>::
max
());
case
valueTypeFloat
:
return
QVariant
(
std
::
numeric_limits
<
float
>::
max
());
case
valueTypeElapsedTimeInSeconds
:
...
...
@@ -324,6 +332,14 @@ bool FactMetaData::convertAndValidateRaw(const QVariant& rawValue, bool convertO
}
}
break
;
case
FactMetaData
:
:
valueTypeInt64
:
typedValue
=
QVariant
(
rawValue
.
toLongLong
(
&
convertOk
));
if
(
!
convertOnly
&&
convertOk
)
{
if
(
typedValue
<
rawMin
()
||
typedValue
>
rawMax
())
{
errorString
=
tr
(
"Value must be within %1 and %2"
).
arg
(
rawMin
().
toInt
()).
arg
(
rawMax
().
toInt
());
}
}
break
;
case
FactMetaData
:
:
valueTypeUint8
:
case
FactMetaData
:
:
valueTypeUint16
:
case
FactMetaData
:
:
valueTypeUint32
:
...
...
@@ -334,6 +350,14 @@ bool FactMetaData::convertAndValidateRaw(const QVariant& rawValue, bool convertO
}
}
break
;
case
FactMetaData
:
:
valueTypeUint64
:
typedValue
=
QVariant
(
rawValue
.
toULongLong
(
&
convertOk
));
if
(
!
convertOnly
&&
convertOk
)
{
if
(
typedValue
<
rawMin
()
||
typedValue
>
rawMax
())
{
errorString
=
tr
(
"Value must be within %1 and %2"
).
arg
(
rawMin
().
toUInt
()).
arg
(
rawMax
().
toUInt
());
}
}
break
;
case
FactMetaData
:
:
valueTypeFloat
:
typedValue
=
QVariant
(
rawValue
.
toFloat
(
&
convertOk
));
if
(
!
convertOnly
&&
convertOk
)
{
...
...
@@ -389,6 +413,14 @@ bool FactMetaData::convertAndValidateCooked(const QVariant& cookedValue, bool co
}
}
break
;
case
FactMetaData
:
:
valueTypeInt64
:
typedValue
=
QVariant
(
cookedValue
.
toLongLong
(
&
convertOk
));
if
(
!
convertOnly
&&
convertOk
)
{
if
(
cookedMin
()
>
typedValue
||
typedValue
>
cookedMax
())
{
errorString
=
tr
(
"Value must be within %1 and %2"
).
arg
(
cookedMin
().
toInt
()).
arg
(
cookedMax
().
toInt
());
}
}
break
;
case
FactMetaData
:
:
valueTypeUint8
:
case
FactMetaData
:
:
valueTypeUint16
:
case
FactMetaData
:
:
valueTypeUint32
:
...
...
@@ -399,6 +431,14 @@ bool FactMetaData::convertAndValidateCooked(const QVariant& cookedValue, bool co
}
}
break
;
case
FactMetaData
:
:
valueTypeUint64
:
typedValue
=
QVariant
(
cookedValue
.
toULongLong
(
&
convertOk
));
if
(
!
convertOnly
&&
convertOk
)
{
if
(
cookedMin
()
>
typedValue
||
typedValue
>
cookedMax
())
{
errorString
=
tr
(
"Value must be within %1 and %2"
).
arg
(
cookedMin
().
toUInt
()).
arg
(
cookedMax
().
toUInt
());
}
}
break
;
case
FactMetaData
:
:
valueTypeFloat
:
typedValue
=
QVariant
(
cookedValue
.
toFloat
(
&
convertOk
));
if
(
!
convertOnly
&&
convertOk
)
{
...
...
@@ -453,6 +493,16 @@ bool FactMetaData::clampValue(const QVariant& cookedValue, QVariant& typedValue)
}
}
break
;
case
FactMetaData
:
:
valueTypeInt64
:
typedValue
=
QVariant
(
cookedValue
.
toLongLong
(
&
convertOk
));
if
(
convertOk
)
{
if
(
cookedMin
()
>
typedValue
)
{
typedValue
=
cookedMin
();
}
else
if
(
typedValue
>
cookedMax
())
{
typedValue
=
cookedMax
();
}
}
break
;
case
FactMetaData
:
:
valueTypeUint8
:
case
FactMetaData
:
:
valueTypeUint16
:
case
FactMetaData
:
:
valueTypeUint32
:
...
...
@@ -465,6 +515,16 @@ bool FactMetaData::clampValue(const QVariant& cookedValue, QVariant& typedValue)
}
}
break
;
case
FactMetaData
:
:
valueTypeUint64
:
typedValue
=
QVariant
(
cookedValue
.
toULongLong
(
&
convertOk
));
if
(
convertOk
)
{
if
(
cookedMin
()
>
typedValue
)
{
typedValue
=
cookedMin
();
}
else
if
(
typedValue
>
cookedMax
())
{
typedValue
=
cookedMax
();
}
}
break
;
case
FactMetaData
:
:
valueTypeFloat
:
typedValue
=
QVariant
(
cookedValue
.
toFloat
(
&
convertOk
));
if
(
convertOk
)
{
...
...
@@ -742,6 +802,8 @@ FactMetaData::ValueType_t FactMetaData::stringToType(const QString& typeString,
<<
QStringLiteral
(
"Int16"
)
<<
QStringLiteral
(
"Uint32"
)
<<
QStringLiteral
(
"Int32"
)
<<
QStringLiteral
(
"Uint64"
)
<<
QStringLiteral
(
"Int64"
)
<<
QStringLiteral
(
"Float"
)
<<
QStringLiteral
(
"Double"
)
<<
QStringLiteral
(
"String"
)
...
...
@@ -755,6 +817,8 @@ FactMetaData::ValueType_t FactMetaData::stringToType(const QString& typeString,
<<
valueTypeInt16
<<
valueTypeUint32
<<
valueTypeInt32
<<
valueTypeUint64
<<
valueTypeInt64
<<
valueTypeFloat
<<
valueTypeDouble
<<
valueTypeString
...
...
@@ -789,6 +853,8 @@ size_t FactMetaData::typeToSize(ValueType_t type)
case
valueTypeFloat
:
return
4
;
case
valueTypeUint64
:
case
valueTypeInt64
:
case
valueTypeDouble
:
return
8
;
...
...
src/FactSystem/FactMetaData.h
View file @
5d435d39
...
...
@@ -36,6 +36,8 @@ public:
valueTypeInt16
,
valueTypeUint32
,
valueTypeInt32
,
valueTypeUint64
,
valueTypeInt64
,
valueTypeFloat
,
valueTypeDouble
,
valueTypeString
,
...
...
src/FactSystem/ParameterManager.cc
View file @
5d435d39
...
...
@@ -289,6 +289,12 @@ void ParameterManager::_parameterUpdate(int vehicleId, int componentId, QString
case
MAV_PARAM_TYPE_INT32
:
factType
=
FactMetaData
::
valueTypeInt32
;
break
;
case
MAV_PARAM_TYPE_UINT64
:
factType
=
FactMetaData
::
valueTypeUint64
;
break
;
case
MAV_PARAM_TYPE_INT64
:
factType
=
FactMetaData
::
valueTypeInt64
;
break
;
case
MAV_PARAM_TYPE_REAL32
:
factType
=
FactMetaData
::
valueTypeFloat
;
break
;
...
...
@@ -983,9 +989,18 @@ MAV_PARAM_TYPE ParameterManager::_factTypeToMavType(FactMetaData::ValueType_t fa
case
FactMetaData
:
:
valueTypeUint32
:
return
MAV_PARAM_TYPE_UINT32
;
case
FactMetaData
:
:
valueTypeUint64
:
return
MAV_PARAM_TYPE_UINT64
;
case
FactMetaData
:
:
valueTypeInt64
:
return
MAV_PARAM_TYPE_INT64
;
case
FactMetaData
:
:
valueTypeFloat
:
return
MAV_PARAM_TYPE_REAL32
;
case
FactMetaData
:
:
valueTypeDouble
:
return
MAV_PARAM_TYPE_REAL64
;
default:
qWarning
()
<<
"Unsupported fact type"
<<
factType
;
// fall through
...
...
@@ -1013,9 +1028,18 @@ FactMetaData::ValueType_t ParameterManager::_mavTypeToFactType(MAV_PARAM_TYPE ma
case
MAV_PARAM_TYPE_UINT32
:
return
FactMetaData
::
valueTypeUint32
;
case
MAV_PARAM_TYPE_UINT64
:
return
FactMetaData
::
valueTypeUint64
;
case
MAV_PARAM_TYPE_INT64
:
return
FactMetaData
::
valueTypeInt64
;
case
MAV_PARAM_TYPE_REAL32
:
return
FactMetaData
::
valueTypeFloat
;
case
MAV_PARAM_TYPE_REAL64
:
return
FactMetaData
::
valueTypeDouble
;
default:
qWarning
()
<<
"Unsupported mav param type"
<<
mavType
;
// fall through
...
...
src/FirmwarePlugin/APM/APMParameterMetaData.cc
View file @
5d435d39
...
...
@@ -44,11 +44,13 @@ QVariant APMParameterMetaData::_stringToTypedVariant(const QString& string,
case
FactMetaData
:
:
valueTypeUint8
:
case
FactMetaData
:
:
valueTypeUint16
:
case
FactMetaData
:
:
valueTypeUint32
:
case
FactMetaData
:
:
valueTypeUint64
:
convertTo
=
QVariant
::
UInt
;
break
;
case
FactMetaData
:
:
valueTypeInt8
:
case
FactMetaData
:
:
valueTypeInt16
:
case
FactMetaData
:
:
valueTypeInt32
:
case
FactMetaData
:
:
valueTypeInt64
:
convertTo
=
QVariant
::
Int
;
break
;
case
FactMetaData
:
:
valueTypeFloat
:
...
...
@@ -531,12 +533,14 @@ void APMParameterMetaData::addMetaDataToFact(Fact* fact, MAV_TYPE vehicleType)
break
;
case
FactMetaData
:
:
valueTypeInt32
:
case
FactMetaData
:
:
valueTypeInt64
:
typedBitSet
=
QVariant
((
int
)
bitSet
);
break
;
case
FactMetaData
:
:
valueTypeUint8
:
case
FactMetaData
:
:
valueTypeUint16
:
case
FactMetaData
:
:
valueTypeUint32
:
case
FactMetaData
:
:
valueTypeUint64
:
typedBitSet
=
QVariant
(
bitSet
);
break
;
...
...
src/FirmwarePlugin/PX4/PX4ParameterMetaData.cc
View file @
5d435d39
...
...
@@ -44,11 +44,13 @@ QVariant PX4ParameterMetaData::_stringToTypedVariant(const QString& string, Fact
case
FactMetaData
:
:
valueTypeUint8
:
case
FactMetaData
:
:
valueTypeUint16
:
case
FactMetaData
:
:
valueTypeUint32
:
case
FactMetaData
:
:
valueTypeUint64
:
convertTo
=
QVariant
::
UInt
;
break
;
case
FactMetaData
:
:
valueTypeInt8
:
case
FactMetaData
:
:
valueTypeInt16
:
case
FactMetaData
:
:
valueTypeInt32
:
case
FactMetaData
:
:
valueTypeInt64
:
convertTo
=
QVariant
::
Int
;
break
;
case
FactMetaData
:
:
valueTypeFloat
:
...
...
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