Update conrad plugin
This commit is contained in:
parent
668a07f63d
commit
7d0a6f9912
@ -31,24 +31,29 @@
|
|||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
|
|
||||||
DevicePluginConrad::DevicePluginConrad()
|
DevicePluginConrad::DevicePluginConrad(): DevicePlugin()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Device::DeviceSetupStatus DevicePluginConrad::setupDevice(Device *device)
|
void DevicePluginConrad::setupDevice(DeviceSetupInfo *info)
|
||||||
{
|
{
|
||||||
if (device->deviceClassId() == conradShutterDeviceClassId)
|
if (info->device()->deviceClassId() == conradShutterDeviceClassId) {
|
||||||
return Device::DeviceSetupStatusSuccess;
|
info->finish(Device::DeviceErrorNoError);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
return Device::DeviceSetupStatusFailure;
|
info->finish(Device::DeviceErrorDeviceClassNotFound);
|
||||||
}
|
}
|
||||||
|
|
||||||
Device::DeviceError DevicePluginConrad::executeAction(Device *device, const Action &action)
|
void DevicePluginConrad::executeAction(DeviceActionInfo *info)
|
||||||
{
|
{
|
||||||
|
Device *device = info->device();
|
||||||
|
Action action = info->action();
|
||||||
|
|
||||||
if (!hardwareManager()->radio433()->available()) {
|
if (!hardwareManager()->radio433()->available()) {
|
||||||
return Device::DeviceErrorHardwareNotAvailable;
|
info->finish(Device::DeviceErrorHardwareNotAvailable);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<int> rawData;
|
QList<int> rawData;
|
||||||
@ -64,7 +69,8 @@ Device::DeviceError DevicePluginConrad::executeAction(Device *device, const Acti
|
|||||||
binCode = "10100000";
|
binCode = "10100000";
|
||||||
repetitions = 20;
|
repetitions = 20;
|
||||||
} else {
|
} else {
|
||||||
return Device::DeviceErrorActionTypeNotFound;
|
info->finish(Device::DeviceErrorActionTypeNotFound);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// append ID
|
// append ID
|
||||||
@ -103,9 +109,10 @@ Device::DeviceError DevicePluginConrad::executeAction(Device *device, const Acti
|
|||||||
qCDebug(dcConrad) << "Transmitted successfully" << device->name() << action.actionTypeId();
|
qCDebug(dcConrad) << "Transmitted successfully" << device->name() << action.actionTypeId();
|
||||||
}else{
|
}else{
|
||||||
qCWarning(dcConrad) << "Could not transmitt" << pluginName() << device->name() << action.actionTypeId();
|
qCWarning(dcConrad) << "Could not transmitt" << pluginName() << device->name() << action.actionTypeId();
|
||||||
return Device::DeviceErrorHardwareNotAvailable;
|
info->finish(Device::DeviceErrorHardwareNotAvailable);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
return Device::DeviceErrorNoError;
|
info->finish(Device::DeviceErrorNoError);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DevicePluginConrad::radioData(const QList<int> &rawData)
|
void DevicePluginConrad::radioData(const QList<int> &rawData)
|
||||||
|
|||||||
@ -36,12 +36,10 @@ class DevicePluginConrad : public DevicePlugin
|
|||||||
public:
|
public:
|
||||||
explicit DevicePluginConrad();
|
explicit DevicePluginConrad();
|
||||||
|
|
||||||
Device::DeviceSetupStatus setupDevice(Device *device) override;
|
void setupDevice(DeviceSetupInfo *info) override;
|
||||||
void radioData(const QList<int> &rawData);
|
void radioData(const QList<int> &rawData);
|
||||||
|
|
||||||
|
void executeAction(DeviceActionInfo *info) override;
|
||||||
public slots:
|
|
||||||
Device::DeviceError executeAction(Device *device, const Action &action) override;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user