Fix merging params for discovered devices with user overrides
This commit is contained in:
parent
7edec8198e
commit
8991e01526
@ -478,13 +478,13 @@ DeviceManager::DeviceError DeviceManager::addConfiguredDevice(const DeviceClassI
|
|||||||
return DeviceErrorDeviceDescriptorNotFound;
|
return DeviceErrorDeviceDescriptorNotFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Merge params. Use the ones from the descriptor unless overrides are provided in the function call
|
// Merge params from discovered descriptor and additional overrides provided on API call. User provided params have higher priority than discovery params.
|
||||||
ParamList finalParams;
|
ParamList finalParams;
|
||||||
foreach (const Param ¶m, descriptor.params()) {
|
foreach (const ParamType ¶mType, deviceClass.paramTypes()) {
|
||||||
if (params.hasParam(param.paramTypeId())) {
|
if (params.hasParam(paramType.id())) {
|
||||||
finalParams.append(Param(param.paramTypeId(), params.paramValue(param.paramTypeId())));
|
finalParams.append(Param(paramType.id(), params.paramValue(paramType.id())));
|
||||||
} else {
|
} else if (descriptor.params().hasParam(paramType.id())) {
|
||||||
finalParams.append(param);
|
finalParams.append(Param(paramType.id(), descriptor.params().paramValue(paramType.id())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user