Merge PR #118: Philips Hue: Add support for the hue indoor motion sensor

This commit is contained in:
Jenkins 2019-07-22 12:17:13 +02:00
commit 56607a595b
2 changed files with 17 additions and 18 deletions

View File

@ -21,7 +21,6 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "deviceplugingenericelements.h"
#include "devicemanager.h"
#include "plugininfo.h"
#include <QDebug>
@ -30,52 +29,52 @@ DevicePluginGenericElements::DevicePluginGenericElements()
{
}
DeviceManager::DeviceSetupStatus DevicePluginGenericElements::setupDevice(Device *device)
Device::DeviceSetupStatus DevicePluginGenericElements::setupDevice(Device *device)
{
// Toggle Button
if (device->deviceClassId() == toggleButtonDeviceClassId) {
return DeviceManager::DeviceSetupStatusSuccess;
return Device::DeviceSetupStatusSuccess;
}
// Button
if (device->deviceClassId() == buttonDeviceClassId) {
return DeviceManager::DeviceSetupStatusSuccess;
return Device::DeviceSetupStatusSuccess;
}
// ON/OFF Button
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
if (device->deviceClassId() == toggleButtonDeviceClassId ) {
if (action.actionTypeId() == toggleButtonStateActionTypeId) {
device->setStateValue(toggleButtonStateStateTypeId, !device->stateValue(toggleButtonStateStateTypeId).toBool());
return DeviceManager::DeviceErrorNoError;
return Device::DeviceErrorNoError;
}
return DeviceManager::DeviceErrorActionTypeNotFound;
return Device::DeviceErrorActionTypeNotFound;
}
// Button
if (device->deviceClassId() == buttonDeviceClassId ) {
if (action.actionTypeId() == buttonButtonPressActionTypeId) {
emit emitEvent(Event(buttonButtonPressedEventTypeId, device->id()));
return DeviceManager::DeviceErrorNoError;
return Device::DeviceErrorNoError;
}
return DeviceManager::DeviceErrorActionTypeNotFound;
return Device::DeviceErrorActionTypeNotFound;
}
// ON/OFF Button
if (device->deviceClassId() == onOffButtonDeviceClassId ) {
if (action.actionTypeId() == onOffButtonOnActionTypeId) {
emit emitEvent(Event(onOffButtonOnEventTypeId, device->id()));
return DeviceManager::DeviceErrorNoError;
return Device::DeviceErrorNoError;
}
if (action.actionTypeId() == onOffButtonOffActionTypeId) {
emit emitEvent(Event(onOffButtonOffEventTypeId, device->id()));
return DeviceManager::DeviceErrorNoError;
return Device::DeviceErrorNoError;
}
return DeviceManager::DeviceErrorActionTypeNotFound;
return Device::DeviceErrorActionTypeNotFound;
}
return DeviceManager::DeviceErrorDeviceClassNotFound;
return Device::DeviceErrorDeviceClassNotFound;
}

View File

@ -23,7 +23,7 @@
#ifndef DEVICEPLUGINGENERICELEMENTS_H
#define DEVICEPLUGINGENERICELEMENTS_H
#include "plugin/deviceplugin.h"
#include "devices/deviceplugin.h"
class DevicePluginGenericElements : public DevicePlugin
{
@ -34,10 +34,10 @@ class DevicePluginGenericElements : public DevicePlugin
public:
explicit DevicePluginGenericElements();
DeviceManager::DeviceSetupStatus setupDevice(Device *device) override;
Device::DeviceSetupStatus setupDevice(Device *device) override;
public slots:
DeviceManager::DeviceError executeAction(Device *device, const Action &action) override;
Device::DeviceError executeAction(Device *device, const Action &action) override;
};