added conrad shutter
This commit is contained in:
parent
a7ca7621d4
commit
217e41ddad
@ -41,9 +41,9 @@
|
|||||||
|
|
||||||
#include "devicepluginconrad.h"
|
#include "devicepluginconrad.h"
|
||||||
|
|
||||||
#include "devicemanager.h"
|
|
||||||
#include "plugin/device.h"
|
#include "plugin/device.h"
|
||||||
#include "types/paramtype.h"
|
#include "devicemanager.h"
|
||||||
|
#include "plugininfo.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
@ -58,24 +58,49 @@ DeviceManager::HardwareResources DevicePluginConrad::requiredHardware() const
|
|||||||
return DeviceManager::HardwareResourceRadio433;
|
return DeviceManager::HardwareResourceRadio433;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DeviceManager::DeviceSetupStatus DevicePluginConrad::setupDevice(Device *device)
|
||||||
|
{
|
||||||
|
if (device->deviceClassId() == conradRemoteDeviceClassId) {
|
||||||
|
device->setName(device->paramValue("name").toString() + " (Conrad Remote)");
|
||||||
|
return DeviceManager::DeviceSetupStatusSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (device->deviceClassId() == conradShutterDeviceClassId) {
|
||||||
|
device->setName(device->paramValue("name").toString() + " (Conrad shutter RSM900R)");
|
||||||
|
return DeviceManager::DeviceSetupStatusSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
return DeviceManager::DeviceSetupStatusFailure;
|
||||||
|
}
|
||||||
|
|
||||||
DeviceManager::DeviceError DevicePluginConrad::executeAction(Device *device, const Action &action)
|
DeviceManager::DeviceError DevicePluginConrad::executeAction(Device *device, const Action &action)
|
||||||
{
|
{
|
||||||
|
|
||||||
QList<int> rawData;
|
QList<int> rawData;
|
||||||
QByteArray binCode;
|
QByteArray binCode;
|
||||||
|
|
||||||
if(action.param("power").value().toBool()){
|
int repetitions = 10;
|
||||||
binCode = "10010011";
|
|
||||||
}else{
|
if (action.actionTypeId() == upActionTypeId) {
|
||||||
binCode = "10100011";
|
binCode = "10101000";
|
||||||
|
} else if (action.actionTypeId() == downActionTypeId) {
|
||||||
|
binCode = "10100000";
|
||||||
|
} else if (action.actionTypeId() == syncActionTypeId) {
|
||||||
|
binCode = "10100000";
|
||||||
|
repetitions = 20;
|
||||||
|
} else {
|
||||||
|
return DeviceManager::DeviceErrorActionTypeNotFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
// append ID
|
// append ID
|
||||||
QByteArray remoteId = "100101010110011000000001";
|
binCode.append("100101010110011000000001");
|
||||||
QByteArray motionDetectorId = "100100100101101101101010";
|
|
||||||
QByteArray wallSwitchId = "000001001101000010110110";
|
//QByteArray remoteId = "100101010110011000000001";
|
||||||
QByteArray randomID = "100010101010111010101010";
|
// QByteArray motionDetectorId = "100100100101101101101010";
|
||||||
|
//QByteArray wallSwitchId = "000001001101000010110110";
|
||||||
|
// QByteArray randomID = "100010101010111010101010";
|
||||||
|
|
||||||
|
|
||||||
binCode.append(wallSwitchId);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -101,11 +126,11 @@ DeviceManager::DeviceError DevicePluginConrad::executeAction(Device *device, con
|
|||||||
|
|
||||||
// =======================================
|
// =======================================
|
||||||
// send data to driver
|
// send data to driver
|
||||||
if(transmitData(delay, rawData)){
|
if(transmitData(delay, rawData, repetitions)){
|
||||||
qDebug() << "action" << pluginName() << device->name() << "power: " << action.param("power").value().toBool();
|
qDebug() << "action" << pluginName() << device->name() << action.actionTypeId();
|
||||||
return DeviceManager::DeviceErrorNoError;
|
return DeviceManager::DeviceErrorNoError;
|
||||||
}else{
|
}else{
|
||||||
qDebug() << "could not transmitt" << pluginName() << device->name() << "power: " << action.param("power").value().toBool();
|
qDebug() << "could not transmitt" << pluginName() << device->name() << action.actionTypeId();
|
||||||
return DeviceManager::DeviceErrorHardwareNotAvailable;
|
return DeviceManager::DeviceErrorHardwareNotAvailable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,6 +32,7 @@ public:
|
|||||||
explicit DevicePluginConrad();
|
explicit DevicePluginConrad();
|
||||||
|
|
||||||
DeviceManager::HardwareResources requiredHardware() const override;
|
DeviceManager::HardwareResources requiredHardware() const override;
|
||||||
|
DeviceManager::DeviceSetupStatus setupDevice(Device *device) override;
|
||||||
void radioData(const QList<int> &rawData) override;
|
void radioData(const QList<int> &rawData) override;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|||||||
@ -9,6 +9,7 @@
|
|||||||
{
|
{
|
||||||
"deviceClassId": "17cd2492-28ab-4827-ba6e-5ef35be23f1b",
|
"deviceClassId": "17cd2492-28ab-4827-ba6e-5ef35be23f1b",
|
||||||
"name": "Conrad Remote",
|
"name": "Conrad Remote",
|
||||||
|
"idName": "conradRemote",
|
||||||
"createMethods": ["user"],
|
"createMethods": ["user"],
|
||||||
"paramTypes": [
|
"paramTypes": [
|
||||||
{
|
{
|
||||||
@ -20,6 +21,7 @@
|
|||||||
{
|
{
|
||||||
"id": "1f4050f5-4c90-4799-8d6d-e4069f3a2519",
|
"id": "1f4050f5-4c90-4799-8d6d-e4069f3a2519",
|
||||||
"name": "Button pressed",
|
"name": "Button pressed",
|
||||||
|
"idName": "remoteButtonPressed",
|
||||||
"paramTypes": [
|
"paramTypes": [
|
||||||
{
|
{
|
||||||
"name": "button",
|
"name": "button",
|
||||||
@ -36,6 +38,35 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"deviceClassId": "2bb14180-aa5d-4999-992d-e6d464cff486",
|
||||||
|
"name": "Conrad shutter RSM900R",
|
||||||
|
"idName": "conradShutter",
|
||||||
|
"createMethods": ["user"],
|
||||||
|
"paramTypes": [
|
||||||
|
{
|
||||||
|
"name": "name",
|
||||||
|
"type": "QString"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"actionTypes": [
|
||||||
|
{
|
||||||
|
"id": "e015419c-9df9-4bf5-a439-f1f32aedd1db",
|
||||||
|
"idName": "up",
|
||||||
|
"name": "Up"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "c58a463a-f765-4a61-b2e2-883cc23878c0",
|
||||||
|
"idName": "down",
|
||||||
|
"name": "Down"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "4125a18e-fa2d-4b25-acd1-e148d5d665f5",
|
||||||
|
"idName": "sync",
|
||||||
|
"name": "Send sync signal"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user