port new plugins to json system

This commit is contained in:
Michael Zanetti 2014-08-18 03:00:42 +02:00
parent dcd2fdc049
commit b252ff9706
43 changed files with 1601 additions and 1414 deletions

View File

@ -182,7 +182,7 @@ QPair<DeviceManager::DeviceError, QString> DeviceManager::discoverDevices(const
if (!deviceClass.isValid()) {
return qMakePair<DeviceError, QString>(DeviceManager::DeviceErrorDeviceClassNotFound, deviceClass.id().toString());
}
if (deviceClass.createMethod() != DeviceClass::CreateMethodDiscovery) {
if (!deviceClass.createMethods().testFlag(DeviceClass::CreateMethodDiscovery)) {
return qMakePair<DeviceError, QString>(DeviceManager::DeviceErrorCreationMethodNotSupported, "");
}
QPair<DeviceError, QString> result = verifyParams(deviceClass.discoveryParamTypes(), effectiveParams);
@ -223,7 +223,7 @@ QPair<DeviceManager::DeviceError, QString> DeviceManager::addConfiguredDevice(co
qWarning() << "cannot find a device class with id" << deviceClassId;
return qMakePair<DeviceError, QString>(DeviceErrorDeviceClassNotFound, deviceClassId.toString());
}
if (deviceClass.createMethod() == DeviceClass::CreateMethodUser) {
if (deviceClass.createMethods().testFlag(DeviceClass::CreateMethodUser)) {
return addConfiguredDeviceInternal(deviceClassId, params, id);
}
return qMakePair<DeviceError, QString>(DeviceErrorCreationMethodNotSupported, "CreateMethodUser");
@ -235,7 +235,7 @@ QPair<DeviceManager::DeviceError, QString> DeviceManager::addConfiguredDevice(co
if (!deviceClass.isValid()) {
return qMakePair<DeviceError, QString>(DeviceErrorDeviceClassNotFound, deviceClassId.toString());
}
if (deviceClass.createMethod() != DeviceClass::CreateMethodDiscovery) {
if (!deviceClass.createMethods().testFlag(DeviceClass::CreateMethodDiscovery)) {
return qMakePair<DeviceError, QString>(DeviceErrorCreationMethodNotSupported, "CreateMethodDiscovery");
}
@ -478,7 +478,7 @@ QPair<DeviceManager::DeviceError, QString> DeviceManager::executeAction(const Ac
qDebug() << "checking" << actionType.id() << action.actionTypeId();
if (actionType.id() == action.actionTypeId()) {
ParamList finalParams = action.params();
QPair<DeviceError, QString> paramCheck = verifyParams(actionType.parameters(), finalParams);
QPair<DeviceError, QString> paramCheck = verifyParams(actionType.paramTypes(), finalParams);
if (paramCheck.first != DeviceErrorNoError) {
return paramCheck;
}

View File

@ -43,7 +43,7 @@ DeviceClass::DeviceClass(const PluginId &pluginId, const VendorId &vendorId, con
m_id(id),
m_vendorId(vendorId),
m_pluginId(pluginId),
m_createMethod(CreateMethodUser),
m_createMethods(CreateMethodUser),
m_setupMethod(SetupMethodJustAdd)
{
@ -103,7 +103,7 @@ void DeviceClass::setStateTypes(const QList<StateType> &stateTypes)
EventType eventType(EventTypeId(stateType.id().toString()));
eventType.setName(QString("%1 changed").arg(stateType.name()));
ParamType paramType("value", stateType.type());
eventType.setParameters(QList<ParamType>() << paramType);
eventType.setParamTypes(QList<ParamType>() << paramType);
m_allEventTypes.append(eventType);
}
}
@ -126,7 +126,7 @@ void DeviceClass::setEventTypes(const QList<EventType> &eventTypes)
EventType eventType(EventTypeId(stateType.id().toString()));
eventType.setName(QString("%1 changed").arg(stateType.name()));
ParamType paramType("value", stateType.type());
eventType.setParameters(QList<ParamType>() << paramType);
eventType.setParamTypes(QList<ParamType>() << paramType);
m_allEventTypes.append(eventType);
}
}
@ -140,7 +140,7 @@ QList<ActionType> DeviceClass::actionTypes() const
/*! Set the \a actionTypes of this DeviceClass. \{Device}{Devices} created
from this DeviceClass must have their actions matching to this template. */
void DeviceClass::setActions(const QList<ActionType> &actionTypes)
void DeviceClass::setActionTypes(const QList<ActionType> &actionTypes)
{
m_actionTypes = actionTypes;
}
@ -169,14 +169,14 @@ void DeviceClass::setDiscoveryParamTypes(const QList<ParamType> &params)
m_discoveryParamTypes = params;
}
DeviceClass::CreateMethod DeviceClass::createMethod() const
DeviceClass::CreateMethods DeviceClass::createMethods() const
{
return m_createMethod;
return m_createMethods;
}
void DeviceClass::setCreateMethod(DeviceClass::CreateMethod createMethod)
void DeviceClass::setCreateMethods(DeviceClass::CreateMethods createMethods)
{
m_createMethod = createMethod;
m_createMethods = createMethods;
}
DeviceClass::SetupMethod DeviceClass::setupMethod() const

View File

@ -33,10 +33,12 @@ class DeviceClass
{
public:
enum CreateMethod {
CreateMethodUser,
CreateMethodAuto,
CreateMethodDiscovery
CreateMethodUser = 0x01,
CreateMethodAuto = 0x02,
CreateMethodDiscovery = 0x04
};
Q_DECLARE_FLAGS(CreateMethods, CreateMethod)
enum SetupMethod {
SetupMethodJustAdd,
SetupMethodDisplayPin,
@ -61,7 +63,7 @@ public:
void setEventTypes(const QList<EventType> &eventTypes);
QList<ActionType> actionTypes() const;
void setActions(const QList<ActionType> &actionTypes);
void setActionTypes(const QList<ActionType> &actionTypes);
QList<ParamType> paramTypes() const;
void setParamTypes(const QList<ParamType> &paramTypes);
@ -69,8 +71,8 @@ public:
QList<ParamType> discoveryParamTypes() const;
void setDiscoveryParamTypes(const QList<ParamType> &paramTypes);
CreateMethod createMethod() const;
void setCreateMethod(CreateMethod createMethod);
CreateMethods createMethods() const;
void setCreateMethods(CreateMethods createMethods);
SetupMethod setupMethod() const;
void setSetupMethod(SetupMethod setupMethod);
@ -90,7 +92,7 @@ private:
QList<ActionType> m_actionTypes;
QList<ParamType> m_paramTypes;
QList<ParamType> m_discoveryParamTypes;
CreateMethod m_createMethod;
CreateMethods m_createMethods;
SetupMethod m_setupMethod;
QString m_pairingInfo;
};

View File

@ -150,14 +150,20 @@ QList<DeviceClass> DevicePlugin::supportedDevices() const
QJsonObject jo = deviceClassJson.toObject();
DeviceClass deviceClass(pluginId(), vendorId, jo.value("deviceClassId").toString());
deviceClass.setName(jo.value("name").toString());
QString createMethod = jo.value("createMethod").toString();
if (createMethod == "discovery") {
deviceClass.setCreateMethod(DeviceClass::CreateMethodDiscovery);
} else if (createMethod == "auto") {
deviceClass.setCreateMethod(DeviceClass::CreateMethodAuto);
} else {
deviceClass.setCreateMethod(DeviceClass::CreateMethodUser);
DeviceClass::CreateMethods createMethods;
foreach (const QJsonValue &createMethodValue, jo.value("createMethods").toArray()) {
if (createMethodValue.toString() == "discovery") {
createMethods |= DeviceClass::CreateMethodDiscovery;
} else if (createMethodValue.toString() == "auto") {
createMethods |= DeviceClass::CreateMethodAuto;
} else {
createMethods |= DeviceClass::CreateMethodUser;
}
}
deviceClass.setCreateMethods(createMethods);
deviceClass.setDiscoveryParamTypes(parseParamTypes(jo.value("discoveryParamTypes").toArray()));
QString setupMethod = jo.value("setupMethod").toString();
if (setupMethod == "pushButton") {
deviceClass.setSetupMethod(DeviceClass::SetupMethodPushButton);
@ -169,21 +175,7 @@ QList<DeviceClass> DevicePlugin::supportedDevices() const
deviceClass.setSetupMethod(DeviceClass::SetupMethodJustAdd);
}
deviceClass.setPairingInfo(jo.value("pairingInfo").toString());
QList<ParamType> paramTypes;
foreach (const QJsonValue &paramTypesJson, jo.value("paramTypes").toArray()) {
QJsonObject pt = paramTypesJson.toObject();
QVariant::Type t = QVariant::nameToType(pt.value("type").toString().toLatin1().data());
ParamType paramType(pt.value("name").toString(), t, pt.value("defaultValue").toVariant());
QVariantList allowedValues;
foreach (const QJsonValue &allowedTypesJson, pt.value("allowedValues").toArray()) {
allowedValues.append(allowedTypesJson.toVariant());
}
paramType.setAllowedValues(allowedValues);
paramType.setLimits(pt.value("minValue").toVariant(), pt.value("maxValue").toVariant());
paramTypes.append(paramType);
}
deviceClass.setParamTypes(paramTypes);
deviceClass.setParamTypes(parseParamTypes(jo.value("paramTypes").toArray()));
QList<StateType> stateTypes;
qDebug() << "############### s" << jo;
@ -198,6 +190,27 @@ QList<DeviceClass> DevicePlugin::supportedDevices() const
}
deviceClass.setStateTypes(stateTypes);
QList<ActionType> actionTypes;
foreach (const QJsonValue &actionTypesJson, jo.value("actionTypes").toArray()) {
QJsonObject at = actionTypesJson.toObject();
ActionType actionType(at.value("id").toString());
actionType.setName(at.value("name").toString());
actionType.setParamTypes(parseParamTypes(at.value("paramTypes").toArray()));
qDebug() << "***got actionType" << actionType.id();
actionTypes.append(actionType);
}
deviceClass.setActionTypes(actionTypes);
QList<EventType> eventTypes;
foreach (const QJsonValue &eventTypesJson, jo.value("eventTypes").toArray()) {
QJsonObject et = eventTypesJson.toObject();
EventType eventType(et.value("id").toString());
eventType.setName(et.value("name").toString());
eventType.setParamTypes(parseParamTypes(et.value("paramTypes").toArray()));
eventTypes.append(eventType);
}
deviceClass.setEventTypes(eventTypes);
deviceClasses.append(deviceClass);
}
}
@ -274,6 +287,24 @@ void DevicePlugin::initPlugin(const QJsonObject &metaData, DeviceManager *device
init();
}
QList<ParamType> DevicePlugin::parseParamTypes(const QJsonArray &array) const
{
QList<ParamType> paramTypes;
foreach (const QJsonValue &paramTypesJson, array) {
QJsonObject pt = paramTypesJson.toObject();
QVariant::Type t = QVariant::nameToType(pt.value("type").toString().toLatin1().data());
ParamType paramType(pt.value("name").toString(), t, pt.value("defaultValue").toVariant());
QVariantList allowedValues;
foreach (const QJsonValue &allowedTypesJson, pt.value("allowedValues").toArray()) {
allowedValues.append(allowedTypesJson.toVariant());
}
paramType.setAllowedValues(allowedValues);
paramType.setLimits(pt.value("minValue").toVariant(), pt.value("maxValue").toVariant());
paramTypes.append(paramType);
}
return paramTypes;
}
/*!
Returns a map containing the plugin configuration.

View File

@ -96,6 +96,8 @@ protected:
private:
void initPlugin(const QJsonObject &metaData, DeviceManager *deviceManager);
QList<ParamType> parseParamTypes(const QJsonArray &array) const;
DeviceManager *m_deviceManager;
ParamList m_config;

View File

@ -59,14 +59,14 @@ void ActionType::setName(const QString &name)
/*! Returns the parameter description of this ActionType. \l{Action}{Actions} created
from this ActionType must have their parameters matching to this template. */
QList<ParamType> ActionType::parameters() const
QList<ParamType> ActionType::paramTypes() const
{
return m_parameters;
return m_paramTypes;
}
/*! Set the parameter description of this ActionType. \l{Action}{Actions} created
from this ActionType must have their \a parameters matching to this template. */
void ActionType::setParameters(const QList<ParamType> &parameters)
void ActionType::setParamTypes(const QList<ParamType> &paramTypes)
{
m_parameters = parameters;
m_paramTypes = paramTypes;
}

View File

@ -34,14 +34,14 @@ public:
QString name() const;
void setName(const QString &name);
QList<ParamType> parameters() const;
void setParameters(const QList<ParamType> &parameters);
QList<ParamType> paramTypes() const;
void setParamTypes(const QList<ParamType> &paramTypes);
private:
ActionTypeId m_id;
QString m_name;
QList<ParamType> m_parameters;
QList<ParamType> m_paramTypes;
};
#endif // ACTIONTYPE_H

View File

@ -56,16 +56,16 @@ void EventType::setName(const QString &name)
Holds a List describing possible parameters for a \l{Event} of this EventType.
e.g. QList(ParamType("temperature", QVariant::Real))
*/
QList<ParamType> EventType::parameters() const
QList<ParamType> EventType::paramTypes() const
{
return m_parameters;
return m_paramTypes;
}
/*!
Set the parameter description for this EventType to \a parameters,
e.g. QList<ParamType>() << ParamType("temperature", QVariant::Real))
*/
void EventType::setParameters(const QList<ParamType> &parameters)
void EventType::setParamTypes(const QList<ParamType> &paramTypes)
{
m_parameters = parameters;
m_paramTypes = paramTypes;
}

View File

@ -34,14 +34,14 @@ public:
QString name() const;
void setName(const QString &name);
QList<ParamType> parameters() const;
void setParameters(const QList<ParamType> &parameters);
QList<ParamType> paramTypes() const;
void setParamTypes(const QList<ParamType> &paramTypes);
private:
EventTypeId m_id;
QString m_name;
QList<ParamType> m_parameters;
QList<ParamType> m_paramTypes;
};

View File

@ -26,9 +26,6 @@
#include <QDebug>
#include <QStringList>
VendorId boblightVendorId = VendorId("8c5e8d4c-b5ed-4bfe-b30d-35c2790ec100");
PluginId boblightPluginUuid = PluginId("e1647872-c0f5-4680-b49b-3924e5b54dcd");
DeviceClassId boblightDeviceClassId = DeviceClassId("1647c61c-db14-461e-8060-8a3533d5d92f");
StateTypeId colorStateTypeId = StateTypeId("97ec80cd-43a9-40fa-93b7-d1580043d981");
ActionTypeId setColorActionTypeId = ActionTypeId("668e1aa3-fa13-49ce-8630-17a5c0a7c34b");
@ -39,51 +36,6 @@ DevicePluginBoblight::DevicePluginBoblight()
connect(this, &DevicePlugin::configValueChanged, this, &DevicePluginBoblight::connectToBoblight);
}
QList<Vendor> DevicePluginBoblight::supportedVendors() const
{
QList<Vendor> ret;
Vendor guh(boblightVendorId, "http://code.google.com/p/boblight/");
ret.append(guh);
return ret;
}
QList<DeviceClass> DevicePluginBoblight::supportedDevices() const
{
QList<DeviceClass> ret;
DeviceClass deviceClassBoblight(pluginId(), boblightVendorId, boblightDeviceClassId);
deviceClassBoblight.setName("Boblight");
deviceClassBoblight.setCreateMethod(DeviceClass::CreateMethodAuto);
QList<StateType> boblightStates;
StateType colorState(colorStateTypeId);
colorState.setName("color");
colorState.setType(QVariant::Color);
colorState.setDefaultValue(QColor(Qt::black));
boblightStates.append(colorState);
deviceClassBoblight.setStateTypes(boblightStates);
QList<ActionType> boblightActons;
ActionType setColorAction(setColorActionTypeId);
setColorAction.setName("Set color");
QList<ParamType> actionParamsSetColor;
ParamType actionParamSetColor("color", QVariant::Color);
actionParamsSetColor.append(actionParamSetColor);
setColorAction.setParameters(actionParamsSetColor);
boblightActons.append(setColorAction);
deviceClassBoblight.setActions(boblightActons);
ret.append(deviceClassBoblight);
return ret;
}
DeviceManager::HardwareResources DevicePluginBoblight::requiredHardware() const
{
return DeviceManager::HardwareResourceNone;

View File

@ -35,8 +35,6 @@ class DevicePluginBoblight : public DevicePlugin
public:
explicit DevicePluginBoblight();
QList<Vendor> supportedVendors() const override;
QList<DeviceClass> supportedDevices() const override;
DeviceManager::HardwareResources requiredHardware() const override;
void startMonitoringAutoDevices() override;

View File

@ -1 +1,37 @@
{}
{
"name": "Boblight",
"id": "8c5e8d4c-b5ed-4bfe-b30d-35c2790ec100",
"vendors": [
{
"name": "Boblight",
"id": "e1647872-c0f5-4680-b49b-3924e5b54dcd",
"deviceClasses": [
{
"deviceClassId": "1647c61c-db14-461e-8060-8a3533d5d92f",
"name": "Boblight",
"createMethods": ["auto"],
"stateTypes": [
{
"id": "97ec80cd-43a9-40fa-93b7-d1580043d981",
"name": "color",
"type": "QColor",
"defaultValue": "#000000"
}
],
"actionTypes": [
{
"id": "668e1aa3-fa13-49ce-8630-17a5c0a7c34b",
"name": "Set color",
"paramTypes": [
{
"name": "color",
"type": "QColor"
}
]
}
]
}
]
}
]
}

View File

@ -67,50 +67,6 @@ DevicePluginConrad::DevicePluginConrad()
{
}
//QList<DeviceClass> DevicePluginConrad::supportedDevices() const
//{
// // TODO: load list from config with static uuid
// QList<DeviceClass> ret;
// // =======================================
// // Remote
// DeviceClass deviceClassConradRemote(pluginId(), supportedVendors().first().id(), conradRemoteId);
// deviceClassConradRemote.setName("Conrad Remote");
// // Params
// QList<ParamType> deviceParamsRemote;
// QVariantList deviceParamRemote;
// QVariantMap nameParam;
// nameParam.insert("name", "name");
// nameParam.insert("type", "string");
// deviceParamRemote.append(nameParam);
// // Events
// QList<EventType> buttonEvents;
// QList<ParamType> paramsRemote;
// ParamType paramButton("button", QVariant::Int);
// paramsRemote.append(paramButton);
// ParamType paramGroup("group", QVariant::Int);
// paramsRemote.append(paramGroup);
// ParamType paramPower("power", QVariant::Bool);
// paramsRemote.append(paramPower);
// EventType buttonEvent(conradRemoteButtonEventTypeId);
// buttonEvent.setName("Button Pressed");
// buttonEvent.setParameters(paramsRemote);
// buttonEvents.append(buttonEvent);
// deviceClassConradRemote.setParamTypes(deviceParamsRemote);
// deviceClassConradRemote.setEventTypes(buttonEvents);
// ret.append(deviceClassConradRemote);
// return ret;
//}
DeviceManager::HardwareResources DevicePluginConrad::requiredHardware() const
{
return DeviceManager::HardwareResourceRadio433;

View File

@ -4,7 +4,40 @@
"vendors": [
{
"name": "Conrad Electronic SE",
"id": "986cf06f-3ef1-4271-b2a3-2cc277ebecb6"
"id": "986cf06f-3ef1-4271-b2a3-2cc277ebecb6",
"deviceClasses": [
{
"deviceClassId": "17cd2492-28ab-4827-ba6e-5ef35be23f1b",
"name": "Conrad Remote",
"createMethods": ["user"],
"paramTypes": [
{
"name": "name",
"type": "QString"
}
],
"eventTypes": [
{
"id": "1f4050f5-4c90-4799-8d6d-e4069f3a2519",
"name": "Button pressed",
"paramTypes": [
{
"name": "button",
"type": "int"
},
{
"name": "group",
"type": "int"
},
{
"name": "power",
"type": "bool"
}
]
}
]
}
]
}
]
}

View File

@ -56,12 +56,6 @@
#include <QDebug>
#include <QStringList>
VendorId elroVendorId = VendorId("435a13a0-65ca-4f0c-94c1-e5873b258db5");
VendorId mumbiVendorId = VendorId("5f91c01c-0168-4bdf-a5ed-37cb6971b775");
VendorId vivancoVendorId = VendorId("3826a836-ba69-4e50-8408-bb827fc92128");
VendorId brennenstuhlVendorId = VendorId("4ac9dd1f-9ca9-4a76-aae1-3e91cfb86f5b");
VendorId batVendorId = VendorId("30115ad4-c83d-454a-a483-c781c951d3b6");
DeviceClassId elroRemoteId = DeviceClassId("d85c1ef4-197c-4053-8e40-707aa671d302");
DeviceClassId elroSwitchId = DeviceClassId("308ae6e6-38b3-4b3a-a513-3199da2764f8");
DeviceClassId elroMotionDetectorId = DeviceClassId("4c64aee6-7a4f-41f2-b278-edc55f0da0d3");
@ -72,135 +66,6 @@ DevicePluginElro::DevicePluginElro()
}
//QList<Vendor> DevicePluginElro::supportedVendors() const
//{
// QList<Vendor> ret;
// ret.append(Vendor(elroVendorId, "Elro"));
// ret.append(Vendor(mumbiVendorId, "Mumbi"));
// ret.append(Vendor(vivancoVendorId, "Vivanco"));
// ret.append(Vendor(brennenstuhlVendorId, "Brennenstuhl"));
// ret.append(Vendor(batVendorId, "BAT"));
// return ret;
//}
//QList<DeviceClass> DevicePluginElro::supportedDevices() const
//{
// // TODO: load list from config with static uuid
// QList<DeviceClass> ret;
// // =======================================
// // Remote
// qDebug() << "have supported vendors" << supportedVendors().count();
// DeviceClass deviceClassElroRemote(pluginId(), supportedVendors().first().id(), elroRemoteId);
// deviceClassElroRemote.setName("Elro Remote");
// QList<ParamType> deviceParamsRemote;
// ParamType channelParam = ParamType("channel1", QVariant::Bool);
// deviceParamsRemote.append(channelParam);
// channelParam = ParamType("channel2", QVariant::Bool);
// deviceParamsRemote.append(channelParam);
// channelParam = ParamType("channel3", QVariant::Bool);
// deviceParamsRemote.append(channelParam);
// channelParam = ParamType("channel4", QVariant::Bool);
// deviceParamsRemote.append(channelParam);
// channelParam = ParamType("channel5", QVariant::Bool);
// deviceParamsRemote.append(channelParam);
// deviceClassElroRemote.setParamTypes(deviceParamsRemote);
// QList<EventType> buttonEvents;
// QList<ParamType> paramsRemote;
// ParamType param("power", QVariant::Bool);
// paramsRemote.append(param);
// EventType buttonAEvent(EventTypeId("9dd3f862-35f3-4b69-954e-fa3c8bd68e39"));
// buttonAEvent.setName("A");
// buttonAEvent.setParameters(paramsRemote);
// buttonEvents.append(buttonAEvent);
// EventType buttonBEvent(EventTypeId("733226eb-91ba-4e37-9d78-12c87eb5e763"));
// buttonBEvent.setName("B");
// buttonBEvent.setParameters(paramsRemote);
// buttonEvents.append(buttonBEvent);
// EventType buttonCEvent(EventTypeId("47aaeaec-485a-4775-a543-33f339fd28c8"));
// buttonCEvent.setName("C");
// buttonCEvent.setParameters(paramsRemote);
// buttonEvents.append(buttonCEvent);
// EventType buttonDEvent(EventTypeId("db3d484c-add9-44ab-80a4-a0664e0c87c8"));
// buttonDEvent.setName("D");
// buttonDEvent.setParameters(paramsRemote);
// buttonEvents.append(buttonDEvent);
// EventType buttonEEvent(EventTypeId("eb914aac-fb73-4ee2-9f1b-c34b2f6cc24a"));
// buttonEEvent.setName("E");
// buttonEEvent.setParameters(paramsRemote);
// buttonEvents.append(buttonEEvent);
// deviceClassElroRemote.setEventTypes(buttonEvents);
// ret.append(deviceClassElroRemote);
// // =======================================
// // Motion Detector
// DeviceClass deviceClassElroMotionDetector(pluginId(), supportedVendors().first().id(), elroMotionDetectorId);
// deviceClassElroMotionDetector.setName("Elro Motion Detector");
// deviceClassElroMotionDetector.setCreateMethod(DeviceClass::CreateMethodDiscovery);
// QList<EventType> motionDetectorEvents;
// QList<ParamType> deviceParamsMotionDetector;
// // =======================================
// // Switch
// DeviceClass deviceClassElroSwitch(pluginId(), supportedVendors().first().id(), elroSwitchId);
// deviceClassElroSwitch.setName("Elro Power Switch");
// QList<ParamType> deviceParamsSwitch;
// ParamType paramSwitch = ParamType("channel1", QVariant::Bool);
// deviceParamsSwitch.append(paramSwitch);
// paramSwitch = ParamType("channel2", QVariant::Bool);
// deviceParamsSwitch.append(paramSwitch);
// paramSwitch = ParamType("channel3", QVariant::Bool);
// deviceParamsSwitch.append(paramSwitch);
// paramSwitch = ParamType("channel4", QVariant::Bool);
// deviceParamsSwitch.append(paramSwitch);
// paramSwitch = ParamType("channel5", QVariant::Bool);
// deviceParamsSwitch.append(paramSwitch);
// paramSwitch = ParamType("A", QVariant::Bool);
// deviceParamsSwitch.append(paramSwitch);
// paramSwitch = ParamType("B", QVariant::Bool);
// deviceParamsSwitch.append(paramSwitch);
// paramSwitch = ParamType("C", QVariant::Bool);
// deviceParamsSwitch.append(paramSwitch);
// paramSwitch = ParamType("D", QVariant::Bool);
// deviceParamsSwitch.append(paramSwitch);
// paramSwitch = ParamType("E", QVariant::Bool);
// deviceParamsSwitch.append(paramSwitch);
// deviceClassElroSwitch.setParamTypes(deviceParamsSwitch);
// QList<ParamType> actionParamsSwitch;
// ParamType actionParamSwitch("power", QVariant::Bool);
// actionParamsSwitch.append(actionParamSwitch);
// QList<ActionType> switchActions;
// ActionType powerAction(ActionTypeId("31c9758e-6567-4f89-85bb-29e1a7c55d44"));
// powerAction.setName("power");
// powerAction.setParameters(actionParamsSwitch);
// switchActions.append(powerAction);
// deviceClassElroSwitch.setActions(switchActions);
// ret.append(deviceClassElroSwitch);
// return ret;
//}
DeviceManager::HardwareResources DevicePluginElro::requiredHardware() const
{
return DeviceManager::HardwareResourceRadio433;

View File

@ -4,11 +4,168 @@
"vendors": [
{
"name": "Electronic Roos",
"id": "435a13a0-65ca-4f0c-94c1-e5873b258db5"
"id": "435a13a0-65ca-4f0c-94c1-e5873b258db5",
"deviceClasses": [
{
"deviceClassId": "d85c1ef4-197c-4053-8e40-707aa671d302",
"name": "Elro Remote",
"createMethods": ["user"],
"paramTypes": [
{
"name": "channel1",
"type": "bool"
},
{
"name": "channel2",
"type": "bool"
},
{
"name": "channel3",
"type": "bool"
},
{
"name": "channel4",
"type": "bool"
},
{
"name": "channel5",
"type": "bool"
}
],
"eventTypes": [
{
"id": "9dd3f862-35f3-4b69-954e-fa3c8bd68e39",
"name": "A",
"paramTypes": [
{
"name": "power",
"type": "bool"
}
]
},
{
"id": "733226eb-91ba-4e37-9d78-12c87eb5e763",
"name": "B",
"paramTypes": [
{
"name": "power",
"type": "bool"
}
]
},
{
"id": "47aaeaec-485a-4775-a543-33f339fd28c8",
"name": "C",
"paramTypes": [
{
"name": "power",
"type": "bool"
}
]
},
{
"id": "db3d484c-add9-44ab-80a4-a0664e0c87c8",
"name": "D",
"paramTypes": [
{
"name": "power",
"type": "bool"
}
]
},
{
"id": "eb914aac-fb73-4ee2-9f1b-c34b2f6cc24a",
"name": "E",
"paramTypes": [
{
"name": "power",
"type": "bool"
}
]
}
]
},
{
"deviceClassId": "308ae6e6-38b3-4b3a-a513-3199da2764f8",
"name": "Elro switch",
"createMethods": ["user"],
"paramTypes": [
{
"name": "channel1",
"type": "bool"
},
{
"name": "channel2",
"type": "bool"
},
{
"name": "channel3",
"type": "bool"
},
{
"name": "channel4",
"type": "bool"
},
{
"name": "channel5",
"type": "bool"
},
{
"name": "A",
"type": "bool"
},
{
"name": "B",
"type": "bool"
},
{
"name": "C",
"type": "bool"
},
{
"name": "D",
"type": "bool"
},
{
"name": "E",
"type": "bool"
}
],
"actionTypes": [
{
"id": "31c9758e-6567-4f89-85bb-29e1a7c55d44",
"name": "Set power",
"paramTypes": [
{
"name": "power",
"type": "bool"
}
]
}
]
},
{
"deviceClassId": "4c64aee6-7a4f-41f2-b278-edc55f0da0d3",
"name": "Elro motion detector",
"createMethods": ["discovery"]
}
]
},
{
"name": "Mumbi",
"id": "5f91c01c-0168-4bdf-a5ed-37cb6971b775"
},
{
"name": "Vivanco",
"id": "3826a836-ba69-4e50-8408-bb827fc92128"
},
{
"name": "Brennenstuhl",
"id": "4ac9dd1f-9ca9-4a76-aae1-3e91cfb86f5b"
},
{
"name": "BAT",
"id": "30115ad4-c83d-454a-a483-c781c951d3b6"
}
]
}

View File

@ -187,9 +187,6 @@
#include <QDebug>
VendorId eq3VendorId = VendorId("2cac0645-855e-44fa-837e-1cab0ae4304c");
PluginId eq3PluginUuid = PluginId("f324c43c-9680-48d8-852a-93b2227139b9");
DeviceClassId cubeDeviceClassId = DeviceClassId("1e892268-8bd7-442c-a001-bd4e2e6b2949");
StateTypeId connectionStateTypeId = StateTypeId("d0a9a369-cf8c-47c4-a12e-f2d076bf12fd");
@ -220,7 +217,6 @@ ActionTypeId setEcoModeActionTypeId = ActionTypeId("27a981e8-ec23-4ba8-921e-33b9
ActionTypeId displayCurrentTempActionTypeId = ActionTypeId("184fb112-7a03-4560-8634-0257c969c26e");
DeviceClassId radiatorThermostateDeviceClassId = DeviceClassId("f80d9481-4827-45ee-a013-b97b22412d92");
StateTypeId valvePositionStateTypeId = StateTypeId("72956000-0203-4c32-a6b6-3bb7e46c03ca");
StateTypeId offsetTempStateTypeId = StateTypeId("576da571-9a65-478f-96bf-19256c8b9ece");
StateTypeId windowOpenDurationStateTypeId = StateTypeId("81c6c74a-b0cd-4daa-9eb9-f1cd68f328af");
@ -230,6 +226,7 @@ StateTypeId discalcWeekDayStateTypeId = StateTypeId("bd6f5947-d4b4-444b-81c8-77e
StateTypeId discalcTimeStateTypeId = StateTypeId("e78235ee-affc-41e3-a463-9f0512b4a6c3");
StateTypeId valveMaximumSettingsStateTypeId = StateTypeId("e367fa3a-b30f-49bd-af3f-cff92360ad32");
StateTypeId valveOffsetStateTypeId = StateTypeId("ffaff87b-b741-4db8-9875-3380af4f1885");
StateTypeId valvePositionStateTypeId = StateTypeId("72956000-0203-4c32-a6b6-3bb7e46c03ca");
DevicePluginEQ3::DevicePluginEQ3()
@ -239,341 +236,11 @@ DevicePluginEQ3::DevicePluginEQ3()
connect(m_cubeDiscovery,SIGNAL(cubesDetected(QList<MaxCube*>)),this,SLOT(discoveryDone(QList<MaxCube*>)));
}
QList<Vendor> DevicePluginEQ3::supportedVendors() const
{
QList<Vendor> ret;
Vendor eq3(eq3VendorId, "eQ-3");
ret.append(eq3);
return ret;
}
QList<DeviceClass> DevicePluginEQ3::supportedDevices() const
{
QList<DeviceClass> ret;
// ===========================================
// Cube
DeviceClass cubeDeviceClass(pluginId(),eq3VendorId,cubeDeviceClassId);
cubeDeviceClass.setName("Max! Cube LAN Gateway");
cubeDeviceClass.setCreateMethod(DeviceClass::CreateMethodDiscovery);
cubeDeviceClass.setSetupMethod(DeviceClass::SetupMethodJustAdd);
// Params
QList<ParamType> params;
ParamType hostParam("host address", QVariant::String);
params.append(hostParam);
ParamType portParam("port", QVariant::Int);
params.append(portParam);
ParamType serialNumberParam("serial number", QVariant::String);
params.append(serialNumberParam);
ParamType firmwareParam("firmware version", QVariant::Int);
params.append(firmwareParam);
cubeDeviceClass.setParamTypes(params);
// States
QList<StateType> states;
StateType connectedState(connectionStateTypeId);
connectedState.setName("connected");
connectedState.setType(QVariant::Bool);
connectedState.setDefaultValue(false);
states.append(connectedState);
StateType portalEnabeld(portalEnabeldStateTypeId);
portalEnabeld.setName("portal enabled");
portalEnabeld.setType(QVariant::Bool);
portalEnabeld.setDefaultValue(false);
states.append(portalEnabeld);
cubeDeviceClass.setStateTypes(states);
// ===========================================
// Wall thermostate
DeviceClass wallThermostateDeviceClass(pluginId(), eq3VendorId, wallThermostateDeviceClassId);
wallThermostateDeviceClass.setName("Max! Wall Thermostat");
wallThermostateDeviceClass.setCreateMethod(DeviceClass::CreateMethodAuto);
// Params
QList<ParamType> paramsWallThermostate;
paramsWallThermostate.append(serialNumberParam);
ParamType deviceName("name",QVariant::String);
paramsWallThermostate.append(deviceName);
ParamType parentCube("parent cube",QVariant::String);
paramsWallThermostate.append(parentCube);
ParamType rfAddress("rf address",QVariant::String);
paramsWallThermostate.append(rfAddress);
ParamType roomNumber("room id",QVariant::Int);
paramsWallThermostate.append(roomNumber);
ParamType roomName("room name",QVariant::String);
paramsWallThermostate.append(roomName);
wallThermostateDeviceClass.setParamTypes(paramsWallThermostate);
// Actions
QList<ActionType> actions;
ActionType setSetpointTemp(setSetpointTemperatureActionTypeId);
setSetpointTemp.setName("set setpoint temperature [Celsius]");
QList<ParamType> actionParamsSetSetpointTemp;
ParamType actionParamSetpointTemperature("setpoint temperature", QVariant::Double);
actionParamsSetSetpointTemp.append(actionParamSetpointTemperature);
setSetpointTemp.setParameters(actionParamsSetSetpointTemp);
actions.append(setSetpointTemp);
ActionType setAutoMode(setAutoModeActionTypeId);
setAutoMode.setName("set Auto mode");
actions.append(setAutoMode);
ActionType setManuelMode(setManuelModeActionTypeId);
setManuelMode.setName("set Manuel mode");
actions.append(setAutoMode);
ActionType setEcoMode(setEcoModeActionTypeId);
setEcoMode.setName("set Eco mode");
actions.append(setEcoMode);
ActionType displayCurrentTemp(displayCurrentTempActionTypeId);
displayCurrentTemp.setName("display current temperature");
QList<ParamType> actionParamsDisplayCurrentTemp;
ParamType actionParamDisplayCurrentTemp("display", QVariant::Bool);
actionParamsDisplayCurrentTemp.append(actionParamDisplayCurrentTemp);
displayCurrentTemp.setParameters(actionParamsDisplayCurrentTemp);
actions.append(displayCurrentTemp);
wallThermostateDeviceClass.setActions(actions);
// States
QList<StateType> statesWallThermostat;
StateType confortTemp(confortTempStateTypeId);
confortTemp.setName("confort temperature [Celsius]");
confortTemp.setType(QVariant::Double);
confortTemp.setDefaultValue(0.0);
statesWallThermostat.append(confortTemp);
StateType ecoTemp(ecoTempStateTypeId);
ecoTemp.setName("eco temperature [Celsius]");
ecoTemp.setType(QVariant::Double);
ecoTemp.setDefaultValue(0.0);
statesWallThermostat.append(ecoTemp);
StateType minSetpointTemp(minSetpointTempStateTypeId);
minSetpointTemp.setName("min setpoint temperature [Celsius]");
minSetpointTemp.setType(QVariant::Double);
minSetpointTemp.setDefaultValue(0.0);
statesWallThermostat.append(minSetpointTemp);
StateType maxSetpointTemp(maxSetpointTempStateTypeId);
maxSetpointTemp.setName("max setpoint temperature [Celsius]");
maxSetpointTemp.setType(QVariant::Double);
maxSetpointTemp.setDefaultValue(0.0);
statesWallThermostat.append(maxSetpointTemp);
StateType errorOccured(errorOccuredStateTypeId);
errorOccured.setName("error occured");
errorOccured.setType(QVariant::Bool);
errorOccured.setDefaultValue(false);
statesWallThermostat.append(errorOccured);
StateType initialized(initializedStateTypeId);
initialized.setName("initialized");
initialized.setType(QVariant::Bool);
initialized.setDefaultValue(false);
statesWallThermostat.append(initialized);
StateType batteryLow(batteryLowStateTypeId);
batteryLow.setName("battery low");
batteryLow.setType(QVariant::Bool);
batteryLow.setDefaultValue(false);
statesWallThermostat.append(batteryLow);
StateType linkStatusOK(linkStatusOKStateTypeId);
linkStatusOK.setName("link status to cube");
linkStatusOK.setType(QVariant::Bool);
linkStatusOK.setDefaultValue(false);
statesWallThermostat.append(linkStatusOK);
StateType panelLocked(panelLockedStateTypeId);
panelLocked.setName("pannel locked");
panelLocked.setType(QVariant::Bool);
panelLocked.setDefaultValue(false);
statesWallThermostat.append(panelLocked);
StateType gatewayKnown(gatewayKnownStateTypeId);
gatewayKnown.setName("gateway knows");
gatewayKnown.setType(QVariant::Bool);
gatewayKnown.setDefaultValue(false);
statesWallThermostat.append(gatewayKnown);
StateType dtsActive(dtsActiveStateTypeId);
dtsActive.setName("DTS active");
dtsActive.setType(QVariant::Bool);
dtsActive.setDefaultValue(false);
statesWallThermostat.append(dtsActive);
StateType deviceMode(deviceModeStateTypeId);
deviceMode.setName("device mode");
deviceMode.setType(QVariant::Int);
deviceMode.setDefaultValue(-1);
statesWallThermostat.append(deviceMode);
StateType deviceModeString(deviceModeStringStateTypeId);
deviceModeString.setName("device mode string");
deviceModeString.setType(QVariant::String);
deviceModeString.setDefaultValue("");
statesWallThermostat.append(deviceModeString);
StateType setpointTemp(setpointTempStateTypeId);
setpointTemp.setName("setpoint temperature [Celsius]");
setpointTemp.setType(QVariant::Double);
setpointTemp.setDefaultValue("0.0");
statesWallThermostat.append(setpointTemp);
StateType currentTemp(currentTemperatureStateTypeId);
currentTemp.setName("current temperature [Celsius]");
currentTemp.setType(QVariant::Double);
currentTemp.setDefaultValue(0.0);
statesWallThermostat.append(currentTemp);
wallThermostateDeviceClass.setStateTypes(statesWallThermostat);
// ===========================================
// Radiator thermostat
DeviceClass radiatorThermostateDeviceClass(pluginId(), eq3VendorId, radiatorThermostateDeviceClassId);
radiatorThermostateDeviceClass.setName("Max! Radiator Thermostat");
radiatorThermostateDeviceClass.setCreateMethod(DeviceClass::CreateMethodAuto);
// Params
QList<ParamType> paramsRadiatorThermostate;
paramsRadiatorThermostate.append(serialNumberParam);
paramsRadiatorThermostate.append(deviceName);
paramsRadiatorThermostate.append(parentCube);
paramsRadiatorThermostate.append(rfAddress);
paramsRadiatorThermostate.append(roomNumber);
paramsWallThermostate.append(roomName);
radiatorThermostateDeviceClass.setParamTypes(paramsRadiatorThermostate);
// Actions
QList<ActionType> actionsRadiator;
actionsRadiator.append(setSetpointTemp);
actionsRadiator.append(setAutoMode);
actionsRadiator.append(setManuelMode);
actionsRadiator.append(setEcoMode);
radiatorThermostateDeviceClass.setActions(actionsRadiator);
// States
QList<StateType> statesRadiatorThermostat;
statesRadiatorThermostat.append(confortTemp);
statesRadiatorThermostat.append(ecoTemp);
statesRadiatorThermostat.append(minSetpointTemp);
statesRadiatorThermostat.append(maxSetpointTemp);
statesRadiatorThermostat.append(errorOccured);
statesRadiatorThermostat.append(initialized);
statesRadiatorThermostat.append(panelLocked);
statesRadiatorThermostat.append(batteryLow);
statesRadiatorThermostat.append(linkStatusOK);
statesRadiatorThermostat.append(gatewayKnown);
statesRadiatorThermostat.append(dtsActive);
statesRadiatorThermostat.append(deviceMode);
statesRadiatorThermostat.append(deviceModeString);
statesRadiatorThermostat.append(setpointTemp);
StateType offsetTemp(offsetTempStateTypeId);
offsetTemp.setName("offset temperature [Celsius]");
offsetTemp.setType(QVariant::Double);
offsetTemp.setDefaultValue(0.0);
statesRadiatorThermostat.append(offsetTemp);
StateType windowOpenDuration(windowOpenDurationStateTypeId);
windowOpenDuration.setName("window open duration [Minutes]");
windowOpenDuration.setType(QVariant::Int);
windowOpenDuration.setDefaultValue(0);
statesRadiatorThermostat.append(windowOpenDuration);
StateType boostValveValue(boostValueValueStateTypeId);
boostValveValue.setName("boost valve value [%]");
boostValveValue.setType(QVariant::Int);
boostValveValue.setDefaultValue(0);
statesRadiatorThermostat.append(boostValveValue);
StateType boostDuration(boostDurationStateTypeId);
boostDuration.setName("boost duration [Minutes]");
boostDuration.setType(QVariant::Int);
boostDuration.setDefaultValue(0);
statesRadiatorThermostat.append(boostDuration);
StateType discalcWeekDay(discalcWeekDayStateTypeId);
discalcWeekDay.setName("discalc day");
discalcWeekDay.setType(QVariant::String);
discalcWeekDay.setDefaultValue("");
statesRadiatorThermostat.append(discalcWeekDay);
StateType discalcTime(discalcTimeStateTypeId);
discalcTime.setName("discalc time");
discalcTime.setType(QVariant::String);
discalcTime.setDefaultValue("");
statesRadiatorThermostat.append(discalcTime);
StateType maxValveSettings(valveMaximumSettingsStateTypeId);
maxValveSettings.setName("valve maximum settings");
maxValveSettings.setType(QVariant::Double);
maxValveSettings.setDefaultValue(0.0);
statesRadiatorThermostat.append(maxValveSettings);
StateType valveOffset(valveOffsetStateTypeId);
valveOffset.setName("valve offset [%]");
valveOffset.setType(QVariant::Int);
valveOffset.setDefaultValue(0);
statesRadiatorThermostat.append(valveOffset);
StateType valvePosition(valvePositionStateTypeId);
valvePosition.setName("valve position [%]");
valvePosition.setType(QVariant::Int);
valvePosition.setDefaultValue(0);
statesRadiatorThermostat.append(valvePosition);
radiatorThermostateDeviceClass.setStateTypes(statesRadiatorThermostat);
ret.append(cubeDeviceClass);
ret.append(wallThermostateDeviceClass);
ret.append(radiatorThermostateDeviceClass);
return ret;
}
DeviceManager::HardwareResources DevicePluginEQ3::requiredHardware() const
{
return DeviceManager::HardwareResourceTimer;
}
QString DevicePluginEQ3::pluginName() const
{
return "eQ-3";
}
PluginId DevicePluginEQ3::pluginId() const
{
return eq3PluginUuid;
}
QList<ParamType> DevicePluginEQ3::configurationDescription() const
{
QList<ParamType> params;

View File

@ -36,13 +36,8 @@ class DevicePluginEQ3: public DevicePlugin
public:
explicit DevicePluginEQ3();
QList<Vendor> supportedVendors() const override;
QList<DeviceClass> supportedDevices() const override;
DeviceManager::HardwareResources requiredHardware() const override;
QString pluginName() const override;
PluginId pluginId() const override;
QList<ParamType> configurationDescription() const override;
QPair<DeviceManager::DeviceError, QString> discoverDevices(const DeviceClassId &deviceClassId, const ParamList &params) override;

View File

@ -1 +1,402 @@
{}
{
"name": "eQ-3",
"id": "f324c43c-9680-48d8-852a-93b2227139b9",
"vendors": [
{
"name": "eQ-3",
"id": "2cac0645-855e-44fa-837e-1cab0ae4304c",
"deviceClasses": [
{
"deviceClassId": "1e892268-8bd7-442c-a001-bd4e2e6b2949",
"name": "Max! Cube LAN Gateway",
"createMethods": ["discovery"],
"paramTypes": [
{
"name": "host address",
"type": "QString"
},
{
"name": "port",
"type": "int"
},
{
"name": "serial number",
"type": "QString"
},
{
"name": "firmware version",
"type": "int"
}
],
"stateTypes": [
{
"id": "d0a9a369-cf8c-47c4-a12e-f2d076bf12fd",
"name": "connected",
"type": "bool",
"defaultValue": false
},
{
"id": "2c2367da-c229-40ed-9d47-a6e73cd6dc3b",
"name": "portal enabled",
"type": "bool",
"defaultValue": false
}
]
},
{
"deviceClassId": "ffbfec5d-06e8-4082-b62b-92cc5c3e8c4e",
"name": "Max! Wall Thermostat",
"createMethods": ["auto"],
"paramTypes": [
{
"name": "serial number",
"type": "QString"
},
{
"name": "name",
"type": "QString"
},
{
"name": "parent cube",
"type": "QString"
},
{
"name": "rf address",
"type": "QString"
},
{
"name": "room id",
"type": "int"
},
{
"name": "room name",
"type": "QString"
}
],
"actionTypes": [
{
"id": "9c1968ba-39f9-493d-9fe2-848fa86bd2f0",
"name": "set setpoint temperature",
"paramTypes": [
{
"name": "temperature",
"type": "double",
"defaultValue": 0
}
]
},
{
"id": "162b4b3d-9923-4f2c-a755-b50c8a06a6f0",
"name": "set auto mode"
},
{
"id": "8e604437-9f5b-4c17-b5b0-e2db6007af5b",
"name": "set manual mode"
},
{
"id": "27a981e8-ec23-4ba8-921e-33b911a7dd89",
"name": "set eco mode"
},
{
"id": "184fb112-7a03-4560-8634-0257c969c26e",
"name": "display current temperature",
"paramTypes": [
{
"name": "display",
"type": "bool",
"defaultValue": true
}
]
}
],
"stateTypes": [
{
"id": "850380ee-a787-43e7-adb8-768a21a6e64d",
"name": "comfort temperature",
"type": "double",
"defaultValue": 0
},
{
"id": "24dfd20d-bc8d-48e4-8162-b20ae0465c41",
"name": "eco temperature",
"type": "double",
"defaultValue": 0
},
{
"id": "a8536ddf-a6e4-41c2-89c1-e7102608f5f6",
"name": "max setpoint",
"type": "double",
"defaultValue": 0
},
{
"id": "ceb0ad05-37ad-4b79-a4d9-540c34a7e3e4",
"name": "min setpoint",
"type": "double",
"defaultValue": 0
},
{
"id": "9880247b-cf9a-453c-b0c3-d910eba8a253",
"name": "error occured",
"type": "bool",
"defaultValue": false
},
{
"id": "a9e29f03-063e-4686-8aac-2f6d8f8a4937",
"name": "initialized",
"type": "bool",
"defaultValue": false
},
{
"id": "53b89f32-8894-4290-92a0-6a470c6b69ab",
"name": "battery low",
"type": "bool",
"defaultValue": false
},
{
"id": "aff38be8-7ea6-4fd8-b0fa-e987ab05c719",
"name": "link status ok",
"type": "bool",
"defaultValue": false
},
{
"id": "979df197-09a1-46f9-9217-9d323b1062bd",
"name": "panel locked",
"type": "bool",
"defaultValue": false
},
{
"id": "1d6bd962-5c31-47ad-80a4-dda87bff98f5",
"name": "gateway known",
"type": "bool",
"defaultValue": false
},
{
"id": "1b402ba6-a8ae-45b1-8acf-2b0a89f71889",
"name": "dts active",
"type": "bool",
"defaultValue": false
},
{
"id": "639360f0-bb65-43e6-b227-50ae0ac39d6c",
"name": "device mode",
"type": "int",
"defaultValue": -1
},
{
"id": "ff5194e3-5641-4ac2-92c7-48c431b4a2eb",
"name": "device mode string",
"type": "QString"
},
{
"id": "579aa8c6-8814-491b-9e7c-b98108c323d1",
"name": "set point temp",
"type": "double",
"defaultValue": 0
},
{
"id": "852e7708-db1d-42d1-96e4-19c13598262c",
"name": "current temp",
"type": "double",
"defaultValue": 0
}
]
},
{
"deviceClassId": "f80d9481-4827-45ee-a013-b97b22412d92",
"name": "Max! Radiator Thermostat",
"createMethods": ["auto"],
"paramTypes": [
{
"name": "serial number",
"type": "QString"
},
{
"name": "name",
"type": "QString"
},
{
"name": "parent cube",
"type": "QString"
},
{
"name": "rf address",
"type": "QString"
},
{
"name": "room id",
"type": "int"
},
{
"name": "room name",
"type": "QString"
}
],
"actionTypes": [
{
"id": "9c1968ba-39f9-493d-9fe2-848fa86bd2f0",
"name": "set setpoint temperature",
"paramTypes": [
{
"name": "temperature",
"type": "double",
"defaultValue": 0
}
]
},
{
"id": "162b4b3d-9923-4f2c-a755-b50c8a06a6f0",
"name": "set auto mode"
},
{
"id": "8e604437-9f5b-4c17-b5b0-e2db6007af5b",
"name": "set manual mode"
},
{
"id": "27a981e8-ec23-4ba8-921e-33b911a7dd89",
"name": "set eco mode"
}
],
"stateTypes": [
{
"id": "850380ee-a787-43e7-adb8-768a21a6e64d",
"name": "comfort temperature",
"type": "double",
"defaultValue": 0
},
{
"id": "24dfd20d-bc8d-48e4-8162-b20ae0465c41",
"name": "eco temperature",
"type": "double",
"defaultValue": 0
},
{
"id": "a8536ddf-a6e4-41c2-89c1-e7102608f5f6",
"name": "max setpoint",
"type": "double",
"defaultValue": 0
},
{
"id": "ceb0ad05-37ad-4b79-a4d9-540c34a7e3e4",
"name": "min setpoint",
"type": "double",
"defaultValue": 0
},
{
"id": "9880247b-cf9a-453c-b0c3-d910eba8a253",
"name": "error occured",
"type": "bool",
"defaultValue": false
},
{
"id": "a9e29f03-063e-4686-8aac-2f6d8f8a4937",
"name": "initialized",
"type": "bool",
"defaultValue": false
},
{
"id": "53b89f32-8894-4290-92a0-6a470c6b69ab",
"name": "battery low",
"type": "bool",
"defaultValue": false
},
{
"id": "aff38be8-7ea6-4fd8-b0fa-e987ab05c719",
"name": "link status ok",
"type": "bool",
"defaultValue": false
},
{
"id": "979df197-09a1-46f9-9217-9d323b1062bd",
"name": "panel locked",
"type": "bool",
"defaultValue": false
},
{
"id": "1d6bd962-5c31-47ad-80a4-dda87bff98f5",
"name": "gateway known",
"type": "bool",
"defaultValue": false
},
{
"id": "1b402ba6-a8ae-45b1-8acf-2b0a89f71889",
"name": "dts active",
"type": "bool",
"defaultValue": false
},
{
"id": "639360f0-bb65-43e6-b227-50ae0ac39d6c",
"name": "device mode",
"type": "int",
"defaultValue": -1
},
{
"id": "ff5194e3-5641-4ac2-92c7-48c431b4a2eb",
"name": "device mode string",
"type": "QString"
},
{
"id": "579aa8c6-8814-491b-9e7c-b98108c323d1",
"name": "set point temp",
"type": "double",
"defaultValue": 0
},
{
"id": "576da571-9a65-478f-96bf-19256c8b9ece",
"name": "offset temperature",
"type": "double",
"defaultValue": 0
},
{
"id": "81c6c74a-b0cd-4daa-9eb9-f1cd68f328af",
"name": "window open duration",
"type": "int",
"defaultValue": 0
},
{
"id": "7c41fa64-b1a1-48d2-9d03-67aa16cd83ad",
"name": "boost valve value",
"type": "int",
"defaultValue": 0
},
{
"id": "e75c1398-9ad7-466c-b3b9-b03bbb686a30",
"name": "boost duration",
"type": "int",
"defaultValue": 0
},
{
"id": "bd6f5947-d4b4-444b-81c8-77eec46957e4",
"name": "discalc weekday",
"type": "QString",
"defaultValue": ""
},
{
"id": "e78235ee-affc-41e3-a463-9f0512b4a6c3",
"name": "discalc time",
"type": "QString",
"defaultValue": ""
},
{
"id": "e367fa3a-b30f-49bd-af3f-cff92360ad32",
"name": "valve maximum setting",
"type": "double",
"defaultValue": 0
},
{
"id": "ffaff87b-b741-4db8-9875-3380af4f1885",
"name": "valve offset %",
"type": "int",
"defaultValue": 0
},
{
"id": "72956000-0203-4c32-a6b6-3bb7e46c03ca",
"name": "valve position %",
"type": "int",
"defaultValue": 0
}
]
}
]
}
]
}

View File

@ -170,156 +170,6 @@ DevicePluginIntertechno::DevicePluginIntertechno()
{
}
//QList<DeviceClass> DevicePluginIntertechno::supportedDevices() const
//{
// QList<DeviceClass> ret;
// // =======================================
// // Remote
// DeviceClass deviceClassIntertechnoRemote(pluginId(), supportedVendors().first().id(), intertechnoRemote);
// deviceClassIntertechnoRemote.setName("Intertechno Remote");
// QList<ParamType> remoteParams;
// // family code = A-P
// ParamType familyParam("familyCode", QVariant::String);
// remoteParams.append(familyParam);
// deviceClassIntertechnoRemote.setParamTypes(remoteParams);
// QList<EventType> buttonEvents;
// QList<ParamType> paramsRemote;
// // on = true
// // off = false
// ParamType paramRemote("power", QVariant::Bool);
// paramsRemote.append(paramRemote);
// /* 1-16
// * ________________
// * | I | II|III| IV |
// * |---|---|---|----|
// * 1 | 1 | 5 | 9 | 13 |
// * 2 | 2 | 6 | 10| 14 |
// * 3 | 3 | 7 | 11| 15 |
// * 4 | 4 | 8 | 12| 16 |
// * |___|___|___|____|
// */
// EventType button1Event(EventTypeId("785c1b30-a3f2-4696-af7c-d532acf3d6f7"));
// button1Event.setName("1");
// button1Event.setParameters(paramsRemote);
// buttonEvents.append(button1Event);
// EventType button2Event(EventTypeId("1d42c850-7b43-452f-b205-e1aac14eb3ee"));
// button2Event.setName("2");
// button2Event.setParameters(paramsRemote);
// buttonEvents.append(button2Event);
// EventType button3Event(EventTypeId("77a4780e-2355-4a77-870d-2f675bf986ce"));
// button3Event.setName("3");
// button3Event.setParameters(paramsRemote);
// buttonEvents.append(button3Event);
// EventType button4Event(EventTypeId("bd6a8b4b-f946-4f3b-992f-e7cff10187b8"));
// button4Event.setName("4");
// button4Event.setParameters(paramsRemote);
// buttonEvents.append(button4Event);
// EventType button5Event(EventTypeId("0f20782e-0acc-45f1-8c42-5dc5f5b29f1b"));
// button5Event.setName("5");
// button5Event.setParameters(paramsRemote);
// buttonEvents.append(button5Event);
// EventType button6Event(EventTypeId("f7cb439a-0528-4905-9583-06b6bfeb3ba1"));
// button6Event.setName("6");
// button6Event.setParameters(paramsRemote);
// buttonEvents.append(button6Event);
// EventType button7Event(EventTypeId("a0b0d8d8-2b43-4897-98e0-05b6b408a950"));
// button7Event.setName("7");
// button7Event.setParameters(paramsRemote);
// buttonEvents.append(button7Event);
// EventType button8Event(EventTypeId("ae5833a2-bc43-4462-ae47-e45dac1fb0ce"));
// button8Event.setName("8");
// button8Event.setParameters(paramsRemote);
// buttonEvents.append(button8Event);
// EventType button9Event(EventTypeId("52c13828-d047-4256-b488-0bf84abbc87c"));
// button9Event.setName("9");
// button9Event.setParameters(paramsRemote);
// buttonEvents.append(button9Event);
// EventType button10Event(EventTypeId("22c5afbc-835e-47cc-8211-4429eb9d9fee"));
// button10Event.setName("10");
// button10Event.setParameters(paramsRemote);
// buttonEvents.append(button10Event);
// EventType button11Event(EventTypeId("6bec5cbc-8bfb-4c6c-8ac8-f8e7723fd5aa"));
// button11Event.setName("11");
// button11Event.setParameters(paramsRemote);
// buttonEvents.append(button11Event);
// EventType button12Event(EventTypeId("8b71edd2-8135-4c8b-bf44-380efadf1942"));
// button12Event.setName("12");
// button12Event.setParameters(paramsRemote);
// buttonEvents.append(button12Event);
// EventType button13Event(EventTypeId("192f36a4-1e58-41aa-9618-83d46e329a4b"));
// button13Event.setName("13");
// button13Event.setParameters(paramsRemote);
// buttonEvents.append(button13Event);
// EventType button14Event(EventTypeId("6c76de60-5e19-4a29-b027-e71e66caa2d6"));
// button14Event.setName("14");
// button14Event.setParameters(paramsRemote);
// buttonEvents.append(button14Event);
// EventType button15Event(EventTypeId("c2f56c10-1f81-4477-88fa-fc0f4a6383df"));
// button15Event.setName("15");
// button15Event.setParameters(paramsRemote);
// buttonEvents.append(button15Event);
// EventType button16Event(EventTypeId("5d2eb3f8-4cd4-4c71-9c0c-e0b685e168e4"));
// button16Event.setName("16");
// button16Event.setParameters(paramsRemote);
// buttonEvents.append(button16Event);
// deviceClassIntertechnoRemote.setEventTypes(buttonEvents);
// ret.append(deviceClassIntertechnoRemote);
// // =======================================
// // Switch
// DeviceClass deviceClassIntertechnoSwitch(pluginId(), supportedVendors().last().id(), intertechnoSwitch);
// deviceClassIntertechnoSwitch.setName("Intertechno Switch");
// QList<ParamType> switchDeviceParams;
// // button code = 1-16
// ParamType buttonParam("buttonCode", QVariant::Int);
// switchDeviceParams.append(familyParam);
// switchDeviceParams.append(buttonParam);
// deviceClassIntertechnoSwitch.setParamTypes(switchDeviceParams);
// QList<ActionType> switchActions;
// QList<ParamType> paramsSwitch;
// ParamType paramSwitch("power", QVariant::Bool);
// paramsSwitch.append(paramSwitch);
// ActionType switchActionPower(ActionTypeId("df19fb51-c3cd-4b95-8d88-ebbb535f4789"));
// switchActionPower.setName("power");
// switchActionPower.setParameters(paramsSwitch);
// switchActions.append(switchActionPower);
// deviceClassIntertechnoSwitch.setActions(switchActions);
// ret.append(deviceClassIntertechnoSwitch);
// return ret;
//}
DeviceManager::HardwareResources DevicePluginIntertechno::requiredHardware() const
{
return DeviceManager::HardwareResourceRadio433;

View File

@ -4,7 +4,213 @@
"vendors": [
{
"name": "Intertechno",
"id": "6a852bc2-34dd-4f4c-9ac9-dd4c32ddbcba"
"id": "6a852bc2-34dd-4f4c-9ac9-dd4c32ddbcba",
"deviceClasses": [
{
"deviceClassId": "ab73ad2f-6594-45a3-9063-8f72d365c5e5",
"name": "Intertechno Remote",
"createMethods": ["user"],
"paramTypes": [
{
"name": "familyCode",
"type": "QString",
"allowedValues": ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P"]
}
],
"eventTypes": [
{
"id": "785c1b30-a3f2-4696-af7c-d532acf3d6f7",
"name": "Button 1 pressed",
"paramTypes": [
{
"name": "power",
"type": "bool"
}
]
},
{
"id": "1d42c850-7b43-452f-b205-e1aac14eb3ee",
"name": "Button 2 pressed",
"paramTypes": [
{
"name": "power",
"type": "bool"
}
]
},
{
"id": "77a4780e-2355-4a77-870d-2f675bf986ce",
"name": "Button 3 pressed",
"paramTypes": [
{
"name": "power",
"type": "bool"
}
]
},
{
"id": "bd6a8b4b-f946-4f3b-992f-e7cff10187b8",
"name": "Button 4 pressed",
"paramTypes": [
{
"name": "power",
"type": "bool"
}
]
},
{
"id": "0f20782e-0acc-45f1-8c42-5dc5f5b29f1b",
"name": "Button 5 pressed",
"paramTypes": [
{
"name": "power",
"type": "bool"
}
]
},
{
"id": "f7cb439a-0528-4905-9583-06b6bfeb3ba1",
"name": "Button 6 pressed",
"paramTypes": [
{
"name": "power",
"type": "bool"
}
]
},
{
"id": "a0b0d8d8-2b43-4897-98e0-05b6b408a950",
"name": "Button 7 pressed",
"paramTypes": [
{
"name": "power",
"type": "bool"
}
]
},
{
"id": "ae5833a2-bc43-4462-ae47-e45dac1fb0ce",
"name": "Button 8 pressed",
"paramTypes": [
{
"name": "power",
"type": "bool"
}
]
},
{
"id": "52c13828-d047-4256-b488-0bf84abbc87c",
"name": "Button 9 pressed",
"paramTypes": [
{
"name": "power",
"type": "bool"
}
]
},
{
"id": "22c5afbc-835e-47cc-8211-4429eb9d9fee",
"name": "Button 10 pressed",
"paramTypes": [
{
"name": "power",
"type": "bool"
}
]
},
{
"id": "6bec5cbc-8bfb-4c6c-8ac8-f8e7723fd5aa",
"name": "Button 11 pressed",
"paramTypes": [
{
"name": "power",
"type": "bool"
}
]
},
{
"id": "8b71edd2-8135-4c8b-bf44-380efadf1942",
"name": "Button 12 pressed",
"paramTypes": [
{
"name": "power",
"type": "bool"
}
]
},
{
"id": "192f36a4-1e58-41aa-9618-83d46e329a4b",
"name": "Button 13 pressed",
"paramTypes": [
{
"name": "power",
"type": "bool"
}
]
},
{
"id": "6c76de60-5e19-4a29-b027-e71e66caa2d6",
"name": "Button 14 pressed",
"paramTypes": [
{
"name": "power",
"type": "bool"
}
]
},
{
"id": "c2f56c10-1f81-4477-88fa-fc0f4a6383df",
"name": "Button 15 pressed",
"paramTypes": [
{
"name": "power",
"type": "bool"
}
]
},
{
"id": "5d2eb3f8-4cd4-4c71-9c0c-e0b685e168e4",
"name": "Button 16 pressed",
"paramTypes": [
{
"name": "power",
"type": "bool"
}
]
}
]
},
{
"deviceClassId": "324219e8-7c53-41b5-b314-c2900cd15252",
"name": "Intertechno switch",
"createMethods": ["user"],
"paramTypes": [
{
"name": "familyCode",
"type": "QString",
"allowedValues": ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P"]
},
{
"name": "button",
"type": "int",
"minimumValue": 1,
"maximumValue": 16
}
],
"actionTypes": [
{
"id": "df19fb51-c3cd-4b95-8d88-ebbb535f4789",
"name": "Set power",
"paramTypes": [
{
"name": "power",
"type": "bool"
}
]
}
]
}
]
}
]
}

View File

@ -23,7 +23,6 @@
#include <QDebug>
VendorId lgVendorId = VendorId("a9af9673-78db-4226-a16b-f34b304f7041");
DeviceClassId lgSmartTvDeviceClassId = DeviceClassId("1d41b5a8-74ff-4a12-b365-c7bbe610848f");
StateTypeId tvReachableStateTypeId = StateTypeId("b056c36b-df87-4177-8d5d-1e7c1e8cdc7a");
@ -66,183 +65,6 @@ DevicePluginLgSmartTv::DevicePluginLgSmartTv()
connect(m_discovery,SIGNAL(discoveryDone(QList<TvDevice*>)),this,SLOT(discoveryDone(QList<TvDevice*>)));
}
QList<Vendor> DevicePluginLgSmartTv::supportedVendors() const
{
QList<Vendor> ret;
Vendor lgVendor(lgVendorId, "LG");
ret.append(lgVendor);
return ret;
}
QList<DeviceClass> DevicePluginLgSmartTv::supportedDevices() const
{
QList<DeviceClass> ret;
DeviceClass deviceClassLgSmartTv(pluginId(), lgVendorId, lgSmartTvDeviceClassId);
deviceClassLgSmartTv.setName("LG Smart Tv");
deviceClassLgSmartTv.setCreateMethod(DeviceClass::CreateMethodDiscovery);
//deviceClassLgSmartTv.setSetupMethod(DeviceClass::SetupMethodDisplayPin);
// TODO: display pin...
// Params
QList<ParamType> paramTypes;
paramTypes.append(ParamType("name", QVariant::String));
paramTypes.append(ParamType("uuid", QVariant::String));
paramTypes.append(ParamType("model", QVariant::String));
paramTypes.append(ParamType("host address", QVariant::String));
paramTypes.append(ParamType("port", QVariant::Int));
paramTypes.append(ParamType("location", QVariant::String));
paramTypes.append(ParamType("manufacturer", QVariant::String));
paramTypes.append(ParamType("key", QVariant::String));
deviceClassLgSmartTv.setParamTypes(paramTypes);
// States
QList<StateType> tvStates;
StateType reachableState(tvReachableStateTypeId);
reachableState.setName("reachable");
reachableState.setType(QVariant::Bool);
reachableState.setDefaultValue(false);
tvStates.append(reachableState);
StateType tv3DModeState(tv3DModeStateTypeId);
tv3DModeState.setName("3D Mode");
tv3DModeState.setType(QVariant::Bool);
tv3DModeState.setDefaultValue(false);
tvStates.append(tv3DModeState);
StateType tvVolumeLevelState(tvVolumeLevelStateTypeId);
tvVolumeLevelState.setName("volume level");
tvVolumeLevelState.setType(QVariant::Int);
tvVolumeLevelState.setDefaultValue(-1);
tvStates.append(tvVolumeLevelState);
StateType tvMuteState(tvMuteStateTypeId);
tvMuteState.setName("mute");
tvMuteState.setType(QVariant::Bool);
tvMuteState.setDefaultValue(false);
tvStates.append(tvMuteState);
StateType tvChannelTypeState(tvChannelTypeStateTypeId);
tvChannelTypeState.setName("channel type");
tvChannelTypeState.setType(QVariant::String);
tvChannelTypeState.setDefaultValue("");
tvStates.append(tvChannelTypeState);
StateType tvChannelNameState(tvChannelNameStateTypeId);
tvChannelNameState.setName("channel name");
tvChannelNameState.setType(QVariant::String);
tvChannelNameState.setDefaultValue("");
tvStates.append(tvChannelNameState);
StateType tvChannelNumberState(tvChannelNumberStateTypeId);
tvChannelNumberState.setName("channel number");
tvChannelNumberState.setType(QVariant::Int);
tvChannelNumberState.setDefaultValue(-1);
tvStates.append(tvChannelNumberState);
StateType tvProgramNameState(tvProgramNameStateTypeId);
tvProgramNameState.setName("program name");
tvProgramNameState.setType(QVariant::String);
tvProgramNameState.setDefaultValue("");
tvStates.append(tvProgramNameState);
StateType tvInputSourceIndexState(tvInputSourceIndexStateTypeId);
tvInputSourceIndexState.setName("input source index");
tvInputSourceIndexState.setType(QVariant::Int);
tvInputSourceIndexState.setDefaultValue(-1);
tvStates.append(tvInputSourceIndexState);
StateType tvInputSourceLabelNameState(tvInputSourceLabelNameStateTypeId);
tvInputSourceLabelNameState.setName("input source label");
tvInputSourceLabelNameState.setType(QVariant::String);
tvInputSourceLabelNameState.setDefaultValue("");
tvStates.append(tvInputSourceLabelNameState);
deviceClassLgSmartTv.setStateTypes(tvStates);
// Actions
QList<ActionType> tvActions;
ActionType commandVolumeUpAction(commandVolumeUpActionTypeId);
commandVolumeUpAction.setName("volume up");
tvActions.append(commandVolumeUpAction);
ActionType commandVolumeDownAction(commandVolumeDownActionTypeId);
commandVolumeDownAction.setName("volume down");
tvActions.append(commandVolumeDownAction);
ActionType commandMuteAction(commandMuteActionTypeId);
commandMuteAction.setName("mute");
tvActions.append(commandMuteAction);
ActionType commandChannelUpAction(commandChannelUpActionTypeId);
commandChannelUpAction.setName("channel up");
tvActions.append(commandChannelUpAction);
ActionType commandChannelDownAction(commandChannelDownActionTypeId);
commandChannelDownAction.setName("channel down");
tvActions.append(commandChannelDownAction);
ActionType commandPowerOffAction(commandPowerOffActionTypeId);
commandPowerOffAction.setName("power");
tvActions.append(commandPowerOffAction);
ActionType commandArrowUpAction(commandArrowUpActionTypeId);
commandArrowUpAction.setName("arrow up");
tvActions.append(commandArrowUpAction);
ActionType commandArrowDownAction(commandArrowDownActionTypeId);
commandArrowDownAction.setName("arrow down");
tvActions.append(commandArrowDownAction);
ActionType commandArrowLeftAction(commandArrowLeftActionTypeId);
commandArrowLeftAction.setName("arrow left");
tvActions.append(commandArrowLeftAction);
ActionType commandArrowRightAction(commandArrowRightActionTypeId);
commandArrowRightAction.setName("arrow right");
tvActions.append(commandArrowRightAction);
ActionType commandOkAction(commandOkActionTypeId);
commandOkAction.setName("ok");
tvActions.append(commandOkAction);
ActionType commandBackAction(commandBackActionTypeId);
commandBackAction.setName("back");
tvActions.append(commandBackAction);
ActionType commandHomeAction(commandHomeActionTypeId);
commandHomeAction.setName("home");
tvActions.append(commandHomeAction);
ActionType commandInputSourceAction(commandInputSourceActionTypeId);
commandInputSourceAction.setName("input source");
tvActions.append(commandInputSourceAction);
ActionType commandExitAction(commandExitActionTypeId);
commandExitAction.setName("exit");
tvActions.append(commandExitAction);
ActionType commandInfoAction(commandInfoActionTypeId);
commandInfoAction.setName("info");
tvActions.append(commandInfoAction);
ActionType commandMyAppsAction(commandMyAppsActionTypeId);
commandMyAppsAction.setName("my apps");
tvActions.append(commandMyAppsAction);
ActionType commandProgramListAction(commandProgramListActionTypeId);
commandProgramListAction.setName("program list");
tvActions.append(commandProgramListAction);
deviceClassLgSmartTv.setActions(tvActions);
ret.append(deviceClassLgSmartTv);
return ret;
}
QPair<DeviceManager::DeviceError, QString> DevicePluginLgSmartTv::discoverDevices(const DeviceClassId &deviceClassId, const ParamList &params)
{
qDebug() << "should discover devices with params:" << params;
@ -380,16 +202,6 @@ void DevicePluginLgSmartTv::deviceRemoved(Device *device)
tvDevice->deleteLater();
}
QString DevicePluginLgSmartTv::pluginName() const
{
return "LG Smart Tv";
}
PluginId DevicePluginLgSmartTv::pluginId() const
{
return PluginId("4ef7a68b-9da0-4c62-b9ac-f478dc6f9f52");
}
void DevicePluginLgSmartTv::guhTimer()
{
foreach (TvDevice *tvDevice, m_tvList.keys()) {

View File

@ -34,9 +34,6 @@ public:
TvDiscovery *m_discovery;
QList<Vendor> supportedVendors() const override;
QList<DeviceClass> supportedDevices() const override;
QPair<DeviceManager::DeviceError, QString> discoverDevices(const DeviceClassId &deviceClassId, const ParamList &params) override;
QPair<DeviceManager::DeviceSetupStatus, QString> setupDevice(Device *device) override;
DeviceManager::HardwareResources requiredHardware() const override;
@ -44,9 +41,6 @@ public:
void deviceRemoved(Device *device) override;
QString pluginName() const override;
PluginId pluginId() const override;
void guhTimer() override;
QHash<TvDevice*, Device*> m_tvList;

View File

@ -1 +1,187 @@
{}
{
"name": "LG Smart Tv",
"id": "4ef7a68b-9da0-4c62-b9ac-f478dc6f9f52",
"vendors": [
{
"name": "LG",
"id": "a9af9673-78db-4226-a16b-f34b304f7041",
"deviceClasses": [
{
"deviceClassId": "1d41b5a8-74ff-4a12-b365-c7bbe610848f",
"name": "LG Smart Tv",
"createMethods": ["discovery"],
"paramTypes": [
{
"name": "name",
"type": "QString"
},
{
"name": "uuid",
"type": "QString"
},
{
"name": "model",
"type": "QString"
},
{
"name": "host address",
"type": "QString"
},
{
"name": "port",
"type": "int"
},
{
"name": "location",
"type": "QString"
},
{
"name": "manufacturer",
"type": "QString"
},
{
"name": "key",
"type": "QString"
}
],
"stateTypes": [
{
"id": "b056c36b-df87-4177-8d5d-1e7c1e8cdc7a",
"name": "reachable",
"type": "bool",
"defaultValue": false
},
{
"id": "8ad3d77f-d340-495d-8c2a-5569a80e9d36",
"name": "3D mode",
"type": "bool",
"defaultValue": false
},
{
"id": "07d39a6e-7eab-42d0-851d-9f3bcd3bbb57",
"name": "volume level",
"type": "int",
"defaultValue": 0
},
{
"id": "a6ac9061-3de7-403a-a646-790ca5d73764",
"name": "mute",
"type": "bool",
"defaultValue": false
},
{
"id": "84c86670-77c7-4fc6-9e23-abca066e76aa",
"name": "tv channel type",
"type": "QString"
},
{
"id": "265dc5f7-3f4d-4002-a6fe-2a53986bcf1d",
"name": "channel name",
"type": "QString"
},
{
"id": "881629a3-4ce2-42ba-8ce6-10d90c383799",
"name": "channel number",
"type": "int",
"defaultValue": 0
},
{
"id": "3f53e52e-1ad7-40e7-8080-76908e720cac",
"name": "program name",
"type": "QString"
},
{
"id": "e895017a-139f-410c-bfb2-4d008104e164",
"name": "input source index",
"type": "int",
"defaultValue": 0
},
{
"id": "58b734ec-2269-4c57-99e1-e1eeee401053",
"name": "input source label",
"type": "QString"
}
],
"actionTypes": [
{
"id": "ac5d7dcd-dfe8-4a94-9ab9-21b3f804b39e",
"name": "volume up"
},
{
"id": "62b17bec-f461-4ffa-93d1-67a9430d55e1",
"name": "volume down"
},
{
"id": "1aa9d7f0-0f66-4b90-bb72-f6b7b2118221",
"name": "mute"
},
{
"id": "b7e31999-ba67-443d-8e5c-ec104af987bd",
"name": "unmute"
},
{
"id": "acd1f6a0-2cfa-4665-9607-cf94245ec5a3",
"name": "channel up"
},
{
"id": "6ea66772-0e6d-40b1-978c-a01fb53871dd",
"name": "channel down"
},
{
"id": "cbe41134-ff11-4916-815b-3ac289c64090",
"name": "power off"
},
{
"id": "57c483b4-4ddf-4470-828c-8d8767e7a923",
"name": "arrow up"
},
{
"id": "614cf1af-5cf7-4bb2-885c-4414078d8899",
"name": "arrow down"
},
{
"id": "916394dd-7833-4875-8d7a-49d7d24ceeb2",
"name": "arrow left"
},
{
"id": "01e3df1e-638b-4e14-ba85-660267766062",
"name": "arrow right"
},
{
"id": "257dfa59-0d38-4e18-a3fc-213809fdb12f",
"name": "OK"
},
{
"id": "ce4184b3-6b8e-4fc3-a4cb-7b8ec72f2ce9",
"name": "back"
},
{
"id": "33f941c1-f5fc-4449-b6e3-93eafca493e0",
"name": "home"
},
{
"id": "9a6e5111-95d3-49ac-8056-249e704b1509",
"name": "input source"
},
{
"id": "d76efdb8-056e-4b39-a839-2ef6d6001b00",
"name": "exit"
},
{
"id": "9c1290d5-3135-4124-a576-fc7522cffdcf",
"name": "info"
},
{
"id": "47d65cac-fe75-4c36-9dee-9862c1c1130e",
"name": "my apps"
},
{
"id": "9aa3a97e-505d-4906-9764-14b6dc4e31e8",
"name": "program list"
}
]
}
]
}
]
}

View File

@ -37,54 +37,6 @@ DevicePluginLircd::DevicePluginLircd()
connect(m_lircClient, &LircClient::buttonPressed, this, &DevicePluginLircd::buttonPressed);
}
//QList<DeviceClass> DevicePluginLircd::supportedDevices() const
//{
// QList<DeviceClass> ret;
// DeviceClass deviceClassLircd(pluginId(), supportedVendors().first().id(), lircdDeviceClassId);
// deviceClassLircd.setName("IR Receiver");
// QList<ParamType> params;
// ParamType remoteNameParam("remoteName", QVariant::String);
// params.append(remoteNameParam);
// deviceClassLircd.setParamTypes(params);
// // TODO: find a way to load this stuff from a json file, really!
// // Ideally that file can be generated from /usr/share/lirc/remotes/*
// // Note that the IDs need to be kept static!
// QList<ParamType> repeatParam;
// ParamType repeatParamMap("repeat", QVariant::Int);
// repeatParam.append(repeatParamMap);
// QList<EventType> events;
// EventType powerButton(EventTypeId("d62d779f-e5c6-4767-98e6-efe9c062b662"));
// powerButton.setName("Power");
// powerButton.setParameters(repeatParam);
// events.append(powerButton);
// EventType yellowButton(EventTypeId("3313f62e-ea20-47f5-85af-28897d6ac440"));
// yellowButton.setName("Yellow");
// yellowButton.setParameters(repeatParam);
// events.append(yellowButton);
// EventType blueButton(EventTypeId("9a395d93-e482-4fa2-b4bc-e60bb4bf8652"));
// blueButton.setName("Blue");
// blueButton.setParameters(repeatParam);
// events.append(blueButton);
// EventType greenButton(EventTypeId("e8aaf18e-dc11-40da-980d-4eec42c58267"));
// greenButton.setName("Green");
// greenButton.setParameters(repeatParam);
// events.append(greenButton);
// EventType redButton(EventTypeId("b8518755-55a0-4cd4-8856-1680848edcb7"));
// redButton.setName("Red");
// redButton.setParameters(repeatParam);
// events.append(redButton);
// deviceClassLircd.setEventTypes(events);
// ret.append(deviceClassLircd);
// return ret;
//}
DeviceManager::HardwareResources DevicePluginLircd::requiredHardware() const
{
return DeviceManager::HardwareResourceNone;
@ -106,16 +58,13 @@ void DevicePluginLircd::buttonPressed(const QString &remoteName, const QString &
}
qDebug() << "found remote" << remoteName << supportedDevices().first().eventTypes().count();
foreach (const EventType &eventType, supportedDevices().first().eventTypes()) {
if (eventType.name() == buttonName) {
ParamList params;
Param param("repeat", repeat);
params.append(param);
Event event(eventType.id(), remote->id(), params);
emitEvent(event);
}
}
ParamList params;
Param buttonParam("button", buttonName);
params.append(buttonParam);
Param repeatParam("repeat", repeat);
params.append(repeatParam);
Event event(LircKeypressEventTypeId, remote->id(), params);
emitEvent(event);
}
//QVariantMap DevicePluginLircd::configuration() const

View File

@ -4,7 +4,36 @@
"vendors": [
{
"name": "Lirc",
"id": "9a53049c-8828-4b87-b3f6-7bc7708196cd"
"id": "9a53049c-8828-4b87-b3f6-7bc7708196cd",
"deviceClasses": [
{
"deviceClassId": "5c2bc4cd-ba6c-4052-b6cd-1db83323ea22",
"name": "IR receiver",
"createMethods": ["user"],
"paramTypes": [
{
"name": "remoteName",
"type": "QString"
}
],
"eventTypes": [
{
"id": "8711471a-fa0e-410b-b174-dfc3d2aeffb1",
"name": "Button pressed",
"paramTypes": [
{
"name": "button",
"type": "string"
},
{
"name": "repeat",
"type": "int"
}
]
}
]
}
]
}
]
}

View File

@ -4,7 +4,17 @@
"vendors": [
{
"name": "guh",
"id": "2062d64d-3232-433c-88bc-0d33c0ba2ba6"
"id": "2062d64d-3232-433c-88bc-0d33c0ba2ba6",
"deviceClasses": [
{
"deviceClassId": "3869884a-1592-4b8f-84a7-994be18ff555",
"name": "GMail",
"createMethods": ["user"],
"paramTypes": [
]
}
]
}
]
}

View File

@ -26,11 +26,6 @@
#include <QStringList>
DeviceClassId mockDeviceClassId = DeviceClassId("753f0d32-0468-4d08-82ed-1964aab03298");
DeviceClassId mockDeviceAutoClassId = DeviceClassId("ab4257b3-7548-47ee-9bd4-7dc3004fd197");
DeviceClassId mockDeviceDiscoveryClassId = DeviceClassId("1bbaf751-36b7-4d3d-b05a-58dab2a3be8c");
DeviceClassId mockDeviceAsyncSetupClassId = DeviceClassId("c08a8b27-8200-413d-b96b-4cff78b864d9");
DeviceClassId mockDeviceBrokenClassId = DeviceClassId("ba5fb404-c9ce-4db4-8cd4-f48c61c24b13");
DeviceClassId mockDeviceBrokenAsyncSetupClassId = DeviceClassId("bd5b78c5-53c9-4417-8eac-8ab2bce97bd0");
EventTypeId mockEvent1Id = EventTypeId("45bf3752-0fc6-46b9-89fd-ffd878b5b22b");
EventTypeId mockEvent2Id = EventTypeId("863d5920-b1cf-4eb9-88bd-8f7b8583b1cf");
StateTypeId mockIntStateId = StateTypeId("80baec19-54de-4948-ac46-31eabfaceb83");
@ -49,154 +44,6 @@ DevicePluginMock::~DevicePluginMock()
{
}
//QList<DeviceClass> DevicePluginMock::supportedDevices() const
//{
// QList<DeviceClass> ret;
// DeviceClass deviceClassMock(pluginId(), supportedVendors().first().id(), mockDeviceClassId);
// deviceClassMock.setName("Mock Device");
// QList<ParamType> mockParams;
// ParamType portParam("httpport", QVariant::Int);
// mockParams.append(portParam);
// deviceClassMock.setParamTypes(mockParams);
// QList<StateType> mockStates;
// StateType intState(mockIntStateId);
// intState.setName("Dummy int state");
// intState.setType(QVariant::Int);
// intState.setDefaultValue(10);
// mockStates.append(intState);
// StateType boolState(mockBoolStateId);
// boolState.setName("Dummy bool state");
// boolState.setType(QVariant::Int);
// boolState.setDefaultValue(false);
// mockStates.append(boolState);
// deviceClassMock.setStateTypes(mockStates);
// QList<EventType> mockEvents;
// EventType event1(mockEvent1Id);
// event1.setName("Mock Event 1");
// mockEvents.append(event1);
// EventType event2(mockEvent2Id);
// event2.setName("Mock Event 2");
// QList<ParamType> event2ParamTypes;
// ParamType event2Param1Type("mockParamInt", QVariant::Int, 42);
// event2ParamTypes.append(event2Param1Type);
// event2.setParameters(event2ParamTypes);
// mockEvents.append(event2);
// deviceClassMock.setEventTypes(mockEvents);
// QList<ActionType> mockActions;
// mockParams.clear();
// ActionType action1(mockActionIdWithParams);
// action1.setName("Mock Action 1 (with params)");
// ParamType mockActionParam1("mockActionParam1", QVariant::Int);
// mockParams.append(mockActionParam1);
// ParamType mockActionParam2("mockActionParam2", QVariant::Bool);
// mockParams.append(mockActionParam2);
// action1.setParameters(mockParams);
// mockActions.append(action1);
// ActionType action2(mockActionIdNoParams);
// action2.setName("Mock Action 3 (without params)");
// mockActions.append(action2);
// ActionType action3(mockActionIdAsync);
// action3.setName("Mock Action 3 (async)");
// mockActions.append(action3);
// ActionType action4(mockActionIdFailing);
// action4.setName("Mock Action 4 (broken)");
// mockActions.append(action4);
// ActionType action5(mockActionIdAsyncFailing);
// action5.setName("Mock Action 5 (async, broken)");
// mockActions.append(action4);
// deviceClassMock.setActions(mockActions);
// ret.append(deviceClassMock);
// // Auto created mock device
// DeviceClass deviceClassMockAuto(pluginId(), supportedVendors().first().id(), mockDeviceAutoClassId);
// deviceClassMockAuto.setName("Mock Device (Auto created)");
// deviceClassMockAuto.setCreateMethod(DeviceClass::CreateMethodAuto);
// mockParams.clear();
// deviceClassMockAuto.setParamTypes(mockParams);
// deviceClassMockAuto.setStateTypes(mockStates);
// deviceClassMockAuto.setEventTypes(mockEvents);
// deviceClassMockAuto.setActions(mockActions);
// ret.append(deviceClassMockAuto);
// // Discovery created device
// DeviceClass deviceClassMockDiscovery(pluginId(), supportedVendors().first().id(), mockDeviceDiscoveryClassId);
// deviceClassMockDiscovery.setName("Mock Device (Discovery created)");
// deviceClassMockDiscovery.setCreateMethod(DeviceClass::CreateMethodDiscovery);
// QList<ParamType> paramTypes;
// ParamType paramType = ParamType("resultCount", QVariant::Int, 2);
// paramType.setAllowedValues(QList<QVariant>() << 1 << 2);
// paramTypes.append(paramType);
// deviceClassMockDiscovery.setDiscoveryParamTypes(paramTypes);
// mockParams.clear();
// mockParams.append(portParam);
// deviceClassMockDiscovery.setParamTypes(mockParams);
// deviceClassMockDiscovery.setStateTypes(mockStates);
// deviceClassMockDiscovery.setEventTypes(mockEvents);
// deviceClassMockDiscovery.setActions(mockActions);
// ret.append(deviceClassMockDiscovery);
// // Async setup device
// DeviceClass deviceClassMockAsync(pluginId(), supportedVendors().first().id(), mockDeviceAsyncSetupClassId);
// deviceClassMockAsync.setName("Mock Device (Async)");
// deviceClassMockAsync.setCreateMethod(DeviceClass::CreateMethodUser);
// deviceClassMockAsync.setParamTypes(mockParams);
// deviceClassMockAsync.setStateTypes(mockStates);
// deviceClassMockAsync.setEventTypes(mockEvents);
// deviceClassMockAsync.setActions(mockActions);
// ret.append(deviceClassMockAsync);
// // Async setup device
// DeviceClass deviceClassMockBroken(pluginId(), supportedVendors().first().id(), mockDeviceBrokenClassId);
// deviceClassMockBroken.setName("Mock Device (Broken setup)");
// deviceClassMockBroken.setCreateMethod(DeviceClass::CreateMethodUser);
// deviceClassMockBroken.setParamTypes(mockParams);
// deviceClassMockBroken.setStateTypes(mockStates);
// deviceClassMockBroken.setEventTypes(mockEvents);
// deviceClassMockBroken.setActions(mockActions);
// ret.append(deviceClassMockBroken);
// // Broken Async setup device
// DeviceClass deviceClassMockBrokenAsyncSetup(pluginId(), supportedVendors().first().id(), mockDeviceBrokenAsyncSetupClassId);
// deviceClassMockBrokenAsyncSetup.setName("Mock Device (Async Broken setup)");
// deviceClassMockBrokenAsyncSetup.setCreateMethod(DeviceClass::CreateMethodUser);
// deviceClassMockBrokenAsyncSetup.setParamTypes(mockParams);
// deviceClassMockBrokenAsyncSetup.setStateTypes(mockStates);
// deviceClassMockBrokenAsyncSetup.setEventTypes(mockEvents);
// deviceClassMockBrokenAsyncSetup.setActions(mockActions);
// ret.append(deviceClassMockBrokenAsyncSetup);
// return ret;
//}
DeviceManager::HardwareResources DevicePluginMock::requiredHardware() const
{
return DeviceManager::HardwareResourceTimer;
@ -205,7 +52,7 @@ DeviceManager::HardwareResources DevicePluginMock::requiredHardware() const
QPair<DeviceManager::DeviceError, QString> DevicePluginMock::discoverDevices(const DeviceClassId &deviceClassId, const ParamList &params)
{
Q_UNUSED(deviceClassId)
Q_UNUSED(params)
qDebug() << "starting mock discovery:" << params;
m_discoveredDeviceCount = params.paramValue("resultCount").toInt();
QTimer::singleShot(1000, this, SLOT(emitDevicesDiscovered()));
return report(DeviceManager::DeviceErrorNoError);
@ -213,9 +60,9 @@ QPair<DeviceManager::DeviceError, QString> DevicePluginMock::discoverDevices(con
QPair<DeviceManager::DeviceSetupStatus, QString> DevicePluginMock::setupDevice(Device *device)
{
qDebug() << "Mockdevice created returning true" << device->paramValue("httpport").toInt();
qDebug() << "Mockdevice created returning true" << device->paramValue("httpport").toInt() << device->paramValue("async").toBool() << device->paramValue("broken").toBool();
if (device->deviceClassId() == mockDeviceBrokenClassId) {
if (device->paramValue("broken").toBool()) {
return reportDeviceSetup(DeviceManager::DeviceSetupStatusFailure, "This device is intentionally broken.");
}
@ -230,7 +77,7 @@ QPair<DeviceManager::DeviceSetupStatus, QString> DevicePluginMock::setupDevice(D
connect(daemon, &HttpDaemon::triggerEvent, this, &DevicePluginMock::triggerEvent);
connect(daemon, &HttpDaemon::setState, this, &DevicePluginMock::setState);
if (device->deviceClassId() == mockDeviceAsyncSetupClassId || device->deviceClassId() == mockDeviceBrokenAsyncSetupClassId) {
if (device->paramValue("async").toBool()) {
m_asyncSetupDevices.append(device);
QTimer::singleShot(1000, this, SLOT(emitDeviceSetupFinished()));
return reportDeviceSetup(DeviceManager::DeviceSetupStatusAsync);
@ -246,12 +93,12 @@ void DevicePluginMock::deviceRemoved(Device *device)
void DevicePluginMock::startMonitoringAutoDevices()
{
foreach (Device *device, myDevices()) {
if (device->deviceClassId() == mockDeviceAutoClassId) {
if (device->paramValue("auto").toBool()) {
return; // We already have a Auto Mock device... do nothing.
}
}
DeviceDescriptor mockDescriptor(mockDeviceAutoClassId, "Mock Device (Auto created)");
DeviceDescriptor mockDescriptor(mockDeviceClassId, "Mock Device (Auto created)");
ParamList params;
qsrand(QDateTime::currentMSecsSinceEpoch());
@ -263,7 +110,7 @@ void DevicePluginMock::startMonitoringAutoDevices()
QList<DeviceDescriptor> deviceDescriptorList;
deviceDescriptorList.append(mockDescriptor);
emit autoDevicesAppeared(mockDeviceAutoClassId, deviceDescriptorList);
emit autoDevicesAppeared(mockDeviceClassId, deviceDescriptorList);
}
QList<ParamType> DevicePluginMock::configurationDescription() const
@ -332,7 +179,7 @@ void DevicePluginMock::emitDevicesDiscovered()
QList<DeviceDescriptor> deviceDescriptors;
if (m_discoveredDeviceCount > 0) {
DeviceDescriptor d1(mockDeviceDiscoveryClassId, "Mock Device (Discovered)");
DeviceDescriptor d1(mockDeviceClassId, "Mock Device (Discovered)");
ParamList params;
Param httpParam("httpport", "55555");
params.append(httpParam);
@ -341,7 +188,7 @@ void DevicePluginMock::emitDevicesDiscovered()
}
if (m_discoveredDeviceCount > 1) {
DeviceDescriptor d2(mockDeviceDiscoveryClassId, "Mock Device (Discovered)");
DeviceDescriptor d2(mockDeviceClassId, "Mock Device (Discovered)");
ParamList params;
Param httpParam("httpport", "55556");
params.append(httpParam);
@ -349,17 +196,17 @@ void DevicePluginMock::emitDevicesDiscovered()
deviceDescriptors.append(d2);
}
emit devicesDiscovered(mockDeviceDiscoveryClassId, deviceDescriptors);
emit devicesDiscovered(mockDeviceClassId, deviceDescriptors);
}
void DevicePluginMock::emitDeviceSetupFinished()
{
qDebug() << "emitting setup finised";
Device *device = m_asyncSetupDevices.takeFirst();
if (device->deviceClassId() == mockDeviceAsyncSetupClassId) {
emit deviceSetupFinished(device, DeviceManager::DeviceSetupStatusSuccess, QString());
} else {
if (device->paramValue("broken").toBool()) {
emit deviceSetupFinished(device, DeviceManager::DeviceSetupStatusFailure, QString("This device is intentionally broken"));
} else {
emit deviceSetupFinished(device, DeviceManager::DeviceSetupStatusSuccess, QString());
}
}

View File

@ -4,8 +4,99 @@
"vendors": [
{
"name": "guh",
"id": "2062d64d-3232-433c-88bc-0d33c0ba2ba6"
"id": "2062d64d-3232-433c-88bc-0d33c0ba2ba6",
"deviceClasses": [
{
"deviceClassId": "753f0d32-0468-4d08-82ed-1964aab03298",
"name": "Mock Device",
"createMethods": ["user", "auto", "discovery"],
"discoveryParamTypes": [
{
"name": "resultCount",
"type": "int",
"defaultValue": 2,
"allowedValues": [1, 2]
}
],
"paramTypes": [
{
"name": "httpport",
"type": "int"
},
{
"name": "async",
"type": "bool",
"defaultValue": false
},
{
"name": "broken",
"type": "bool",
"defaultValue": false
}
],
"stateTypes": [
{
"id": "80baec19-54de-4948-ac46-31eabfaceb83",
"name": "Dummy int state",
"defaultValue": 10
},
{
"id": "9dd6a97c-dfd1-43dc-acbd-367932742310",
"name:": "Dummy boo state",
"defaultValue": "false"
}
],
"eventTypes": [
{
"id": "45bf3752-0fc6-46b9-89fd-ffd878b5b22b",
"name": "Mock Event 1"
},
{
"id": "863d5920-b1cf-4eb9-88bd-8f7b8583b1cf",
"name": "Mock Event 2",
"paramTypes": [
{
"name": "mockParamInt",
"type": "int",
"defaultValue": 10
}
]
}
],
"actionTypes": [
{
"id": "dea0f4e1-65e3-4981-8eaa-2701c53a9185",
"name": "Mock Action 1 (with params)",
"paramTypes": [
{
"name": "mockActionParam1",
"type": "int"
},
{
"name": "mockActionParam2",
"type": "bool"
}
]
},
{
"id": "defd3ed6-1a0d-400b-8879-a0202cf39935",
"name": "Mock Action 2 (without params)"
},
{
"id": "fbae06d3-7666-483e-a39e-ec50fe89054e",
"name": "Mock Action 3 (async)"
},
{
"id": "df3cf33d-26d5-4577-9132-9823bd33fad0",
"name": "Mock Action 4 (broken)"
},
{
"id": "bfe89a1d-3497-4121-8318-e77c37537219",
"name": "Mock Action 5 (async, broken)"
}
]
}
]
}
]
}

View File

@ -4,8 +4,113 @@
"vendors": [
{
"name": "Openweathermap",
"id": "bf1e96f0-9650-4e7c-a56c-916d54d18e7a"
"id": "bf1e96f0-9650-4e7c-a56c-916d54d18e7a",
"deviceClasses": [
{
"deviceClassId": "985195aa-17ad-4530-88a4-cdd753d747d7",
"name": "Weather from openweathermap",
"createMethods": ["discovery"],
"discoveryParamTypes": [
{
"name": "location",
"type": "string"
}
],
"paramTypes": [
{
"name": "location",
"type": "string"
},
{
"name": "country",
"type": "string"
},
{
"name": "id",
"type": "string"
}
],
"actionTypes": [
{
"id": "cfbc6504-d86f-4856-8dfa-97b6fbb385e4",
"name": "Update"
}
],
"stateTypes": [
{
"id": "36b2f09b-7d77-4fbc-a68f-23d735dda0b1",
"name": "last update [unixtime]",
"type": "uint",
"defaultValue": "0"
},
{
"id": "6013402f-b5b1-46b3-8490-f0c20d62fe61",
"name": "temperature [Celsius]",
"type": "double",
"defaultValue": "0"
},
{
"id": "14ec2781-cb04-4bbf-b097-7d01ef982630",
"name": "temperature minimum [Celsius]",
"type": "double",
"defaultValue": "0"
},
{
"id": "fefe5563-452f-4833-b5cf-49c3cc67c772",
"name": "temperature maximum [Celsius]",
"type": "double",
"defaultValue": "0"
},
{
"id": "6f32ec73-3240-4630-ada9-1c10b8e98123",
"name": "humidity [%]",
"type": "int",
"defaultValue": "-1"
},
{
"id": "4a42eea9-00eb-440b-915e-dbe42180f83b",
"name": "pressure [hPa]",
"type": "double",
"defaultValue": "0"
},
{
"id": "2bf63430-e9e2-4fbf-88e6-6f1b4770f287",
"name": "wind speed [m/s]",
"type": "double",
"defaultValue": "0"
},
{
"id": "589e2ea5-65b2-4afd-9b72-e3708a589a12",
"name": "wind direction [degree]",
"type": "int",
"defaultValue": "0"
},
{
"id": "798553bc-45c7-42eb-9105-430bddb5d9b7",
"name": "cloudiness [%]",
"type": "int",
"defaultValue": "0"
},
{
"id": "f9539108-0e0e-4736-a306-6408f8e20a26",
"name": "weather description",
"type": "QString"
},
{
"id": "af155e94-9492-44e1-8608-7d0ee8b5d50d",
"name": "sunset [timestamp]",
"type": "uint",
"defaultValue": "0"
},
{
"id": "a1dddc3d-549f-4f20-b78b-be850548f286",
"name": "sunrise [unixtime]",
"type": "int",
"defaultValue": "0"
}
]
}
]
}
]
}

View File

@ -30,7 +30,6 @@
VendorId hueVendorId = VendorId("");
DeviceClassId hueDeviceClassId = DeviceClassId("d8f4c397-e05e-47c1-8917-8e72d4d0d47c");
DeviceClassId hueDeviceClassAutoId = DeviceClassId("9cce5981-50a1-4873-a374-c53c095feb3b");
StateTypeId hueColorStateTypeId = StateTypeId("d25423e7-b924-4b20-80b6-77eecc65d089");
ActionTypeId hueSetColorActionTypeId = ActionTypeId("29cc299a-818b-47b2-817f-c5a6361545e4");
@ -53,76 +52,6 @@ DevicePluginPhilipsHue::DevicePluginPhilipsHue():
connect(m_bridge, &HueBridgeConnection::getFinished, this, &DevicePluginPhilipsHue::getFinished);
}
//QList<DeviceClass> DevicePluginPhilipsHue::supportedDevices() const
//{
// QList<DeviceClass> ret;
// QList<StateType> hueStates;
// StateType powerState(huePowerStateTypeId);
// powerState.setName("power");
// powerState.setType(QVariant::Bool);
// powerState.setDefaultValue(false);
// hueStates.append(powerState);
// StateType brightnessState(hueBrightnessStateTypeId);
// brightnessState.setName("brightness");
// brightnessState.setType(QVariant::Int);
// brightnessState.setDefaultValue(255);
// hueStates.append(brightnessState);
// deviceClassHue.setStateTypes(hueStates);
// QList<ActionType> hueActons;
// ActionType setColorAction(hueSetColorActionTypeId);
// setColorAction.setName("Set color");
// QList<ParamType> actionParamsSetColor;
// ParamType actionParamSetColor("color", QVariant::Color);
// actionParamsSetColor.append(actionParamSetColor);
// setColorAction.setParameters(actionParamsSetColor);
// hueActons.append(setColorAction);
// ActionType setPowerAction(hueSetPowerActionTypeId);
// setPowerAction.setName("Power");
// QList<ParamType> actionParamsSetPower;
// ParamType actionParamSetPower("power", QVariant::Bool);
// actionParamsSetPower.append(actionParamSetPower);
// setPowerAction.setParameters(actionParamsSetPower);
// hueActons.append(setPowerAction);
// ActionType setBrightnessAction(hueSetBrightnessActionTypeId);
// setBrightnessAction.setName("Brightness");
// QList<ParamType> actionParamsSetBrightness;
// ParamType actionParamSetBrightness("brightness", QVariant::Int);
// actionParamSetBrightness.setMinValue(0);
// actionParamSetBrightness.setMaxValue(255);
// actionParamsSetBrightness.append(actionParamSetBrightness);
// setBrightnessAction.setParameters(actionParamsSetBrightness);
// hueActons.append(setBrightnessAction);
// deviceClassHue.setActions(hueActons);
// ret.append(deviceClassHue);
// // Now create the same device again with CreateMethodAuto
// // When we pair a bridge, one discovered device is created.
// // The other light bulbs connected to the bridge will
// // then appear as auto devices.
// DeviceClass deviceClassHueAuto(pluginId(), hueVendorId, hueDeviceClassAutoId);
// deviceClassHueAuto.setName("Hue");
// deviceClassHueAuto.setCreateMethod(DeviceClass::CreateMethodAuto);
// deviceClassHueAuto.setParamTypes(paramTypes);
// deviceClassHueAuto.setStateTypes(hueStates);
// deviceClassHueAuto.setActions(hueActons);
// ret.append(deviceClassHueAuto);
// return ret;
//}
DeviceManager::HardwareResources DevicePluginPhilipsHue::requiredHardware() const
{
return DeviceManager::HardwareResourceTimer;
@ -178,7 +107,7 @@ QPair<DeviceManager::DeviceSetupStatus, QString> DevicePluginPhilipsHue::setupDe
QList<DeviceDescriptor> descriptorList;
while (!m_unconfiguredLights.isEmpty()) {
Light *light = m_unconfiguredLights.takeFirst();
DeviceDescriptor descriptor(hueDeviceClassAutoId, light->name());
DeviceDescriptor descriptor(hueDeviceClassId, light->name());
ParamList params;
params.append(Param("number", light->id()));
params.append(Param("ip", light->ip().toString()));
@ -188,7 +117,7 @@ QPair<DeviceManager::DeviceSetupStatus, QString> DevicePluginPhilipsHue::setupDe
}
if (!descriptorList.isEmpty()) {
qDebug() << "adding" << descriptorList.count() << "autodevices";
metaObject()->invokeMethod(this, "autoDevicesAppeared", Qt::QueuedConnection, Q_ARG(DeviceClassId, hueDeviceClassAutoId), Q_ARG(QList<DeviceDescriptor>, descriptorList));
metaObject()->invokeMethod(this, "autoDevicesAppeared", Qt::QueuedConnection, Q_ARG(DeviceClassId, hueDeviceClassId), Q_ARG(QList<DeviceDescriptor>, descriptorList));
}
return reportDeviceSetup(DeviceManager::DeviceSetupStatusAsync);

View File

@ -9,7 +9,7 @@
{
"deviceClassId": "d8f4c397-e05e-47c1-8917-8e72d4d0d47c",
"name": "Hue",
"createMethod": "discovery",
"createMethods": ["discovery", "auto"],
"setupMethod": "pushButton",
"pairingInfo": "Please press the button on the Hue bridge and then press OK",
"paramTypes": [
@ -38,6 +38,38 @@
"type": "color",
"defaultValue": "black"
}
],
"actionTypes": [
{
"id": "29cc299a-818b-47b2-817f-c5a6361545e4",
"name": "Set color",
"paramTypes": [
{
"name": "color",
"type": "QColor"
}
]
},
{
"id": "7782d91e-d73a-4321-8828-da768e2f6827",
"name": "Set power",
"paramTypes": [
{
"name": "power",
"type": "bool"
}
]
},
{
"id": "3bc95552-cba0-4222-abd5-9b668132e442",
"name": "Set brightness",
"paramTypes": [
{
"name": "brightness",
"type": "int"
}
]
}
]
}
]

View File

@ -4,8 +4,30 @@
"vendors": [
{
"name": "guh",
"id": "2062d64d-3232-433c-88bc-0d33c0ba2ba6"
"id": "2062d64d-3232-433c-88bc-0d33c0ba2ba6",
"deviceClasses": [
{
"deviceClassId": "3c8f2447-dcd0-4882-8c09-99e579e4d24c",
"name": "Wake On Lan",
"createMethods": ["user"],
"paramTypes": [
{
"name": "name",
"type": "QString"
},
{
"name": "MAC",
"type": "QString"
}
],
"actionTypes": [
{
"id": "fb9b9d87-218f-4f0d-9e16-39f8a105029a",
"name": "Wake up device"
}
]
}
]
}
]
}

View File

@ -132,7 +132,6 @@
#include <QDebug>
VendorId belkinVendorId = VendorId("b241f7f5-8153-4a72-b260-f62beadc2d19");
DeviceClassId wemoSwitchDeviceClassId = DeviceClassId("69d97d3b-a8e6-42f3-afc0-ca8a53eb7cce");
StateTypeId powerStateTypeId = StateTypeId("7166c4f6-f68c-4188-8f7c-2205d72a5a6d");
@ -147,72 +146,6 @@ DevicePluginWemo::DevicePluginWemo()
connect(m_discovery,SIGNAL(discoveryDone(QList<WemoSwitch*>)),this,SLOT(discoveryDone(QList<WemoSwitch*>)));
}
QList<Vendor> DevicePluginWemo::supportedVendors() const
{
QList<Vendor> ret;
ret.append(Vendor(belkinVendorId, "Belkin"));
return ret;
}
QList<DeviceClass> DevicePluginWemo::supportedDevices() const
{
QList<DeviceClass> ret;
// ==============================
// WeMo Switch
DeviceClass deviceClassWemoSwitch(pluginId(), belkinVendorId, wemoSwitchDeviceClassId);
deviceClassWemoSwitch.setName("WeMo Switch");
deviceClassWemoSwitch.setCreateMethod(DeviceClass::CreateMethodDiscovery);
// params
QList<ParamType> paramTypes;
paramTypes.append(ParamType("name", QVariant::String));
paramTypes.append(ParamType("uuid", QVariant::String));
paramTypes.append(ParamType("model", QVariant::String));
paramTypes.append(ParamType("host address", QVariant::String));
paramTypes.append(ParamType("port", QVariant::Int));
paramTypes.append(ParamType("model description", QVariant::String));
paramTypes.append(ParamType("serial number", QVariant::String));
paramTypes.append(ParamType("location", QVariant::String));
paramTypes.append(ParamType("manufacturer", QVariant::String));
paramTypes.append(ParamType("device type", QVariant::String));
deviceClassWemoSwitch.setParamTypes(paramTypes);
// States
QList<StateType> wemoSwitchStates;
StateType powerState(powerStateTypeId);
powerState.setName("power");
powerState.setType(QVariant::Bool);
powerState.setDefaultValue(false);
wemoSwitchStates.append(powerState);
StateType reachableState(reachableStateTypeId);
reachableState.setName("reachable");
reachableState.setType(QVariant::Bool);
reachableState.setDefaultValue(false);
wemoSwitchStates.append(reachableState);
deviceClassWemoSwitch.setStateTypes(wemoSwitchStates);
// Actions
QList<ActionType> wemoSwitchActons;
ActionType powerAction(powerActionTypeId);
powerAction.setName("Set power");
QList<ParamType> actionParamsPower;
actionParamsPower.append(ParamType("power", QVariant::Bool));
powerAction.setParameters(actionParamsPower);
wemoSwitchActons.append(powerAction);
deviceClassWemoSwitch.setActions(wemoSwitchActons);
ret.append(deviceClassWemoSwitch);
return ret;
}
QPair<DeviceManager::DeviceError, QString> DevicePluginWemo::discoverDevices(const DeviceClassId &deviceClassId, const ParamList &params)
{
if(deviceClassId != wemoSwitchDeviceClassId){
@ -291,16 +224,6 @@ void DevicePluginWemo::deviceRemoved(Device *device)
m_wemoSwitches.remove(wemoSwitch);
}
QString DevicePluginWemo::pluginName() const
{
return "WeMo";
}
PluginId DevicePluginWemo::pluginId() const
{
return PluginId("2e3b5ce0-ecf1-43de-98f0-07df4068a583");
}
void DevicePluginWemo::guhTimer()
{
foreach (WemoSwitch* wemoSwitch, m_wemoSwitches.keys()) {

View File

@ -32,9 +32,6 @@ class DevicePluginWemo : public DevicePlugin
public:
explicit DevicePluginWemo();
QList<Vendor> supportedVendors() const override;
QList<DeviceClass> supportedDevices() const override;
QPair<DeviceManager::DeviceError, QString> discoverDevices(const DeviceClassId &deviceClassId, const ParamList &params) override;
QPair<DeviceManager::DeviceSetupStatus, QString> setupDevice(Device *device) override;
DeviceManager::HardwareResources requiredHardware() const override;
@ -42,9 +39,6 @@ public:
void deviceRemoved(Device *device) override;
QString pluginName() const override;
PluginId pluginId() const override;
void guhTimer() override;
WemoDiscovery *m_discovery;

View File

@ -1 +1,81 @@
{}
{
"name": "Wemo",
"id": "2e3b5ce0-ecf1-43de-98f0-07df4068a583",
"vendors": [
{
"name": "Belkin",
"id": "b241f7f5-8153-4a72-b260-f62beadc2d19",
"deviceClasses": [
{
"deviceClassId": "69d97d3b-a8e6-42f3-afc0-ca8a53eb7cce",
"name": "WeMo Switch",
"createMethods": ["discovery"],
"paramTypes": [
{
"name": "name",
"type": "QString"
},
{
"name": "uuid",
"type": "QString"
},
{
"name": "model",
"type": "QString"
},
{
"name": "host address",
"type": "QString"
},
{
"name": "port",
"type": "int"
},
{
"name": "model description",
"type": "QString"
},
{
"name": "serial number",
"type": "QString"
},
{
"name": "location",
"type": "QString"
},
{
"name": "manufacturer",
"type": "QString"
},
{
"name": "device type",
"type": "QString"
}
],
"stateTypes": [
{
"id": "7166c4f6-f68c-4188-8f7c-2205d72a5a6d",
"name": "power",
"type": "bool",
"defaultValue": false
},
{
"id": "ec2f5b49-585c-4455-a233-b7aa4c608dbc",
"name": "reachable",
"type": "bool",
"defaultValue": false
}
],
"actionTypes": [
{
"id": "269f25eb-d0b7-4144-b9ef-801f4ff3e90c",
"name": "set power",
"type": "bool",
"defaultValue": true
}
]
}
]
}
]
}

View File

@ -31,34 +31,6 @@ DevicePluginWifiDetector::DevicePluginWifiDetector()
{
}
//QList<DeviceClass> DevicePluginWifiDetector::supportedDevices() const
//{
// QList<DeviceClass> ret;
// DeviceClass deviceClassWifiDetector(pluginId(), supportedVendors().first().id(), detectorId);
// deviceClassWifiDetector.setName("WiFi Device");
// QList<ParamType> detectorParams;
// ParamType macParam("mac", QVariant::String);
// detectorParams.append(macParam);
// deviceClassWifiDetector.setParamTypes(detectorParams);
// QList<StateType> detectorStates;
// StateType inRangeState(inRangeStateTypeId);
// inRangeState.setName("inRange");
// inRangeState.setType(QVariant::Bool);
// inRangeState.setDefaultValue(false);
// detectorStates.append(inRangeState);
// deviceClassWifiDetector.setStateTypes(detectorStates);
// ret.append(deviceClassWifiDetector);
// return ret;
//}
DeviceManager::HardwareResources DevicePluginWifiDetector::requiredHardware() const
{
return DeviceManager::HardwareResourceTimer;

View File

@ -4,7 +4,29 @@
"vendors": [
{
"name": "guh",
"id": "2062d64d-3232-433c-88bc-0d33c0ba2ba6"
"id": "2062d64d-3232-433c-88bc-0d33c0ba2ba6",
"deviceClasses": [
{
"deviceClassId": "bd216356-f1ec-4324-9785-6982d2174e17",
"name": "WiFi Device",
"createMethods": ["user"],
"paramTypes": [
{
"name": "MAC",
"type": "QString"
}
],
"stateTypes": [
{
"id": "cb43e1b5-4f61-4538-bfa2-c33055c542cf",
"name": "In Range",
"type": "bool",
"defaultValue": false
}
]
}
]
}
]

View File

@ -42,7 +42,7 @@
#include <QJsonDocument>
#include <QStringList>
#define JSON_PROTOCOL_VERSION 4
#define JSON_PROTOCOL_VERSION 5
JsonRPCServer::JsonRPCServer(QObject *parent):
JsonHandler(parent),

View File

@ -146,7 +146,7 @@ void JsonTypes::init()
s_deviceClass.insert("paramTypes", QVariantList() << paramTypeRef());
s_deviceClass.insert("discoveryParamTypes", QVariantList() << paramTypeRef());
s_deviceClass.insert("setupMethod", setupMethodTypesRef());
s_deviceClass.insert("createMethod", createMethodTypesRef());
s_deviceClass.insert("createMethods", createMethodTypesRef());
// Device
s_device.insert("id", "uuid");
@ -210,7 +210,7 @@ QVariantMap JsonTypes::packEventType(const EventType &eventType)
variant.insert("id", eventType.id());
variant.insert("name", eventType.name());
QVariantList paramTypes;
foreach (const ParamType &paramType, eventType.parameters()) {
foreach (const ParamType &paramType, eventType.paramTypes()) {
paramTypes.append(packParamType(paramType));
}
variant.insert("paramTypes", paramTypes);
@ -249,7 +249,7 @@ QVariantMap JsonTypes::packActionType(const ActionType &actionType)
variantMap.insert("id", actionType.id());
variantMap.insert("name", actionType.name());
QVariantList paramTypes;
foreach (const ParamType &paramType, actionType.parameters()) {
foreach (const ParamType &paramType, actionType.paramTypes()) {
paramTypes.append(packParamType(paramType));
}
variantMap.insert("paramTypes", paramTypes);
@ -379,7 +379,7 @@ QVariantMap JsonTypes::packDeviceClass(const DeviceClass &deviceClass)
variant.insert("stateTypes", stateTypes);
variant.insert("eventTypes", eventTypes);
variant.insert("actionTypes", actionTypes);
variant.insert("createMethod", s_createMethodTypes.at(deviceClass.createMethod()));
variant.insert("createMethods", packCreateMethods(deviceClass.createMethods()));
variant.insert("setupMethod", s_setupMethodTypes.at(deviceClass.setupMethod()));
return variant;
}
@ -434,6 +434,21 @@ QVariantMap JsonTypes::packRule(const Rule &rule)
return ruleMap;
}
QVariantList JsonTypes::packCreateMethods(DeviceClass::CreateMethods createMethods)
{
QVariantList ret;
if (createMethods.testFlag(DeviceClass::CreateMethodUser)) {
ret << "CreateMethodUser";
}
if (createMethods.testFlag(DeviceClass::CreateMethodAuto)) {
ret << "CreateMethodAuto";
}
if (createMethods.testFlag(DeviceClass::CreateMethodDiscovery)) {
ret << "CreateMethodDiscovery";
}
return ret;
}
Param JsonTypes::unpackParam(const QVariantMap &paramMap)
{
if (paramMap.keys().count() == 0) {
@ -694,7 +709,7 @@ QPair<bool, QString> JsonTypes::validateVariant(const QVariant &templateVariant,
} else if (refName == createMethodTypesRef()) {
QPair<bool, QString> result = validateCreateMethodType(variant);
if (!result.first) {
qDebug() << "value not allowed in" << createMethodTypesRef();
qDebug() << "value not allowed in" << createMethodTypesRef() << variant;
return result;
}
} else if (refName == setupMethodTypesRef()) {
@ -770,7 +785,15 @@ QPair<bool, QString> JsonTypes::validateStateOperatorType(const QVariant &varian
QPair<bool, QString> JsonTypes::validateCreateMethodType(const QVariant &variant)
{
return report(s_createMethodTypes.contains(variant.toString()), QString("Unknwon createMethod type %1").arg(variant.toString()));
if (variant.toList().isEmpty()) {
return report(false, QString("No createMethod given."));
}
foreach (const QVariant &method, variant.toList()) {
if (!s_createMethodTypes.contains(method.toString())) {
return report(false, QString("Unknwon createMethod type %1").arg(method.toString()));
}
}
return report(true, QString());
}
QPair<bool, QString> JsonTypes::validateSetupMethodType(const QVariant &variant)

View File

@ -106,6 +106,7 @@ public:
static QVariantMap packDevice(Device *device);
static QVariantMap packDeviceDescriptor(const DeviceDescriptor &descriptor);
static QVariantMap packRule(const Rule &rule);
static QVariantList packCreateMethods(DeviceClass::CreateMethods createMethods);
static Param unpackParam(const QVariantMap &paramMap);
static ParamList unpackParams(const QVariantList &paramList);

View File

@ -1,4 +1,4 @@
4
5
{
"methods": {
"Actions.ExecuteAction": {
@ -364,7 +364,7 @@
"actionTypes": [
"$ref:ActionType"
],
"createMethod": "$ref:CreateMethodType",
"createMethods": "$ref:CreateMethodType",
"discoveryParamTypes": [
"$ref:ParamType"
],

View File

@ -154,8 +154,8 @@ void TestDevices::getSupportedDevices_data()
QTest::addColumn<VendorId>("vendorId");
QTest::addColumn<int>("resultCount");
QTest::newRow("vendor guh") << guhVendorId << 6;
QTest::newRow("no filter") << VendorId() << 6;
QTest::newRow("vendor guh") << guhVendorId << 1;
QTest::newRow("no filter") << VendorId() << 1;
QTest::newRow("invalid vendor") << VendorId("93e7d361-8025-4354-b17e-b68406c800bc") << 0;
}
@ -184,19 +184,27 @@ void TestDevices::addConfiguredDevice_data()
QTest::addColumn<QVariantList>("deviceParams");
QTest::addColumn<bool>("success");
QVariantList deviceParams;
QVariantMap httpportParam;
httpportParam.insert("name", "httpport");
httpportParam.insert("value", m_mockDevice1Port - 1);
deviceParams.append(httpportParam);
QVariantMap asyncParam;
asyncParam.insert("name", "async");
asyncParam.insert("value", true);
QVariantMap brokenParam;
brokenParam.insert("name", "broken");
brokenParam.insert("value", true);
QVariantList deviceParams;
deviceParams.clear(); deviceParams << httpportParam;
QTest::newRow("User, JustAdd") << mockDeviceClassId << deviceParams << true;
QTest::newRow("Auto, JustAdd") << mockDeviceAutoClassId << deviceParams << false;
QTest::newRow("Discovery, JustAdd") << mockDeviceDiscoveryClassId << deviceParams << false;
QTest::newRow("User, JustAdd, Async") << mockDeviceAsyncSetupClassId << deviceParams << true;
deviceParams.clear(); deviceParams << httpportParam << asyncParam;
QTest::newRow("User, JustAdd, Async") << mockDeviceClassId << deviceParams << true;
QTest::newRow("Invalid DeviceClassId") << DeviceClassId::createDeviceClassId() << deviceParams << false;
QTest::newRow("Setup failure") << mockDeviceBrokenClassId << deviceParams << false;
QTest::newRow("Setup failure, Async") << mockDeviceBrokenAsyncSetupClassId << deviceParams << false;
deviceParams.clear(); deviceParams << httpportParam << brokenParam;
QTest::newRow("Setup failure") << mockDeviceClassId << deviceParams << false;
deviceParams.clear(); deviceParams << httpportParam << asyncParam << brokenParam;
QTest::newRow("Setup failure, Async") << mockDeviceClassId << deviceParams << false;
QVariantList invalidDeviceParams;
QTest::newRow("User, JustAdd, missing params") << mockDeviceClassId << invalidDeviceParams << false;
@ -284,6 +292,14 @@ void TestDevices::storedDevices()
QVariantMap params;
params.insert("deviceClassId", mockDeviceClassId);
QVariantList deviceParams;
QVariantMap asyncParam;
asyncParam.insert("name", "async");
asyncParam.insert("value", false);
deviceParams.append(asyncParam);
QVariantMap brokenParam;
brokenParam.insert("name", "broken");
brokenParam.insert("value", false);
deviceParams.append(brokenParam);
QVariantMap httpportParam;
httpportParam.insert("name", "httpport");
httpportParam.insert("value", 8888);
@ -307,7 +323,7 @@ void TestDevices::storedDevices()
// if ()
// }
qDebug() << "found added device" << device.toMap().value("params").toList().first().toMap();
qDebug() << "found added device" << device.toMap().value("params");
qDebug() << "expected deviceParams:" << deviceParams;
QCOMPARE(device.toMap().value("params").toList(), deviceParams);
found = true;
@ -335,10 +351,9 @@ void TestDevices::discoverDevices_data()
resultCountParam.insert("value", 1);
discoveryParams.append(resultCountParam);
QTest::newRow("valid deviceClassId") << mockDeviceDiscoveryClassId << 2 << true << QVariantList();
QTest::newRow("valid deviceClassId with params") << mockDeviceDiscoveryClassId << 1 << true << discoveryParams;
QTest::newRow("valid deviceClassId") << mockDeviceClassId << 2 << true << QVariantList();
QTest::newRow("valid deviceClassId with params") << mockDeviceClassId << 1 << true << discoveryParams;
QTest::newRow("invalid deviceClassId") << DeviceClassId::createDeviceClassId() << 0 << false << QVariantList();
QTest::newRow("CreateMethodUser deviceClassId") << mockDeviceClassId << 0 << false << QVariantList();
}
void TestDevices::discoverDevices()