From 877cce7d8dee8b8f388c0a79b41620e57a65c530 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Wed, 18 Sep 2019 00:44:42 +0200 Subject: [PATCH] Update intertechno plugin --- intertechno/devicepluginintertechno.cpp | 13 ++++++++----- intertechno/devicepluginintertechno.h | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/intertechno/devicepluginintertechno.cpp b/intertechno/devicepluginintertechno.cpp index 7763591e..e30007fa 100644 --- a/intertechno/devicepluginintertechno.cpp +++ b/intertechno/devicepluginintertechno.cpp @@ -35,10 +35,13 @@ DevicePluginIntertechno::DevicePluginIntertechno() } -Device::DeviceError DevicePluginIntertechno::executeAction(Device *device, const Action &action) +void DevicePluginIntertechno::executeAction(DeviceActionInfo *info) { + Device *device = info->device(); + Action action = info->action(); + if (!hardwareManager()->radio433()->available()) - return Device::DeviceErrorHardwareNotAvailable; + return info->finish(Device::DeviceErrorHardwareNotAvailable, QT_TR_NOOP("No 433MHz radio available on this system.")); QList rawData; QByteArray binCode; @@ -120,7 +123,7 @@ Device::DeviceError DevicePluginIntertechno::executeAction(Device *device, const } if (binCode.length() != 16){ - return Device::DeviceErrorInvalidParameter; + return info->finish(Device::DeviceErrorInvalidParameter); } // ======================================= @@ -159,9 +162,9 @@ Device::DeviceError DevicePluginIntertechno::executeAction(Device *device, const qCDebug(dcIntertechno) << "transmitted" << pluginName() << device->name() << "power: " << action.param(switchSetPowerActionPowerParamTypeId).value().toBool(); } else { qCWarning(dcIntertechno) << "could not transmitt" << pluginName() << device->name() << "power: " << action.param(switchSetPowerActionPowerParamTypeId).value().toBool(); - return Device::DeviceErrorHardwareNotAvailable; + return info->finish(Device::DeviceErrorHardwareFailure, QT_TR_NOOP("Error sending data.")); } - return Device::DeviceErrorNoError; + return info->finish(Device::DeviceErrorNoError); } void DevicePluginIntertechno::radioData(const QList &rawData) diff --git a/intertechno/devicepluginintertechno.h b/intertechno/devicepluginintertechno.h index 0776f6df..dd0bd301 100644 --- a/intertechno/devicepluginintertechno.h +++ b/intertechno/devicepluginintertechno.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; };