From 18d684592d62d29c99adba9245be8c15b9cc3d4b Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Wed, 10 Apr 2019 14:06:08 +0200 Subject: [PATCH] Allow reconfiguring red-only params from the plugin side in autoDevicesAppeared() --- libnymea/devicemanager.cpp | 6 +++--- libnymea/devicemanager.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libnymea/devicemanager.cpp b/libnymea/devicemanager.cpp index 1959e60f..0c4eb13b 100644 --- a/libnymea/devicemanager.cpp +++ b/libnymea/devicemanager.cpp @@ -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 ¶ms, bool fromDiscovery) +DeviceManager::DeviceError DeviceManager::reconfigureDevice(const DeviceId &deviceId, const ParamList ¶ms, 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 ¶mType, deviceClass.paramTypes()) { foreach (const Param ¶m, 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; } diff --git a/libnymea/devicemanager.h b/libnymea/devicemanager.h index 394c9b12..503fade1 100644 --- a/libnymea/devicemanager.h +++ b/libnymea/devicemanager.h @@ -115,7 +115,7 @@ public: DeviceError addConfiguredDevice(const DeviceClassId &deviceClassId, const QString &name, const ParamList ¶ms, const DeviceId id = DeviceId::createDeviceId()); DeviceError addConfiguredDevice(const DeviceClassId &deviceClassId, const QString &name, const DeviceDescriptorId &deviceDescriptorId, const ParamList ¶ms = ParamList(), const DeviceId &deviceId = DeviceId::createDeviceId()); - DeviceError reconfigureDevice(const DeviceId &deviceId, const ParamList ¶ms, bool fromDiscovery = false); + DeviceError reconfigureDevice(const DeviceId &deviceId, const ParamList ¶ms, bool fromDiscoveryOrAuto = false); DeviceError reconfigureDevice(const DeviceId &deviceId, const DeviceDescriptorId &deviceDescriptorId); DeviceError editDevice(const DeviceId &deviceId, const QString &name);