Update according to new API
This commit is contained in:
parent
d7af7fd57d
commit
f6a1c77e24
@ -53,7 +53,6 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "deviceplugingenericelements.h"
|
#include "deviceplugingenericelements.h"
|
||||||
#include "devicemanager.h"
|
|
||||||
#include "plugininfo.h"
|
#include "plugininfo.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
@ -62,52 +61,52 @@ DevicePluginGenericElements::DevicePluginGenericElements()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceManager::DeviceSetupStatus DevicePluginGenericElements::setupDevice(Device *device)
|
Device::DeviceSetupStatus DevicePluginGenericElements::setupDevice(Device *device)
|
||||||
{
|
{
|
||||||
// Toggle Button
|
// Toggle Button
|
||||||
if (device->deviceClassId() == toggleButtonDeviceClassId) {
|
if (device->deviceClassId() == toggleButtonDeviceClassId) {
|
||||||
return DeviceManager::DeviceSetupStatusSuccess;
|
return Device::DeviceSetupStatusSuccess;
|
||||||
}
|
}
|
||||||
// Button
|
// Button
|
||||||
if (device->deviceClassId() == buttonDeviceClassId) {
|
if (device->deviceClassId() == buttonDeviceClassId) {
|
||||||
return DeviceManager::DeviceSetupStatusSuccess;
|
return Device::DeviceSetupStatusSuccess;
|
||||||
}
|
}
|
||||||
// ON/OFF Button
|
// ON/OFF Button
|
||||||
if (device->deviceClassId() == onOffButtonDeviceClassId) {
|
if (device->deviceClassId() == onOffButtonDeviceClassId) {
|
||||||
return DeviceManager::DeviceSetupStatusSuccess;
|
return Device::DeviceSetupStatusSuccess;
|
||||||
}
|
}
|
||||||
return DeviceManager::DeviceSetupStatusFailure;
|
return Device::DeviceSetupStatusFailure;
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceManager::DeviceError DevicePluginGenericElements::executeAction(Device *device, const Action &action)
|
Device::DeviceError DevicePluginGenericElements::executeAction(Device *device, const Action &action)
|
||||||
{
|
{
|
||||||
// Toggle Button
|
// Toggle Button
|
||||||
if (device->deviceClassId() == toggleButtonDeviceClassId ) {
|
if (device->deviceClassId() == toggleButtonDeviceClassId ) {
|
||||||
if (action.actionTypeId() == toggleButtonStateActionTypeId) {
|
if (action.actionTypeId() == toggleButtonStateActionTypeId) {
|
||||||
device->setStateValue(toggleButtonStateStateTypeId, !device->stateValue(toggleButtonStateStateTypeId).toBool());
|
device->setStateValue(toggleButtonStateStateTypeId, !device->stateValue(toggleButtonStateStateTypeId).toBool());
|
||||||
return DeviceManager::DeviceErrorNoError;
|
return Device::DeviceErrorNoError;
|
||||||
}
|
}
|
||||||
return DeviceManager::DeviceErrorActionTypeNotFound;
|
return Device::DeviceErrorActionTypeNotFound;
|
||||||
}
|
}
|
||||||
// Button
|
// Button
|
||||||
if (device->deviceClassId() == buttonDeviceClassId ) {
|
if (device->deviceClassId() == buttonDeviceClassId ) {
|
||||||
if (action.actionTypeId() == buttonButtonPressActionTypeId) {
|
if (action.actionTypeId() == buttonButtonPressActionTypeId) {
|
||||||
emit emitEvent(Event(buttonButtonPressedEventTypeId, device->id()));
|
emit emitEvent(Event(buttonButtonPressedEventTypeId, device->id()));
|
||||||
return DeviceManager::DeviceErrorNoError;
|
return Device::DeviceErrorNoError;
|
||||||
}
|
}
|
||||||
return DeviceManager::DeviceErrorActionTypeNotFound;
|
return Device::DeviceErrorActionTypeNotFound;
|
||||||
}
|
}
|
||||||
// ON/OFF Button
|
// ON/OFF Button
|
||||||
if (device->deviceClassId() == onOffButtonDeviceClassId ) {
|
if (device->deviceClassId() == onOffButtonDeviceClassId ) {
|
||||||
if (action.actionTypeId() == onOffButtonOnActionTypeId) {
|
if (action.actionTypeId() == onOffButtonOnActionTypeId) {
|
||||||
emit emitEvent(Event(onOffButtonOnEventTypeId, device->id()));
|
emit emitEvent(Event(onOffButtonOnEventTypeId, device->id()));
|
||||||
return DeviceManager::DeviceErrorNoError;
|
return Device::DeviceErrorNoError;
|
||||||
}
|
}
|
||||||
if (action.actionTypeId() == onOffButtonOffActionTypeId) {
|
if (action.actionTypeId() == onOffButtonOffActionTypeId) {
|
||||||
emit emitEvent(Event(onOffButtonOffEventTypeId, device->id()));
|
emit emitEvent(Event(onOffButtonOffEventTypeId, device->id()));
|
||||||
return DeviceManager::DeviceErrorNoError;
|
return Device::DeviceErrorNoError;
|
||||||
}
|
}
|
||||||
return DeviceManager::DeviceErrorActionTypeNotFound;
|
return Device::DeviceErrorActionTypeNotFound;
|
||||||
}
|
}
|
||||||
return DeviceManager::DeviceErrorDeviceClassNotFound;
|
return Device::DeviceErrorDeviceClassNotFound;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,7 +23,7 @@
|
|||||||
#ifndef DEVICEPLUGINGENERICELEMENTS_H
|
#ifndef DEVICEPLUGINGENERICELEMENTS_H
|
||||||
#define DEVICEPLUGINGENERICELEMENTS_H
|
#define DEVICEPLUGINGENERICELEMENTS_H
|
||||||
|
|
||||||
#include "plugin/deviceplugin.h"
|
#include "devices/deviceplugin.h"
|
||||||
|
|
||||||
class DevicePluginGenericElements : public DevicePlugin
|
class DevicePluginGenericElements : public DevicePlugin
|
||||||
{
|
{
|
||||||
@ -34,10 +34,10 @@ class DevicePluginGenericElements : public DevicePlugin
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DevicePluginGenericElements();
|
explicit DevicePluginGenericElements();
|
||||||
DeviceManager::DeviceSetupStatus setupDevice(Device *device) override;
|
Device::DeviceSetupStatus setupDevice(Device *device) override;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
DeviceManager::DeviceError executeAction(Device *device, const Action &action) override;
|
Device::DeviceError executeAction(Device *device, const Action &action) override;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user