mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-07 18:00:35 +08:00
ParamServer - automatic case conversion for parameter names
This commit is contained in:
@@ -18,6 +18,22 @@ bool ParamServer::isValueNonEmpty(const protocol::param::Value& value)
|
||||
!value.value_string.empty();
|
||||
}
|
||||
|
||||
void ParamServer::convertParamNameCase(IParamManager::ParamName& name) const
|
||||
{
|
||||
if (param_name_case_conversion_mode_ == ParamNameCaseConversionToLower)
|
||||
{
|
||||
name.convertToLowerCaseASCII();
|
||||
}
|
||||
else if (param_name_case_conversion_mode_ == ParamNameCaseConversionToUpper)
|
||||
{
|
||||
name.convertToUpperCaseASCII();
|
||||
}
|
||||
else
|
||||
{
|
||||
; // Conversion is not needed
|
||||
}
|
||||
}
|
||||
|
||||
void ParamServer::handleGetSet(const protocol::param::GetSet::Request& in, protocol::param::GetSet::Response& out)
|
||||
{
|
||||
UAVCAN_ASSERT(manager_ != NULL);
|
||||
@@ -33,6 +49,8 @@ void ParamServer::handleGetSet(const protocol::param::GetSet::Request& in, proto
|
||||
out.name = in.name;
|
||||
}
|
||||
|
||||
convertParamNameCase(out.name);
|
||||
|
||||
// Assign if needed, read back
|
||||
if (isValueNonEmpty(in.value))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user