From 459c3e85760e7425a3568e7046c45edea3a02166 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Tue, 17 Sep 2019 22:30:40 +0200 Subject: [PATCH] Update elro plugin --- elro/devicepluginelro.cpp | 13 ++++++++----- elro/devicepluginelro.h | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/elro/devicepluginelro.cpp b/elro/devicepluginelro.cpp index 0a5667eb..ebbb80a3 100644 --- a/elro/devicepluginelro.cpp +++ b/elro/devicepluginelro.cpp @@ -32,13 +32,16 @@ DevicePluginElro::DevicePluginElro() { } -Device::DeviceError DevicePluginElro::executeAction(Device *device, const Action &action) +void DevicePluginElro::executeAction(DeviceActionInfo *info) { + Device *device = info->device(); + Action action = info->action(); + if (!hardwareManager()->radio433()->available()) - return Device::DeviceErrorHardwareNotAvailable; + return info->finish(Device::DeviceErrorHardwareNotAvailable); if (action.actionTypeId() != elroSocketPowerActionTypeId) - return Device::DeviceErrorActionTypeNotFound; + return info->finish(Device::DeviceErrorActionTypeNotFound); QList rawData; QByteArray binCode; @@ -128,10 +131,10 @@ Device::DeviceError DevicePluginElro::executeAction(Device *device, const Action qCDebug(dcElro) << "Transmitted" << pluginName() << device->name() << "power: " << action.param(elroSocketPowerActionPowerParamTypeId).value().toBool(); } else { qCWarning(dcElro) << "Could not transmitt" << pluginName() << device->name() << "power: " << action.param(elroSocketPowerActionPowerParamTypeId).value().toBool(); - return Device::DeviceErrorHardwareNotAvailable; + return info->finish(Device::DeviceErrorHardwareNotAvailable); } - return Device::DeviceErrorNoError; + info->finish(Device::DeviceErrorNoError); } void DevicePluginElro::radioData(const QList &rawData) diff --git a/elro/devicepluginelro.h b/elro/devicepluginelro.h index d1784a4a..a8eed241 100644 --- a/elro/devicepluginelro.h +++ b/elro/devicepluginelro.h @@ -38,7 +38,7 @@ public: void radioData(const QList &rawData); public slots: - Device::DeviceError executeAction(Device *device, const Action &action) override; + void executeAction(DeviceActionInfo *info) override; };