Update elro plugin

This commit is contained in:
Michael Zanetti 2019-09-17 22:30:40 +02:00
parent f299653607
commit 459c3e8576
2 changed files with 9 additions and 6 deletions

View File

@ -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()) if (!hardwareManager()->radio433()->available())
return Device::DeviceErrorHardwareNotAvailable; return info->finish(Device::DeviceErrorHardwareNotAvailable);
if (action.actionTypeId() != elroSocketPowerActionTypeId) if (action.actionTypeId() != elroSocketPowerActionTypeId)
return Device::DeviceErrorActionTypeNotFound; return info->finish(Device::DeviceErrorActionTypeNotFound);
QList<int> rawData; QList<int> rawData;
QByteArray binCode; 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(); qCDebug(dcElro) << "Transmitted" << pluginName() << device->name() << "power: " << action.param(elroSocketPowerActionPowerParamTypeId).value().toBool();
} else { } else {
qCWarning(dcElro) << "Could not transmitt" << pluginName() << device->name() << "power: " << action.param(elroSocketPowerActionPowerParamTypeId).value().toBool(); 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<int> &rawData) void DevicePluginElro::radioData(const QList<int> &rawData)

View File

@ -38,7 +38,7 @@ public:
void radioData(const QList<int> &rawData); void radioData(const QList<int> &rawData);
public slots: public slots:
Device::DeviceError executeAction(Device *device, const Action &action) override; void executeAction(DeviceActionInfo *info) override;
}; };