From 1ef6c80e799bb7eaf0fb32fc17c530ea001cfac8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=BCrz?= Date: Mon, 29 Feb 2016 15:30:47 +0100 Subject: [PATCH] add editDevice method --- libguh/devicemanager.cpp | 31 ++++++--- libguh/devicemanager.h | 6 +- .../deviceplugins/mock/devicepluginmock.json | 4 +- server/guhcore.cpp | 4 +- server/guhcore.h | 2 +- server/jsonrpc/devicehandler.cpp | 63 +++++++++++++------ server/jsonrpc/devicehandler.h | 6 +- server/rest/devicesresource.cpp | 14 ++--- tests/auto/api.json | 28 ++++++--- tests/auto/jsonrpc/testjsonrpc.cpp | 8 +-- 10 files changed, 109 insertions(+), 57 deletions(-) diff --git a/libguh/devicemanager.cpp b/libguh/devicemanager.cpp index e40f33cd..68332263 100644 --- a/libguh/devicemanager.cpp +++ b/libguh/devicemanager.cpp @@ -139,7 +139,7 @@ create the Devices.DeviceAdded notification. */ -/*! \fn void DeviceManager::deviceParamsChanged(Device *device); +/*! \fn void DeviceManager::deviceChanged(Device *device); This signal is emitted when a \a \device was changed in the system (by edit or rediscover). This signal will create the Devices.DeviceParamsChanged notification. */ @@ -468,7 +468,7 @@ DeviceManager::DeviceError DeviceManager::reconfigureDevice(const DeviceId &devi qCWarning(dcDeviceManager) << "Device edit failed. Not saving changes of device paramters. Device setup incomplete."; return DeviceErrorSetupFailed; case DeviceSetupStatusAsync: - m_asyncDeviceEdit.append(device); + m_asyncDeviceReconfiguration.append(device); return DeviceErrorAsync; case DeviceSetupStatusSuccess: qCDebug(dcDeviceManager) << "Device edit complete."; @@ -478,7 +478,7 @@ DeviceManager::DeviceError DeviceManager::reconfigureDevice(const DeviceId &devi storeConfiguredDevices(); postSetupDevice(device); device->setupCompleted(); - emit deviceParamsChanged(device); + emit deviceChanged(device); return DeviceErrorNoError; } @@ -513,6 +513,19 @@ DeviceManager::DeviceError DeviceManager::reconfigureDevice(const DeviceId &devi return reconfigureDevice(deviceId, descriptor.params(), true); } +DeviceManager::DeviceError DeviceManager::editDevice(const DeviceId &deviceId, const QString &name) +{ + Device *device = findConfiguredDevice(deviceId); + if (!device) + return DeviceErrorDeviceNotFound; + + device->setName(name); + storeConfiguredDevices(); + emit deviceChanged(device); + + return DeviceErrorNoError; +} + /*! Initiates a pairing with a \l{DeviceClass}{Device} with the given \a pairingTransactionId, \a deviceClassId and \a params. * Returns \l{DeviceManager::DeviceError}{DeviceError} to inform about the result. */ DeviceManager::DeviceError DeviceManager::pairDevice(const PairingTransactionId &pairingTransactionId, const DeviceClassId &deviceClassId, const ParamList ¶ms) @@ -1086,15 +1099,15 @@ void DeviceManager::slotDeviceSetupFinished(Device *device, DeviceManager::Devic if (status == DeviceSetupStatusFailure) { if (m_configuredDevices.contains(device)) { - if (m_asyncDeviceEdit.contains(device)) { - m_asyncDeviceEdit.removeAll(device); + if (m_asyncDeviceReconfiguration.contains(device)) { + m_asyncDeviceReconfiguration.removeAll(device); qCWarning(dcDeviceManager) << QString("Error in device setup after edit params. Device %1 (%2) would not be functional.").arg(device->name()).arg(device->id().toString()); storeConfiguredDevices(); // TODO: recover old params.?? - emit deviceParamsChanged(device); + emit deviceChanged(device); emit deviceReconfigurationFinished(device, DeviceError::DeviceErrorSetupFailed); } qCWarning(dcDeviceManager) << QString("Error in device setup. Device %1 (%2) will not be functional.").arg(device->name()).arg(device->id().toString()); @@ -1128,11 +1141,11 @@ void DeviceManager::slotDeviceSetupFinished(Device *device, DeviceManager::Devic } // if this is a async device edit result - if (m_asyncDeviceEdit.contains(device)) { - m_asyncDeviceEdit.removeAll(device); + if (m_asyncDeviceReconfiguration.contains(device)) { + m_asyncDeviceReconfiguration.removeAll(device); storeConfiguredDevices(); device->setupCompleted(); - emit deviceParamsChanged(device); + emit deviceChanged(device); emit deviceReconfigurationFinished(device, DeviceManager::DeviceErrorNoError); return; } diff --git a/libguh/devicemanager.h b/libguh/devicemanager.h index cbdddca0..08a572a9 100644 --- a/libguh/devicemanager.h +++ b/libguh/devicemanager.h @@ -117,7 +117,9 @@ public: DeviceError reconfigureDevice(const DeviceId &deviceId, const ParamList ¶ms, bool fromDiscovery = false); DeviceError reconfigureDevice(const DeviceId &deviceId, const DeviceDescriptorId &deviceDescriptorId); - + + DeviceError editDevice(const DeviceId &deviceId, const QString &name); + DeviceError pairDevice(const PairingTransactionId &pairingTransactionId, const DeviceClassId &deviceClassId, const ParamList ¶ms); DeviceError pairDevice(const PairingTransactionId &pairingTransactionId, const DeviceClassId &deviceClassId, const DeviceDescriptorId &deviceDescriptorId); DeviceError confirmPairing(const PairingTransactionId &pairingTransactionId, const QString &secret = QString()); @@ -138,7 +140,7 @@ signals: void deviceStateChanged(Device *device, const QUuid &stateTypeId, const QVariant &value); void deviceRemoved(const DeviceId &deviceId); void deviceAdded(Device *device); - void deviceParamsChanged(Device *device); + void deviceChanged(Device *device); void devicesDiscovered(const DeviceClassId &deviceClassId, const QList &devices); void deviceSetupFinished(Device *device, DeviceError status); void deviceReconfigurationFinished(Device *device, DeviceError status); diff --git a/plugins/deviceplugins/mock/devicepluginmock.json b/plugins/deviceplugins/mock/devicepluginmock.json index 21816d88..93616b22 100644 --- a/plugins/deviceplugins/mock/devicepluginmock.json +++ b/plugins/deviceplugins/mock/devicepluginmock.json @@ -295,7 +295,7 @@ { "id": "54646e7c-bc54-4895-81a2-590d72d120f9", "idName": "timeout", - "name": "Timout action" + "name": "Timeout action" } ] }, @@ -386,7 +386,7 @@ { "id": "54646e7c-bc54-4895-81a2-590d72d120f9", "idName": "timeout", - "name": "Timout action" + "name": "Timeout action" } ] }, diff --git a/server/guhcore.cpp b/server/guhcore.cpp index 60b7854c..025a7bc2 100644 --- a/server/guhcore.cpp +++ b/server/guhcore.cpp @@ -46,7 +46,7 @@ This signal is emitted when a \a device was added to the system. */ -/*! \fn void guhserver::GuhCore::deviceParamsChanged(Device *device); +/*! \fn void guhserver::GuhCore::deviceChanged(Device *device); This signal is emitted when the \l{ParamList}{Params} of a \a device have been changed. */ @@ -373,7 +373,7 @@ GuhCore::GuhCore(QObject *parent) : connect(m_deviceManager, &DeviceManager::eventTriggered, this, &GuhCore::gotEvent); connect(m_deviceManager, &DeviceManager::deviceStateChanged, this, &GuhCore::deviceStateChanged); connect(m_deviceManager, &DeviceManager::deviceAdded, this, &GuhCore::deviceAdded); - connect(m_deviceManager, &DeviceManager::deviceParamsChanged, this, &GuhCore::deviceParamsChanged); + connect(m_deviceManager, &DeviceManager::deviceChanged, this, &GuhCore::deviceChanged); connect(m_deviceManager, &DeviceManager::deviceRemoved, this, &GuhCore::deviceRemoved); connect(m_deviceManager, &DeviceManager::actionExecutionFinished, this, &GuhCore::actionExecutionFinished); connect(m_deviceManager, &DeviceManager::devicesDiscovered, this, &GuhCore::devicesDiscovered); diff --git a/server/guhcore.h b/server/guhcore.h index 8de738e4..073b4787 100644 --- a/server/guhcore.h +++ b/server/guhcore.h @@ -74,7 +74,7 @@ signals: void deviceStateChanged(Device *device, const QUuid &stateTypeId, const QVariant &value); void deviceRemoved(const DeviceId &deviceId); void deviceAdded(Device *device); - void deviceParamsChanged(Device *device); + void deviceChanged(Device *device); void actionExecuted(const ActionId &id, DeviceManager::DeviceError status); void devicesDiscovered(const DeviceClassId &deviceClassId, const QList deviceDescriptors); diff --git a/server/jsonrpc/devicehandler.cpp b/server/jsonrpc/devicehandler.cpp index 2c05ea73..0de0d25c 100644 --- a/server/jsonrpc/devicehandler.cpp +++ b/server/jsonrpc/devicehandler.cpp @@ -96,10 +96,10 @@ DeviceHandler::DeviceHandler(QObject *parent) : params.clear(); returns.clear(); setDescription("AddConfiguredDevice", "Add a configured device with a setupMethod of SetupMethodJustAdd. " - "For devices with a setupMethod different than SetupMethodJustAdd, use PairDevice. " - "Use deviceDescriptorId or deviceParams, depending on the createMethod of the device class. " - "CreateMethodJustAdd takes the parameters you want to have with that device. " - "CreateMethodDiscovery requires the use of a deviceDescriptorId." + "For devices with a setupMethod different than SetupMethodJustAdd, use PairDevice. " + "Use deviceDescriptorId or deviceParams, depending on the createMethod of the device class. " + "CreateMethodJustAdd takes the parameters you want to have with that device. " + "CreateMethodDiscovery requires the use of a deviceDescriptorId." ); params.insert("deviceClassId", JsonTypes::basicTypeToString(JsonTypes::Uuid)); params.insert("name", JsonTypes::basicTypeToString(JsonTypes::String)); @@ -114,13 +114,13 @@ DeviceHandler::DeviceHandler(QObject *parent) : returns.clear(); // Reused params from above! setDescription("PairDevice", "Pair a device. " - "Use this for DeviceClasses with a setupMethod different than SetupMethodJustAdd. " - "Use deviceDescriptorId or deviceParams, depending on the createMethod of the device class. " - "CreateMethodJustAdd takes the parameters you want to have with that device. " - "CreateMethodDiscovery requires the use of a deviceDescriptorId. " - "If success is true, the return values will contain a pairingTransactionId, a displayMessage and " - "the setupMethod. Depending on the setupMethod you should either proceed with AddConfiguredDevice " - "or PairDevice." + "Use this for DeviceClasses with a setupMethod different than SetupMethodJustAdd. " + "Use deviceDescriptorId or deviceParams, depending on the createMethod of the device class. " + "CreateMethodJustAdd takes the parameters you want to have with that device. " + "CreateMethodDiscovery requires the use of a deviceDescriptorId. " + "If success is true, the return values will contain a pairingTransactionId, a displayMessage and " + "the setupMethod. Depending on the setupMethod you should either proceed with AddConfiguredDevice " + "or PairDevice." ); setParams("PairDevice", params); returns.insert("deviceError", JsonTypes::deviceErrorRef()); @@ -161,10 +161,10 @@ DeviceHandler::DeviceHandler(QObject *parent) : params.clear(); returns.clear(); setDescription("ReconfigureDevice", "Edit the parameter configuration of the device. The device params will be set to the " - "passed parameters and the setup device will be called. If the device is discoverable, " - "you can perform a GetDiscoveredDevices before calling this method and pass " - "the new DeviceDescriptor (rediscover). If a parameter is not writable, you will find a " - "'readOnly': true in the ParamType. By default, every Param is writable."); + "passed parameters and the setup device will be called. If the device is discoverable, " + "you can perform a GetDiscoveredDevices before calling this method and pass " + "the new DeviceDescriptor (rediscover). Only writable parameters can be changed. By default, " + "every Param is writable."); params.insert("deviceId", JsonTypes::basicTypeToString(JsonTypes::Uuid)); params.insert("o:deviceDescriptorId", JsonTypes::basicTypeToString(JsonTypes::Uuid)); QVariantList newDeviceParams; @@ -174,6 +174,15 @@ DeviceHandler::DeviceHandler(QObject *parent) : returns.insert("deviceError", JsonTypes::deviceErrorRef()); setReturns("ReconfigureDevice", returns); + params.clear(); returns.clear(); + setDescription("EditDevice", "Edit the name of a device. This method does not change the " + "configuration of the device."); + params.insert("deviceId", JsonTypes::basicTypeToString(JsonTypes::Uuid)); + params.insert("name", JsonTypes::basicTypeToString(JsonTypes::String)); + setParams("EditDevice", params); + returns.insert("deviceError", JsonTypes::deviceErrorRef()); + setReturns("EditDevice", returns); + params.clear(); returns.clear(); setDescription("RemoveConfiguredDevice", "Remove a device from the system."); params.insert("deviceId", JsonTypes::basicTypeToString(JsonTypes::Uuid)); @@ -257,14 +266,14 @@ DeviceHandler::DeviceHandler(QObject *parent) : setParams("DeviceAdded", params); params.clear(); returns.clear(); - setDescription("DeviceParamsChanged", "Emitted whenever the params of a Device changed (by editing or rediscovering)."); + setDescription("DeviceChanged", "Emitted whenever the params or name of a Device changed (by EditDevice or ReconfigureDevice)."); params.insert("device", JsonTypes::deviceRef()); - setParams("DeviceParamsChanged", params); + setParams("DeviceChanged", params); connect(GuhCore::instance(), &GuhCore::deviceStateChanged, this, &DeviceHandler::deviceStateChanged); connect(GuhCore::instance(), &GuhCore::deviceRemoved, this, &DeviceHandler::deviceRemovedNotification); connect(GuhCore::instance(), &GuhCore::deviceAdded, this, &DeviceHandler::deviceAddedNotification); - connect(GuhCore::instance(), &GuhCore::deviceParamsChanged, this, &DeviceHandler::deviceParamsChangedNotification); + connect(GuhCore::instance(), &GuhCore::deviceChanged, this, &DeviceHandler::deviceChangedNotification); connect(GuhCore::instance(), &GuhCore::devicesDiscovered, this, &DeviceHandler::devicesDiscovered, Qt::QueuedConnection); connect(GuhCore::instance(), &GuhCore::deviceSetupFinished, this, &DeviceHandler::deviceSetupFinished); connect(GuhCore::instance(), &GuhCore::deviceReconfigurationFinished, this, &DeviceHandler::deviceReconfigurationFinished); @@ -461,6 +470,20 @@ JsonReply *DeviceHandler::ReconfigureDevice(const QVariantMap ¶ms) return createReply(returns); } +JsonReply *DeviceHandler::EditDevice(const QVariantMap ¶ms) +{ + DeviceId deviceId = DeviceId(params.value("deviceId").toString()); + QString name = params.value("name").toString(); + + qCDebug(dcJsonRpc()) << "Edit device" << deviceId << name; + + DeviceManager::DeviceError status = GuhCore::instance()->deviceManager()->editDevice(deviceId, name); + + QVariantMap returns; + returns.insert("deviceError", JsonTypes::deviceErrorToString(status)); + return createReply(returns); +} + JsonReply* DeviceHandler::RemoveConfiguredDevice(const QVariantMap ¶ms) { QVariantMap returns; @@ -595,12 +618,12 @@ void DeviceHandler::deviceAddedNotification(Device *device) emit DeviceAdded(params); } -void DeviceHandler::deviceParamsChangedNotification(Device *device) +void DeviceHandler::deviceChangedNotification(Device *device) { QVariantMap params; params.insert("device", JsonTypes::packDevice(device)); - emit DeviceParamsChanged(params); + emit DeviceChanged(params); } void DeviceHandler::devicesDiscovered(const DeviceClassId &deviceClassId, const QList deviceDescriptors) diff --git a/server/jsonrpc/devicehandler.h b/server/jsonrpc/devicehandler.h index f1f4e105..18c9e10e 100644 --- a/server/jsonrpc/devicehandler.h +++ b/server/jsonrpc/devicehandler.h @@ -57,6 +57,8 @@ public: Q_INVOKABLE JsonReply* ReconfigureDevice(const QVariantMap ¶ms); + Q_INVOKABLE JsonReply* EditDevice(const QVariantMap ¶ms); + Q_INVOKABLE JsonReply* RemoveConfiguredDevice(const QVariantMap ¶ms); Q_INVOKABLE JsonReply* GetEventTypes(const QVariantMap ¶ms) const; @@ -73,7 +75,7 @@ signals: void StateChanged(const QVariantMap ¶ms); void DeviceRemoved(const QVariantMap ¶ms); void DeviceAdded(const QVariantMap ¶ms); - void DeviceParamsChanged(const QVariantMap ¶ms); + void DeviceChanged(const QVariantMap ¶ms); private slots: void deviceStateChanged(Device *device, const QUuid &stateTypeId, const QVariant &value); @@ -82,7 +84,7 @@ private slots: void deviceAddedNotification(Device *device); - void deviceParamsChangedNotification(Device *device); + void deviceChangedNotification(Device *device); void devicesDiscovered(const DeviceClassId &deviceClassId, const QList deviceDescriptors); diff --git a/server/rest/devicesresource.cpp b/server/rest/devicesresource.cpp index 0a43187c..2dde5a0d 100644 --- a/server/rest/devicesresource.cpp +++ b/server/rest/devicesresource.cpp @@ -461,7 +461,7 @@ HttpReply *DevicesResource::confirmPairDevice(const QByteArray &payload) const HttpReply *DevicesResource::reconfigureDevice(Device *device, const QByteArray &payload) const { - qCDebug(dcRest) << "Edit device" << device->id(); + qCDebug(dcRest) << "Reconfigure device" << device->id(); QPair verification = RestResource::verifyPayload(payload); if (!verification.first) return createErrorReply(HttpReply::BadRequest); @@ -472,16 +472,16 @@ HttpReply *DevicesResource::reconfigureDevice(Device *device, const QByteArray & DeviceManager::DeviceError status; DeviceDescriptorId deviceDescriptorId(params.value("deviceDescriptorId").toString()); if (deviceDescriptorId.isNull()) { - qCDebug(dcRest) << "Edit device with params:" << deviceParams; + qCDebug(dcRest) << "Reconfigure device with params:" << deviceParams; status = GuhCore::instance()->deviceManager()->reconfigureDevice(device->id(), deviceParams); } else { - qCDebug(dcRest) << "Edit device using the discovered device with descriptorId:" << deviceDescriptorId.toString(); + qCDebug(dcRest) << "Reconfigure device using the new discovered device with descriptorId:" << deviceDescriptorId.toString(); status = GuhCore::instance()->deviceManager()->reconfigureDevice(device->id(), deviceDescriptorId); } if (status == DeviceManager::DeviceErrorAsync) { HttpReply *reply = createAsyncReply(); - qCDebug(dcRest) << "Device edit async reply"; + qCDebug(dcRest) << "Device reconfiguration async reply"; m_asyncReconfigureDevice.insert(device, reply); return reply; } @@ -562,18 +562,18 @@ void DevicesResource::deviceReconfigurationFinished(Device *device, DeviceManage response.insert("error", JsonTypes::deviceErrorToString(status)); if (m_asyncReconfigureDevice.value(device).isNull()) { - qCWarning(dcRest) << "Async reply for device edit does not exist any more (timeout)."; + qCWarning(dcRest) << "Async reply for device reconfiguration does not exist any more (timeout)."; return; } HttpReply *reply = m_asyncReconfigureDevice.take(device); reply->setHeader(HttpReply::ContentTypeHeader, "application/json; charset=\"utf-8\";"); if (status == DeviceManager::DeviceErrorNoError) { - qCDebug(dcRest) << "Device edit finished successfully"; + qCDebug(dcRest) << "Device reconfiguration finished successfully"; reply->setHttpStatusCode(HttpReply::Ok); reply->setPayload(QJsonDocument::fromVariant(response).toJson()); } else { - qCDebug(dcRest) << "Device edit finished with error" << status; + qCDebug(dcRest) << "Device reconfiguration finished with error" << status; reply->setHttpStatusCode(HttpReply::InternalServerError); reply->setPayload(QJsonDocument::fromVariant(response).toJson()); } diff --git a/tests/auto/api.json b/tests/auto/api.json index abaf5909..4b29fe54 100644 --- a/tests/auto/api.json +++ b/tests/auto/api.json @@ -1,4 +1,4 @@ -37 +38 { "methods": { "Actions.ExecuteAction": { @@ -34,6 +34,7 @@ "description": "Add a configured device with a setupMethod of SetupMethodJustAdd. For devices with a setupMethod different than SetupMethodJustAdd, use PairDevice. Use deviceDescriptorId or deviceParams, depending on the createMethod of the device class. CreateMethodJustAdd takes the parameters you want to have with that device. CreateMethodDiscovery requires the use of a deviceDescriptorId.", "params": { "deviceClassId": "Uuid", + "name": "String", "o:deviceDescriptorId": "Uuid", "o:deviceParams": [ "$ref:Param" @@ -56,13 +57,10 @@ } }, "Devices.EditDevice": { - "description": "Edit the parameters of a device. The device params will be set to the passed parameters and the setup device will be called. If the device is discoverable, you can perform a GetDiscoveredDevices before calling this method and pass the new DeviceDescriptor (rediscover). If a parameter is not writable, you will find a 'readOnly': true in the ParamType. By default, every Param is writable.", + "description": "Edit the name of a device. This method does not change the configuration of the device.", "params": { "deviceId": "Uuid", - "o:deviceDescriptorId": "Uuid", - "o:deviceParams": [ - "$ref:Param" - ] + "name": "String" }, "returns": { "deviceError": "$ref:DeviceError" @@ -199,6 +197,7 @@ "description": "Pair a device. Use this for DeviceClasses with a setupMethod different than SetupMethodJustAdd. Use deviceDescriptorId or deviceParams, depending on the createMethod of the device class. CreateMethodJustAdd takes the parameters you want to have with that device. CreateMethodDiscovery requires the use of a deviceDescriptorId. If success is true, the return values will contain a pairingTransactionId, a displayMessage and the setupMethod. Depending on the setupMethod you should either proceed with AddConfiguredDevice or PairDevice.", "params": { "deviceClassId": "Uuid", + "name": "String", "o:deviceDescriptorId": "Uuid", "o:deviceParams": [ "$ref:Param" @@ -211,6 +210,19 @@ "o:setupMethod": "$ref:SetupMethod" } }, + "Devices.ReconfigureDevice": { + "description": "Edit the parameter configuration of the device. The device params will be set to the passed parameters and the setup device will be called. If the device is discoverable, you can perform a GetDiscoveredDevices before calling this method and pass the new DeviceDescriptor (rediscover). Only writable parameters can be changed. By default, every Param is writable.", + "params": { + "deviceId": "Uuid", + "o:deviceDescriptorId": "Uuid", + "o:deviceParams": [ + "$ref:Param" + ] + }, + "returns": { + "deviceError": "$ref:DeviceError" + } + }, "Devices.RemoveConfiguredDevice": { "description": "Remove a device from the system.", "params": { @@ -455,8 +467,8 @@ "device": "$ref:Device" } }, - "Devices.DeviceParamsChanged": { - "description": "Emitted whenever the params of a Device changed (by editing or rediscovering).", + "Devices.DeviceChanged": { + "description": "Emitted whenever the params or name of a Device changed (by EditDevice or ReconfigureDevice).", "params": { "device": "$ref:Device" } diff --git a/tests/auto/jsonrpc/testjsonrpc.cpp b/tests/auto/jsonrpc/testjsonrpc.cpp index 8b70bc56..6816bf8a 100644 --- a/tests/auto/jsonrpc/testjsonrpc.cpp +++ b/tests/auto/jsonrpc/testjsonrpc.cpp @@ -56,7 +56,7 @@ private slots: void ruleActiveChangedNotifications(); - void deviceParamsChangedNotifications(); + void deviceChangedNotifications(); private: QStringList extractRefs(const QVariant &variant); @@ -473,7 +473,7 @@ void TestJSONRPC::ruleActiveChangedNotifications() QCOMPARE(notificationVariant.toMap().value("params").toMap().value("ruleId").toString(), ruleId.toString()); } -void TestJSONRPC::deviceParamsChangedNotifications() +void TestJSONRPC::deviceChangedNotifications() { // enable notificartions QVariantMap params; @@ -512,7 +512,7 @@ void TestJSONRPC::deviceParamsChangedNotifications() } // EDIT - // now edit the device and check the deviceParamsChanged notification + // now edit the device and check the deviceChanged notification QVariantList newDeviceParams; QVariantMap newHttpportParam; newHttpportParam.insert("name", "httpport"); @@ -525,7 +525,7 @@ void TestJSONRPC::deviceParamsChangedNotifications() response = injectAndWait("Devices.ReconfigureDevice", params); clientSpy.wait(); verifyDeviceError(response); - QVariantMap reconfigureDeviceNotificationMap = checkNotification(clientSpy, "Devices.DeviceParamsChanged").toMap().value("params").toMap().value("device").toMap(); + QVariantMap reconfigureDeviceNotificationMap = checkNotification(clientSpy, "Devices.DeviceChanged").toMap().value("params").toMap().value("device").toMap(); QCOMPARE(reconfigureDeviceNotificationMap.value("deviceClassId").toString(), mockDeviceClassId.toString()); QCOMPARE(reconfigureDeviceNotificationMap.value("id").toString(), deviceId.toString()); foreach (const QVariant ¶m, reconfigureDeviceNotificationMap.value("params").toList()) {