Merge PR #147: Add auto device reconfigure mechanism

pull/152/head
Jenkins 2019-04-12 13:42:30 +02:00
commit 8dc872b72b
2 changed files with 4 additions and 4 deletions

View File

@ -465,7 +465,7 @@ DeviceManager::DeviceError DeviceManager::addConfiguredDevice(const DeviceClassI
* from a discovery or if the user set them. If it came from discovery not writable parameters (readOnly) will be changed too.
*
* Returns \l{DeviceError} to inform about the result. */
DeviceManager::DeviceError DeviceManager::reconfigureDevice(const DeviceId &deviceId, const ParamList &params, bool fromDiscovery)
DeviceManager::DeviceError DeviceManager::reconfigureDevice(const DeviceId &deviceId, const ParamList &params, bool fromDiscoveryOrAuto)
{
Device *device = findConfiguredDevice(deviceId);
if (!device) {
@ -487,7 +487,7 @@ DeviceManager::DeviceError DeviceManager::reconfigureDevice(const DeviceId &devi
}
// if the params are discovered and not set by the user
if (!fromDiscovery) {
if (!fromDiscoveryOrAuto) {
// check if one of the given params is not editable
foreach (const ParamType &paramType, deviceClass.paramTypes()) {
foreach (const Param &param, params) {
@ -1415,7 +1415,7 @@ void DeviceManager::onAutoDevicesAppeared(const DeviceClassId &deviceClassId, co
continue;
}
qCDebug(dcDeviceManager()) << "Start reconfiguring auto device" << device;
reconfigureDevice(deviceDescriptor.deviceId(), deviceDescriptor.params());
reconfigureDevice(deviceDescriptor.deviceId(), deviceDescriptor.params(), true);
continue;
}

View File

@ -115,7 +115,7 @@ public:
DeviceError addConfiguredDevice(const DeviceClassId &deviceClassId, const QString &name, const ParamList &params, const DeviceId id = DeviceId::createDeviceId());
DeviceError addConfiguredDevice(const DeviceClassId &deviceClassId, const QString &name, const DeviceDescriptorId &deviceDescriptorId, const ParamList &params = ParamList(), const DeviceId &deviceId = DeviceId::createDeviceId());
DeviceError reconfigureDevice(const DeviceId &deviceId, const ParamList &params, bool fromDiscovery = false);
DeviceError reconfigureDevice(const DeviceId &deviceId, const ParamList &params, bool fromDiscoveryOrAuto = false);
DeviceError reconfigureDevice(const DeviceId &deviceId, const DeviceDescriptorId &deviceDescriptorId);
DeviceError editDevice(const DeviceId &deviceId, const QString &name);