autocreate action for writable states
This commit is contained in:
parent
ae1335f392
commit
231abee49b
@ -612,7 +612,7 @@ void DeviceManager::loadPlugins()
|
||||
foreach (const Vendor &vendor, pluginIface->supportedVendors()) {
|
||||
qDebug() << "* Loaded vendor:" << vendor.name();
|
||||
if (m_supportedVendors.contains(vendor.id())) {
|
||||
qWarning() << "! Duplicate vendor. Ignoring vendor" << vendor.name();
|
||||
//qWarning() << "! Duplicate vendor. Ignoring vendor" << vendor.name();
|
||||
continue;
|
||||
}
|
||||
m_supportedVendors.insert(vendor.id(), vendor);
|
||||
|
||||
@ -219,6 +219,7 @@ QList<DeviceClass> DevicePlugin::supportedDevices() const
|
||||
deviceClass.setPairingInfo(jo.value("pairingInfo").toString());
|
||||
deviceClass.setParamTypes(parseParamTypes(jo.value("paramTypes").toArray()));
|
||||
|
||||
QList<ActionType> actionTypes;
|
||||
QList<StateType> stateTypes;
|
||||
foreach (const QJsonValue &stateTypesJson, jo.value("stateTypes").toArray()) {
|
||||
QJsonObject st = stateTypesJson.toObject();
|
||||
@ -235,10 +236,19 @@ QList<DeviceClass> DevicePlugin::supportedDevices() const
|
||||
stateType.setType(t);
|
||||
stateType.setDefaultValue(st.value("defaultValue").toVariant());
|
||||
stateTypes.append(stateType);
|
||||
|
||||
// create ActionType if this StateType is writable
|
||||
if (st.value("writable").toBool()) {
|
||||
ActionType actionType(st.value("id").toString());
|
||||
actionType.setName("set " + st.value("name").toString());
|
||||
// param already checked in StateType
|
||||
ParamType paramType(st.value("name").toString(), t);
|
||||
actionType.setParamTypes(QList<ParamType>() << paramType);
|
||||
actionTypes.append(actionType);
|
||||
}
|
||||
}
|
||||
deviceClass.setStateTypes(stateTypes);
|
||||
|
||||
QList<ActionType> actionTypes;
|
||||
foreach (const QJsonValue &actionTypesJson, jo.value("actionTypes").toArray()) {
|
||||
QJsonObject at = actionTypesJson.toObject();
|
||||
QStringList missingFields = verifyFields(QStringList() << "id" << "name", at);
|
||||
|
||||
@ -37,6 +37,9 @@
|
||||
The \l{DeviceClass::SetupMethod}{setupMethod} describes the setup method of the \l{Device}.
|
||||
The detailed implementation of each \l{DeviceClass} can be found in the source code.
|
||||
|
||||
\note If a \l{StateType} has the parameter \tt{"writable": true}, an \l{ActionType} with the same uuid and \l{ParamType}{ParamTypes}
|
||||
will be created automatically.
|
||||
|
||||
\quotefile plugins/deviceplugins/boblight/devicepluginboblight.json
|
||||
*/
|
||||
|
||||
|
||||
@ -17,20 +17,8 @@
|
||||
"idName": "color",
|
||||
"name": "color",
|
||||
"type": "QColor",
|
||||
"defaultValue": "#000000"
|
||||
}
|
||||
],
|
||||
"actionTypes": [
|
||||
{
|
||||
"id": "668e1aa3-fa13-49ce-8630-17a5c0a7c34b",
|
||||
"idName": "setColor",
|
||||
"name": "Set color",
|
||||
"paramTypes": [
|
||||
{
|
||||
"name": "color",
|
||||
"type": "QColor"
|
||||
}
|
||||
]
|
||||
"defaultValue": "#000000",
|
||||
"writable": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -91,6 +91,9 @@
|
||||
The \l{DeviceClass::SetupMethod}{setupMethod} describes the setup method of the \l{Device}.
|
||||
The detailed implementation of each \l{DeviceClass} can be found in the source code.
|
||||
|
||||
\note If a \l{StateType} has the parameter \tt{"writable": true}, an \l{ActionType} with the same uuid and \l{ParamType}{ParamTypes}
|
||||
will be created automatically.
|
||||
|
||||
\quotefile plugins/deviceplugins/commandlauncher/deviceplugincommandlauncher.json
|
||||
*/
|
||||
|
||||
|
||||
@ -65,6 +65,7 @@
|
||||
"stateTypes": [
|
||||
{
|
||||
"id": "28d7e933-ff05-4f4c-95a0-482689543de5",
|
||||
"idName": "running",
|
||||
"name": "running",
|
||||
"type": "bool",
|
||||
"defaultValue": false
|
||||
@ -73,10 +74,12 @@
|
||||
"actionTypes": [
|
||||
{
|
||||
"id": "cf52b41d-3108-423c-8907-ca5b4d97cac5",
|
||||
"idName": "execute",
|
||||
"name": "execute"
|
||||
},
|
||||
{
|
||||
"id": "d21b1fed-1dd9-4c5a-a64e-0c6ba94059be",
|
||||
"idName": "kill",
|
||||
"name": "kill"
|
||||
}
|
||||
]
|
||||
|
||||
@ -36,6 +36,9 @@
|
||||
The \l{DeviceClass::SetupMethod}{setupMethod} describes the setup method of the \l{Device}.
|
||||
The detailed implementation of each \l{DeviceClass} can be found in the source code.
|
||||
|
||||
\note If a \l{StateType} has the parameter \tt{"writable": true}, an \l{ActionType} with the same uuid and \l{ParamType}{ParamTypes}
|
||||
will be created automatically.
|
||||
|
||||
\quotefile plugins/deviceplugins/conrad/devicepluginconrad.json
|
||||
*/
|
||||
|
||||
|
||||
@ -3,12 +3,12 @@
|
||||
"id": "1fd1a076-f229-4ec6-b501-48ddd15935e4",
|
||||
"vendors": [
|
||||
{
|
||||
"name": "Conrad Electronic SE",
|
||||
"name": "Conrad Electronic",
|
||||
"id": "986cf06f-3ef1-4271-b2a3-2cc277ebecb6",
|
||||
"deviceClasses": [
|
||||
{
|
||||
"deviceClassId": "2bb14180-aa5d-4999-992d-e6d464cff486",
|
||||
"name": "Conrad shutter RSM900R",
|
||||
"name": "Shutter (RSM900R)",
|
||||
"idName": "conradShutter",
|
||||
"createMethods": ["user"],
|
||||
"paramTypes": [
|
||||
@ -22,12 +22,12 @@
|
||||
{
|
||||
"id": "e015419c-9df9-4bf5-a439-f1f32aedd1db",
|
||||
"idName": "up",
|
||||
"name": "Up"
|
||||
"name": "up"
|
||||
},
|
||||
{
|
||||
"id": "c58a463a-f765-4a61-b2e2-883cc23878c0",
|
||||
"idName": "down",
|
||||
"name": "Down"
|
||||
"name": "down"
|
||||
},
|
||||
{
|
||||
"id": "4125a18e-fa2d-4b25-acd1-e148d5d665f5",
|
||||
|
||||
@ -69,6 +69,9 @@
|
||||
The \l{DeviceClass::SetupMethod}{setupMethod} describes the setup method of the \l{Device}.
|
||||
The detailed implementation of each \l{DeviceClass} can be found in the source code.
|
||||
|
||||
\note If a \l{StateType} has the parameter \tt{"writable": true}, an \l{ActionType} with the same uuid and \l{ParamType}{ParamTypes}
|
||||
will be created automatically.
|
||||
|
||||
\quotefile plugins/deviceplugins/datetime/deviceplugindatetime.json
|
||||
*/
|
||||
|
||||
|
||||
@ -102,7 +102,7 @@
|
||||
"idName": "weekend",
|
||||
"name": "weekend",
|
||||
"type": "bool",
|
||||
"defaultValue": "false"
|
||||
"defaultValue": false
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -36,6 +36,9 @@
|
||||
The \l{DeviceClass::SetupMethod}{setupMethod} describes the setup method of the \l{Device}.
|
||||
The detailed implementation of each \l{DeviceClass} can be found in the source code.
|
||||
|
||||
\note If a \l{StateType} has the parameter \tt{"writable": true}, an \l{ActionType} with the same uuid and \l{ParamType}{ParamTypes}
|
||||
will be created automatically.
|
||||
|
||||
\quotefile plugins/deviceplugins/elro/devicepluginelro.json
|
||||
*/
|
||||
|
||||
@ -58,7 +61,7 @@ DeviceManager::HardwareResources DevicePluginElro::requiredHardware() const
|
||||
DeviceManager::DeviceError DevicePluginElro::executeAction(Device *device, const Action &action)
|
||||
{
|
||||
|
||||
if (action.actionTypeId() != powerOnActionTypeId && action.actionTypeId() != powerOffActionTypeId) {
|
||||
if (action.actionTypeId() != powerActionTypeId) {
|
||||
return DeviceManager::DeviceErrorActionTypeNotFound;
|
||||
}
|
||||
|
||||
@ -121,12 +124,10 @@ DeviceManager::DeviceError DevicePluginElro::executeAction(Device *device, const
|
||||
}
|
||||
|
||||
// Power
|
||||
if (action.actionTypeId() == powerOnActionTypeId) {
|
||||
if (action.param("power").value().toBool()) {
|
||||
binCode.append("0001");
|
||||
} else if (action.actionTypeId() == powerOffActionTypeId) {
|
||||
binCode.append("0100");
|
||||
} else {
|
||||
return DeviceManager::DeviceErrorActionTypeNotFound;
|
||||
binCode.append("0100");
|
||||
}
|
||||
|
||||
//create rawData timings list
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
"createMethods": ["user"],
|
||||
"paramTypes": [
|
||||
{
|
||||
"name": "Name",
|
||||
"name": "name",
|
||||
"type": "QString",
|
||||
"inputType": "TextLine"
|
||||
},
|
||||
@ -61,13 +61,14 @@
|
||||
"actionTypes": [
|
||||
{
|
||||
"id": "31c9758e-6567-4f89-85bb-29e1a7c55d44",
|
||||
"idName": "powerOn",
|
||||
"name": "On"
|
||||
},
|
||||
{
|
||||
"id": "9ceb3233-20a3-46bf-b2af-faed1b7ab1ad",
|
||||
"idName": "powerOff",
|
||||
"name": "Off"
|
||||
"idName": "power",
|
||||
"name": "set power",
|
||||
"paramTypes": [
|
||||
{
|
||||
"name": "power",
|
||||
"type": "bool"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -126,11 +127,14 @@
|
||||
"actionTypes": [
|
||||
{
|
||||
"id": "31c9758e-6567-4f89-85bb-29e1a7c55d44",
|
||||
"name": "On"
|
||||
},
|
||||
{
|
||||
"id": "9ceb3233-20a3-46bf-b2af-faed1b7ab1ad",
|
||||
"name": "Off"
|
||||
"idName": "power",
|
||||
"name": "set power",
|
||||
"paramTypes": [
|
||||
{
|
||||
"name": "power",
|
||||
"type": "bool"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -189,11 +193,14 @@
|
||||
"actionTypes": [
|
||||
{
|
||||
"id": "31c9758e-6567-4f89-85bb-29e1a7c55d44",
|
||||
"name": "On"
|
||||
},
|
||||
{
|
||||
"id": "9ceb3233-20a3-46bf-b2af-faed1b7ab1ad",
|
||||
"name": "Off"
|
||||
"idName": "power",
|
||||
"name": "set power",
|
||||
"paramTypes": [
|
||||
{
|
||||
"name": "power",
|
||||
"type": "bool"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -252,11 +259,14 @@
|
||||
"actionTypes": [
|
||||
{
|
||||
"id": "31c9758e-6567-4f89-85bb-29e1a7c55d44",
|
||||
"name": "On"
|
||||
},
|
||||
{
|
||||
"id": "9ceb3233-20a3-46bf-b2af-faed1b7ab1ad",
|
||||
"name": "Off"
|
||||
"idName": "power",
|
||||
"name": "set power",
|
||||
"paramTypes": [
|
||||
{
|
||||
"name": "power",
|
||||
"type": "bool"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -57,6 +57,9 @@
|
||||
The \l{DeviceClass::SetupMethod}{setupMethod} describes the setup method of the \l{Device}.
|
||||
The detailed implementation of each \l{DeviceClass} can be found in the source code.
|
||||
|
||||
\note If a \l{StateType} has the parameter \tt{"writable": true}, an \l{ActionType} with the same uuid and \l{ParamType}{ParamTypes}
|
||||
will be created automatically.
|
||||
|
||||
\quotefile plugins/deviceplugins/eq-3/deviceplugineq-3.json
|
||||
*/
|
||||
|
||||
@ -168,8 +171,8 @@ DeviceManager::DeviceError DevicePluginEQ3::executeAction(Device *device, const
|
||||
QByteArray rfAddress = device->paramValue("rf address").toByteArray();
|
||||
int roomId = device->paramValue("room id").toInt();
|
||||
|
||||
if (action.actionTypeId() == setSetpointTemperatureActionTypeId){
|
||||
cube->setDeviceSetpointTemp(rfAddress, roomId, action.param("setpoint temperature").value().toDouble(), action.id());
|
||||
if (action.actionTypeId() == desiredTemperatureActionTypeId){
|
||||
cube->setDeviceSetpointTemp(rfAddress, roomId, action.param("desired temperature").value().toDouble(), action.id());
|
||||
} else if (action.actionTypeId() == setAutoModeActionTypeId){
|
||||
cube->setDeviceAutoMode(rfAddress, roomId, action.id());
|
||||
} else if (action.actionTypeId() == setManualModeActionTypeId){
|
||||
@ -337,7 +340,7 @@ void DevicePluginEQ3::wallThermostatDataUpdated()
|
||||
device->setStateValue(dtsActiveStateTypeId, wallThermostat->dtsActive());
|
||||
device->setStateValue(deviceModeStateTypeId, wallThermostat->deviceMode());
|
||||
device->setStateValue(deviceModeStringStateTypeId, wallThermostat->deviceModeString());
|
||||
device->setStateValue(setpointTempStateTypeId, wallThermostat->setpointTemperature());
|
||||
device->setStateValue(desiredTemperatureStateTypeId, wallThermostat->setpointTemperature());
|
||||
device->setStateValue(currentTemperatureStateTypeId, wallThermostat->currentTemperature());
|
||||
|
||||
|
||||
@ -366,7 +369,7 @@ void DevicePluginEQ3::radiatorThermostatDataUpdated()
|
||||
device->setStateValue(dtsActiveStateTypeId, radiatorThermostat->dtsActive());
|
||||
device->setStateValue(deviceModeStateTypeId, radiatorThermostat->deviceMode());
|
||||
device->setStateValue(deviceModeStringStateTypeId, radiatorThermostat->deviceModeString());
|
||||
device->setStateValue(setpointTempStateTypeId, radiatorThermostat->setpointTemperature());
|
||||
device->setStateValue(desiredTemperatureStateTypeId, radiatorThermostat->setpointTemperature());
|
||||
device->setStateValue(offsetTempStateTypeId, radiatorThermostat->offsetTemp());
|
||||
device->setStateValue(windowOpenDurationStateTypeId, radiatorThermostat->windowOpenDuration());
|
||||
device->setStateValue(boostValveValueStateTypeId, radiatorThermostat->boostValveValue());
|
||||
|
||||
@ -80,27 +80,19 @@
|
||||
}
|
||||
],
|
||||
"actionTypes": [
|
||||
{
|
||||
"id": "9c1968ba-39f9-493d-9fe2-848fa86bd2f0",
|
||||
"name": "set setpoint temperature",
|
||||
"paramTypes": [
|
||||
{
|
||||
"name": "temperature",
|
||||
"type": "double",
|
||||
"defaultValue": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "162b4b3d-9923-4f2c-a755-b50c8a06a6f0",
|
||||
"idName": "setAutoMode",
|
||||
"name": "set auto mode"
|
||||
},
|
||||
{
|
||||
"id": "8e604437-9f5b-4c17-b5b0-e2db6007af5b",
|
||||
"idName": "setManualMode",
|
||||
"name": "set manual mode"
|
||||
},
|
||||
{
|
||||
"id": "27a981e8-ec23-4ba8-921e-33b911a7dd89",
|
||||
"idName": "setEcoMode",
|
||||
"name": "set eco mode"
|
||||
},
|
||||
{
|
||||
@ -209,10 +201,12 @@
|
||||
},
|
||||
{
|
||||
"id": "579aa8c6-8814-491b-9e7c-b98108c323d1",
|
||||
"idName": "setpointTemp",
|
||||
"name": "set point temp",
|
||||
"idName": "desiredTemperature",
|
||||
"name": "desired temperature",
|
||||
"type": "double",
|
||||
"defaultValue": 0
|
||||
"defaultValue": 0,
|
||||
"writable": true
|
||||
|
||||
},
|
||||
{
|
||||
"id": "852e7708-db1d-42d1-96e4-19c13598262c",
|
||||
@ -255,18 +249,6 @@
|
||||
}
|
||||
],
|
||||
"actionTypes": [
|
||||
{
|
||||
"id": "9c1968ba-39f9-493d-9fe2-848fa86bd2f0",
|
||||
"idName": "setSetpointTemperature",
|
||||
"name": "set setpoint temperature",
|
||||
"paramTypes": [
|
||||
{
|
||||
"name": "temperature",
|
||||
"type": "double",
|
||||
"defaultValue": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "162b4b3d-9923-4f2c-a755-b50c8a06a6f0",
|
||||
"idName": "setAutoMode",
|
||||
@ -286,86 +268,101 @@
|
||||
"stateTypes": [
|
||||
{
|
||||
"id": "850380ee-a787-43e7-adb8-768a21a6e64d",
|
||||
"idName": "comfortTemp",
|
||||
"name": "comfort temperature",
|
||||
"type": "double",
|
||||
"defaultValue": 0
|
||||
},
|
||||
{
|
||||
"id": "24dfd20d-bc8d-48e4-8162-b20ae0465c41",
|
||||
"idName": "comfortTemp",
|
||||
"name": "eco temperature",
|
||||
"type": "double",
|
||||
"defaultValue": 0
|
||||
},
|
||||
{
|
||||
"id": "a8536ddf-a6e4-41c2-89c1-e7102608f5f6",
|
||||
"idName": "maxSetpointTemp",
|
||||
"name": "max setpoint",
|
||||
"type": "double",
|
||||
"defaultValue": 0
|
||||
},
|
||||
{
|
||||
"id": "ceb0ad05-37ad-4b79-a4d9-540c34a7e3e4",
|
||||
"idName": "maxSetpointTemp",
|
||||
"name": "min setpoint",
|
||||
"type": "double",
|
||||
"defaultValue": 0
|
||||
},
|
||||
{
|
||||
"id": "9880247b-cf9a-453c-b0c3-d910eba8a253",
|
||||
"idName": "maxSetpointTemp",
|
||||
"name": "error occured",
|
||||
"type": "bool",
|
||||
"defaultValue": false
|
||||
},
|
||||
{
|
||||
"id": "a9e29f03-063e-4686-8aac-2f6d8f8a4937",
|
||||
"idName": "initialized",
|
||||
"name": "initialized",
|
||||
"type": "bool",
|
||||
"defaultValue": false
|
||||
},
|
||||
{
|
||||
"id": "53b89f32-8894-4290-92a0-6a470c6b69ab",
|
||||
"idName": "batteryLow",
|
||||
"name": "battery low",
|
||||
"type": "bool",
|
||||
"defaultValue": false
|
||||
},
|
||||
{
|
||||
"id": "aff38be8-7ea6-4fd8-b0fa-e987ab05c719",
|
||||
"idName": "batteryLow",
|
||||
"name": "link status ok",
|
||||
"type": "bool",
|
||||
"defaultValue": false
|
||||
},
|
||||
{
|
||||
"id": "979df197-09a1-46f9-9217-9d323b1062bd",
|
||||
"idName": "panelLocked",
|
||||
"name": "panel locked",
|
||||
"type": "bool",
|
||||
"defaultValue": false
|
||||
},
|
||||
{
|
||||
"id": "1d6bd962-5c31-47ad-80a4-dda87bff98f5",
|
||||
"idName": "gatewayKnown",
|
||||
"name": "gateway known",
|
||||
"type": "bool",
|
||||
"defaultValue": false
|
||||
},
|
||||
{
|
||||
"id": "1b402ba6-a8ae-45b1-8acf-2b0a89f71889",
|
||||
"idName": "dtsActive",
|
||||
"name": "dts active",
|
||||
"type": "bool",
|
||||
"defaultValue": false
|
||||
},
|
||||
{
|
||||
"id": "639360f0-bb65-43e6-b227-50ae0ac39d6c",
|
||||
"idName": "deviceMode",
|
||||
"name": "device mode",
|
||||
"type": "int",
|
||||
"defaultValue": -1
|
||||
},
|
||||
{
|
||||
"id": "ff5194e3-5641-4ac2-92c7-48c431b4a2eb",
|
||||
"idName": "deviceModeString",
|
||||
"name": "device mode string",
|
||||
"type": "QString"
|
||||
},
|
||||
{
|
||||
"id": "579aa8c6-8814-491b-9e7c-b98108c323d1",
|
||||
"name": "set point temp",
|
||||
"idName": "desiredTemperature",
|
||||
"name": "desired temperature",
|
||||
"type": "double",
|
||||
"defaultValue": 0
|
||||
"defaultValue": 0,
|
||||
"writable": true
|
||||
},
|
||||
{
|
||||
"id": "576da571-9a65-478f-96bf-19256c8b9ece",
|
||||
|
||||
@ -47,6 +47,9 @@
|
||||
The \l{DeviceClass::SetupMethod}{setupMethod} describes the setup method of the \l{Device}.
|
||||
The detailed implementation of each \l{DeviceClass} can be found in the source code.
|
||||
|
||||
\note If a \l{StateType} has the parameter \tt{"writable": true}, an \l{ActionType} with the same uuid and \l{ParamType}{ParamTypes}
|
||||
will be created automatically.
|
||||
|
||||
\quotefile plugins/deviceplugins/genericelements/deviceplugingenericelements.json
|
||||
*/
|
||||
|
||||
@ -90,8 +93,8 @@ DeviceManager::DeviceError DevicePluginGenericElements::executeAction(Device *de
|
||||
{
|
||||
// Toggle Button
|
||||
if (device->deviceClassId() == toggleButtonDeviceClassId ) {
|
||||
if (action.actionTypeId() == toggleButtonToggleActionTypeId) {
|
||||
device->setStateValue(toggleButtonStatusStateTypeId, !device->stateValue(toggleButtonStatusStateTypeId).toBool());
|
||||
if (action.actionTypeId() == stateActionTypeId) {
|
||||
device->setStateValue(stateStateTypeId, !device->stateValue(stateStateTypeId).toBool());
|
||||
return DeviceManager::DeviceErrorNoError;
|
||||
}
|
||||
return DeviceManager::DeviceErrorActionTypeNotFound;
|
||||
|
||||
@ -21,17 +21,11 @@
|
||||
"stateTypes": [
|
||||
{
|
||||
"id": "b5e90567-54aa-49bd-a78a-3c19fb38aaf5",
|
||||
"idName": "toggleButtonStatus",
|
||||
"idName": "state",
|
||||
"name": "state",
|
||||
"type": "bool",
|
||||
"defaultValue": false
|
||||
}
|
||||
],
|
||||
"actionTypes": [
|
||||
{
|
||||
"id": "47bdc15a-b393-4dc2-801b-845420cdfda3",
|
||||
"idName": "toggleButtonToggle",
|
||||
"name": "toggle"
|
||||
"defaultValue": false,
|
||||
"writable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@ -36,6 +36,9 @@
|
||||
The \l{DeviceClass::SetupMethod}{setupMethod} describes the setup method of the \l{Device}.
|
||||
The detailed implementation of each \l{DeviceClass} can be found in the source code.
|
||||
|
||||
\note If a \l{StateType} has the parameter \tt{"writable": true}, an \l{ActionType} with the same uuid and \l{ParamType}{ParamTypes}
|
||||
will be created automatically.
|
||||
|
||||
\quotefile plugins/deviceplugins/intertechno/devicepluginintertechno.json
|
||||
*/
|
||||
|
||||
@ -62,7 +65,7 @@ DeviceManager::DeviceError DevicePluginIntertechno::executeAction(Device *device
|
||||
QList<int> rawData;
|
||||
QByteArray binCode;
|
||||
|
||||
QString familyCode = device->paramValue("familyCode").toString();
|
||||
QString familyCode = device->paramValue("family code").toString();
|
||||
|
||||
// =======================================
|
||||
// generate bin from family code
|
||||
@ -100,41 +103,41 @@ DeviceManager::DeviceError DevicePluginIntertechno::executeAction(Device *device
|
||||
binCode.append("01010101");
|
||||
}
|
||||
|
||||
QString buttonCode = device->paramValue("buttonCode").toString();
|
||||
QString buttonCode = device->paramValue("button code").toString();
|
||||
|
||||
// =======================================
|
||||
// generate bin from button code
|
||||
if (familyCode == "1") {
|
||||
if (buttonCode == "1") {
|
||||
binCode.append("00000000");
|
||||
} else if (familyCode == "2") {
|
||||
} else if (buttonCode == "2") {
|
||||
binCode.append("01000000");
|
||||
} else if (familyCode == "3") {
|
||||
} else if (buttonCode == "3") {
|
||||
binCode.append("00010000");
|
||||
} else if (familyCode == "4") {
|
||||
} else if (buttonCode == "4") {
|
||||
binCode.append("01010000");
|
||||
} else if (familyCode == "5") {
|
||||
} else if (buttonCode == "5") {
|
||||
binCode.append("00000100");
|
||||
} else if (familyCode == "6") {
|
||||
} else if (buttonCode == "6") {
|
||||
binCode.append("01000100");
|
||||
} else if (familyCode == "7") {
|
||||
} else if (buttonCode == "7") {
|
||||
binCode.append("01000000");
|
||||
} else if (familyCode == "8") {
|
||||
} else if (buttonCode == "8") {
|
||||
binCode.append("01010100");
|
||||
} else if (familyCode == "9") {
|
||||
} else if (buttonCode == "9") {
|
||||
binCode.append("00000001");
|
||||
} else if (familyCode == "10") {
|
||||
} else if (buttonCode == "10") {
|
||||
binCode.append("01000001");
|
||||
} else if (familyCode == "11") {
|
||||
} else if (buttonCode == "11") {
|
||||
binCode.append("00010001");
|
||||
} else if (familyCode == "12") {
|
||||
} else if (buttonCode == "12") {
|
||||
binCode.append("01010001");
|
||||
} else if (familyCode == "13") {
|
||||
} else if (buttonCode == "13") {
|
||||
binCode.append("00000101");
|
||||
} else if (familyCode == "14") {
|
||||
} else if (buttonCode == "14") {
|
||||
binCode.append("01000101");
|
||||
} else if (familyCode == "15") {
|
||||
} else if (buttonCode == "15") {
|
||||
binCode.append("00010101");
|
||||
} else if (familyCode == "16") {
|
||||
} else if (buttonCode == "16") {
|
||||
binCode.append("01010101");
|
||||
}
|
||||
|
||||
|
||||
@ -12,17 +12,17 @@
|
||||
"createMethods": ["user"],
|
||||
"paramTypes": [
|
||||
{
|
||||
"name": "Name",
|
||||
"name": "name",
|
||||
"type": "QString",
|
||||
"inputType": "TextLine"
|
||||
},
|
||||
{
|
||||
"name": "familyCode",
|
||||
"name": "family code",
|
||||
"type": "QString",
|
||||
"allowedValues": ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P"]
|
||||
},
|
||||
{
|
||||
"name": "button",
|
||||
"name": "button code",
|
||||
"type": "int",
|
||||
"minimumValue": 1,
|
||||
"maximumValue": 16
|
||||
@ -31,7 +31,7 @@
|
||||
"actionTypes": [
|
||||
{
|
||||
"id": "df19fb51-c3cd-4b95-8d88-ebbb535f4789",
|
||||
"name": "Set power",
|
||||
"name": "set power",
|
||||
"paramTypes": [
|
||||
{
|
||||
"name": "power",
|
||||
|
||||
@ -42,7 +42,10 @@
|
||||
The \l{DeviceClass::SetupMethod}{setupMethod} describes the setup method of the \l{Device}.
|
||||
The detailed implementation of each \l{DeviceClass} can be found in the source code.
|
||||
|
||||
\quotefile plugins/deviceplugins/elro/devicepluginleynew.json
|
||||
\note If a \l{StateType} has the parameter \tt{"writable": true}, an \l{ActionType} with the same uuid and \l{ParamType}{ParamTypes}
|
||||
will be created automatically.
|
||||
|
||||
\quotefile plugins/deviceplugins/leynew/devicepluginleynew.json
|
||||
*/
|
||||
|
||||
#include "devicepluginleynew.h"
|
||||
|
||||
@ -13,12 +13,12 @@
|
||||
"createMethods": ["user"],
|
||||
"paramTypes": [
|
||||
{
|
||||
"name": "Name",
|
||||
"name": "name",
|
||||
"type": "QString",
|
||||
"inputType": "TextLine"
|
||||
},
|
||||
{
|
||||
"name": "ID",
|
||||
"name": "id",
|
||||
"type": "QString",
|
||||
"inputType": "TextLine",
|
||||
"allowedValues": ["0008", "0115", "0014"]
|
||||
@ -28,102 +28,102 @@
|
||||
{
|
||||
"id": "18a30ff1-28d7-4cd0-8388-290db52cd48d",
|
||||
"idName": "brightnessUp",
|
||||
"name": "Brightness up"
|
||||
"name": "brightness up"
|
||||
},
|
||||
{
|
||||
"id": "d1d251b6-ffe6-4b0c-bf03-bfa8947caa1d",
|
||||
"idName": "brightnessDown",
|
||||
"name": "Brightness down"
|
||||
"name": "brightness down"
|
||||
},
|
||||
{
|
||||
"id": "b8b4ef78-126f-431b-b33f-742754da5af4",
|
||||
"idName": "playPause",
|
||||
"name": "Play / Pause"
|
||||
"name": "play / pause"
|
||||
},
|
||||
{
|
||||
"id": "35495871-3b80-458b-b60d-5dc614c9fbf1",
|
||||
"idName": "power",
|
||||
"name": "Power"
|
||||
"name": "power"
|
||||
},
|
||||
{
|
||||
"id": "737f77b6-fe2a-45ad-9945-8f0197e57741",
|
||||
"idName": "red",
|
||||
"name": "Red"
|
||||
"name": "red"
|
||||
},
|
||||
{
|
||||
"id": "6471e804-fd54-41dd-88ed-ec46d6cc33db",
|
||||
"idName": "green",
|
||||
"name": "Green"
|
||||
"name": "green"
|
||||
},
|
||||
{
|
||||
"id": "3abfe3c4-f9b3-4b22-aa3a-86ef99adedbe",
|
||||
"idName": "blue",
|
||||
"name": "Blue"
|
||||
"name": "blue"
|
||||
},
|
||||
{
|
||||
"id": "6a92d30d-7bce-4238-8e05-d25d3475699c",
|
||||
"idName": "white",
|
||||
"name": "White"
|
||||
"name": "white"
|
||||
},
|
||||
{
|
||||
"id": "10a145db-adea-4eff-921d-4ce1ceb940cd",
|
||||
"idName": "orange",
|
||||
"name": "Orange"
|
||||
"name": "orange"
|
||||
},
|
||||
{
|
||||
"id": "46bbfb97-1600-4e91-930d-6ef4be7bdd9c",
|
||||
"idName": "yellow",
|
||||
"name": "Yellow"
|
||||
"name": "yellow"
|
||||
},
|
||||
{
|
||||
"id": "7e1db150-c68f-4c54-8259-61d050f31555",
|
||||
"idName": "cyan",
|
||||
"name": "Cyan"
|
||||
"name": "cyan"
|
||||
},
|
||||
{
|
||||
"id": "4008076e-ff8c-400b-8983-0a452ed66509",
|
||||
"idName": "purple",
|
||||
"name": "Purple"
|
||||
"name": "purple"
|
||||
},
|
||||
{
|
||||
"id": "c692b7b0-f891-4729-8e76-4e67f1f6ff4a",
|
||||
"idName": "auto",
|
||||
"name": "Auto"
|
||||
"name": "auto"
|
||||
},
|
||||
{
|
||||
"id": "14e696ef-6f9f-4095-9731-5f9e541dd416",
|
||||
"idName": "jump3",
|
||||
"name": "Jump 3"
|
||||
"name": "jump 3"
|
||||
},
|
||||
{
|
||||
"id": "1e764e9f-5ff1-4cd1-b3a8-7feb2a3f204c",
|
||||
"idName": "fade3",
|
||||
"name": "Fade 3"
|
||||
"name": "fade 3"
|
||||
},
|
||||
{
|
||||
"id": "85b37c46-a44c-4989-add2-06b5537fe1a1",
|
||||
"idName": "speedUp",
|
||||
"name": "Speed up"
|
||||
"name": "speed up"
|
||||
},
|
||||
{
|
||||
"id": "7fdb9f73-e773-4839-9137-3771feabe3e9",
|
||||
"idName": "speedDown",
|
||||
"name": "Speed down"
|
||||
"name": "speed down"
|
||||
},
|
||||
{
|
||||
"id": "851e024b-0eee-4eec-8261-478c28c03557",
|
||||
"idName": "fade7",
|
||||
"name": "Fade 7"
|
||||
"name": "fade 7"
|
||||
},
|
||||
{
|
||||
"id": "c40392be-323d-48db-a076-40cf4d8cc7eb",
|
||||
"idName": "jump7",
|
||||
"name": "Jump 7"
|
||||
"name": "jump 7"
|
||||
},
|
||||
{
|
||||
"id": "db700960-2b02-4ad3-8257-a28cb5fc6356",
|
||||
"idName": "flash",
|
||||
"name": "Flash"
|
||||
"name": "flash"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -16,6 +16,31 @@
|
||||
* *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/*!
|
||||
\page lgsmarttv.html
|
||||
\title LG Smart Tv
|
||||
|
||||
\ingroup plugins
|
||||
\ingroup network
|
||||
|
||||
This plugin allows to interact with \l{http://www.lg.com/us/experience-tvs/smart-tv}{LG Smart Tv's}
|
||||
with the \l{http://developer.lgappstv.com/TV_HELP/index.jsp?topic=%2Flge.tvsdk.references.book%2Fhtml%2FUDAP%2FUDAP%2FLG+UDAP+2+0+Protocol+Specifications.htm}{LG UDAP 2.0 Protocol Specifications}.
|
||||
|
||||
\chapter Plugin properties
|
||||
Following JSON file contains the definition and the description of all available \l{DeviceClass}{DeviceClasses}
|
||||
and \l{Vendor}{Vendors} of this \l{DevicePlugin}.
|
||||
|
||||
Each \l{DeviceClass} has a list of \l{ParamType}{paramTypes}, \l{ActionType}{actionTypes}, \l{StateType}{stateTypes}
|
||||
and \l{EventType}{eventTypes}. The \l{DeviceClass::CreateMethod}{createMethods} parameter describes how the \l{Device}
|
||||
will be created in the system. A device can have more than one \l{DeviceClass::CreateMethod}{CreateMethod}.
|
||||
The \l{DeviceClass::SetupMethod}{setupMethod} describes the setup method of the \l{Device}.
|
||||
The detailed implementation of each \l{DeviceClass} can be found in the source code.
|
||||
|
||||
\note If a \l{StateType} has the parameter \tt{"writable": true}, an \l{ActionType} with the same uuid and \l{ParamType}{ParamTypes}
|
||||
will be created automatically.
|
||||
|
||||
\quotefile plugins/deviceplugins/lgsmarttv/devicepluginlgsmarttv.json
|
||||
*/
|
||||
|
||||
#include "devicepluginlgsmarttv.h"
|
||||
|
||||
|
||||
@ -37,6 +37,9 @@
|
||||
The \l{DeviceClass::SetupMethod}{setupMethod} describes the setup method of the \l{Device}.
|
||||
The detailed implementation of each \l{DeviceClass} can be found in the source code.
|
||||
|
||||
\note If a \l{StateType} has the parameter \tt{"writable": true}, an \l{ActionType} with the same uuid and \l{ParamType}{ParamTypes}
|
||||
will be created automatically.
|
||||
|
||||
\quotefile plugins/deviceplugins/lircd/devicepluginlircd.json
|
||||
*/
|
||||
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
"deviceClasses": [
|
||||
{
|
||||
"deviceClassId": "5c2bc4cd-ba6c-4052-b6cd-1db83323ea22",
|
||||
"idName": "irReceiver",
|
||||
"name": "IR receiver",
|
||||
"createMethods": ["user"],
|
||||
"paramTypes": [
|
||||
@ -20,7 +21,8 @@
|
||||
"eventTypes": [
|
||||
{
|
||||
"id": "8711471a-fa0e-410b-b174-dfc3d2aeffb1",
|
||||
"name": "Button pressed",
|
||||
"idName": "buttonPressed",
|
||||
"name": "button pressed",
|
||||
"paramTypes": [
|
||||
{
|
||||
"name": "button",
|
||||
|
||||
@ -54,6 +54,9 @@
|
||||
The \l{DeviceClass::SetupMethod}{setupMethod} describes the setup method of the \l{Device}.
|
||||
The detailed implementation of each \l{DeviceClass} can be found in the source code.
|
||||
|
||||
\note If a \l{StateType} has the parameter \tt{"writable": true}, an \l{ActionType} with the same uuid and \l{ParamType}{ParamTypes}
|
||||
will be created automatically.
|
||||
|
||||
\quotefile plugins/deviceplugins/mailnotification/devicepluginmailnotification.json
|
||||
*/
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
{
|
||||
"deviceClassId": "f4844c97-7ca6-4349-904e-ff9749a9fe74",
|
||||
"idName": "customMail",
|
||||
"name": "Custom Mail",
|
||||
"name": "Custom mail",
|
||||
"createMethods": ["user"],
|
||||
"paramTypes": [
|
||||
{
|
||||
@ -57,7 +57,7 @@
|
||||
"actionTypes": [
|
||||
{
|
||||
"id": "054613b0-3666-4dad-9252-e0ebca187edc",
|
||||
"name": "Send mail",
|
||||
"name": "send mail",
|
||||
"paramTypes": [
|
||||
{
|
||||
"name": "subject",
|
||||
@ -82,7 +82,7 @@
|
||||
{
|
||||
"deviceClassId": "3869884a-1592-4b8f-84a7-994be18ff555",
|
||||
"idName": "googleMail",
|
||||
"name": "Google Mail",
|
||||
"name": "Google mail",
|
||||
"createMethods": ["user"],
|
||||
"paramTypes": [
|
||||
{
|
||||
@ -105,7 +105,7 @@
|
||||
{
|
||||
"id": "054613b0-3666-4dad-9252-e0ebca187edc",
|
||||
"idName": "sendMail",
|
||||
"name": "Send mail",
|
||||
"name": "send mail",
|
||||
"paramTypes": [
|
||||
{
|
||||
"name": "subject",
|
||||
@ -130,7 +130,7 @@
|
||||
{
|
||||
"deviceClassId": "59409e8f-0c83-414f-abd5-bbbf2758acba",
|
||||
"idName": "yahooMail",
|
||||
"name": "Yahoo Mail",
|
||||
"name": "Yahoo mail",
|
||||
"createMethods": ["user"],
|
||||
"paramTypes": [
|
||||
{
|
||||
@ -152,7 +152,7 @@
|
||||
"actionTypes": [
|
||||
{
|
||||
"id": "054613b0-3666-4dad-9252-e0ebca187edc",
|
||||
"name": "Send mail",
|
||||
"name": "send mail",
|
||||
"paramTypes": [
|
||||
{
|
||||
"name": "subject",
|
||||
|
||||
@ -42,6 +42,9 @@
|
||||
The \l{DeviceClass::SetupMethod}{setupMethod} describes the setup method of the \l{Device}.
|
||||
The detailed implementation of each \l{DeviceClass} can be found in the source code.
|
||||
|
||||
\note If a \l{StateType} has the parameter \tt{"writable": true}, an \l{ActionType} with the same uuid and \l{ParamType}{ParamTypes}
|
||||
will be created automatically.
|
||||
|
||||
\quotefile plugins/deviceplugins/openweathermap/devicepluginopenweathermap.json
|
||||
*/
|
||||
|
||||
|
||||
@ -48,63 +48,63 @@
|
||||
"idName": "updateTime",
|
||||
"name": "last update [unixtime]",
|
||||
"type": "uint",
|
||||
"defaultValue": "0"
|
||||
"defaultValue": 0
|
||||
},
|
||||
{
|
||||
"id": "6013402f-b5b1-46b3-8490-f0c20d62fe61",
|
||||
"idName": "temperature",
|
||||
"name": "temperature [Celsius]",
|
||||
"type": "double",
|
||||
"defaultValue": "0"
|
||||
"defaultValue": 0
|
||||
},
|
||||
{
|
||||
"id": "14ec2781-cb04-4bbf-b097-7d01ef982630",
|
||||
"idName": "temperatureMin",
|
||||
"name": "temperature minimum [Celsius]",
|
||||
"type": "double",
|
||||
"defaultValue": "0"
|
||||
"defaultValue": 0
|
||||
},
|
||||
{
|
||||
"id": "fefe5563-452f-4833-b5cf-49c3cc67c772",
|
||||
"idName": "temperatureMax",
|
||||
"name": "temperature maximum [Celsius]",
|
||||
"type": "double",
|
||||
"defaultValue": "0"
|
||||
"defaultValue": 0
|
||||
},
|
||||
{
|
||||
"id": "6f32ec73-3240-4630-ada9-1c10b8e98123",
|
||||
"idName": "humidity",
|
||||
"name": "humidity [%]",
|
||||
"type": "int",
|
||||
"defaultValue": "-1"
|
||||
"defaultValue": 0
|
||||
},
|
||||
{
|
||||
"id": "4a42eea9-00eb-440b-915e-dbe42180f83b",
|
||||
"idName": "pressure",
|
||||
"name": "pressure [hPa]",
|
||||
"type": "double",
|
||||
"defaultValue": "0"
|
||||
"defaultValue": 0
|
||||
},
|
||||
{
|
||||
"id": "2bf63430-e9e2-4fbf-88e6-6f1b4770f287",
|
||||
"idName": "windSpeed",
|
||||
"name": "wind speed [m/s]",
|
||||
"type": "double",
|
||||
"defaultValue": "0"
|
||||
"defaultValue": 0
|
||||
},
|
||||
{
|
||||
"id": "589e2ea5-65b2-4afd-9b72-e3708a589a12",
|
||||
"idName": "windDirection",
|
||||
"name": "wind direction [degree]",
|
||||
"type": "int",
|
||||
"defaultValue": "0"
|
||||
"defaultValue": 0
|
||||
},
|
||||
{
|
||||
"id": "798553bc-45c7-42eb-9105-430bddb5d9b7",
|
||||
"idName": "cloudiness",
|
||||
"name": "cloudiness [%]",
|
||||
"type": "int",
|
||||
"defaultValue": "0"
|
||||
"defaultValue": 0
|
||||
},
|
||||
{
|
||||
"id": "f9539108-0e0e-4736-a306-6408f8e20a26",
|
||||
@ -115,16 +115,16 @@
|
||||
{
|
||||
"id": "af155e94-9492-44e1-8608-7d0ee8b5d50d",
|
||||
"idName": "sunset",
|
||||
"name": "sunset [timestamp]",
|
||||
"name": "sunset [unixtime]",
|
||||
"type": "uint",
|
||||
"defaultValue": "0"
|
||||
"defaultValue": 0
|
||||
},
|
||||
{
|
||||
"id": "a1dddc3d-549f-4f20-b78b-be850548f286",
|
||||
"idName": "sunrise",
|
||||
"name": "sunrise [unixtime]",
|
||||
"type": "int",
|
||||
"defaultValue": "0"
|
||||
"defaultValue": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -36,6 +36,9 @@
|
||||
The \l{DeviceClass::SetupMethod}{setupMethod} describes the setup method of the \l{Device}.
|
||||
The detailed implementation of each \l{DeviceClass} can be found in the source code.
|
||||
|
||||
\note If a \l{StateType} has the parameter \tt{"writable": true}, an \l{ActionType} with the same uuid and \l{ParamType}{ParamTypes}
|
||||
will be created automatically.
|
||||
|
||||
\quotefile plugins/deviceplugins/philipshue/devicepluginphilipshue.json
|
||||
*/
|
||||
|
||||
|
||||
@ -36,7 +36,10 @@
|
||||
The \l{DeviceClass::SetupMethod}{setupMethod} describes the setup method of the \l{Device}.
|
||||
The detailed implementation of each \l{DeviceClass} can be found in the source code.
|
||||
|
||||
\quotefile plugins/deviceplugins/elro/devicepluginelro.json
|
||||
\note If a \l{StateType} has the parameter \tt{"writable": true}, an \l{ActionType} with the same uuid and \l{ParamType}{ParamTypes}
|
||||
will be created automatically.
|
||||
|
||||
\quotefile plugins/deviceplugins/unitec/devicepluginunitec.json
|
||||
*/
|
||||
|
||||
#include "devicepluginunitec.h"
|
||||
|
||||
@ -9,23 +9,25 @@
|
||||
{
|
||||
"deviceClassId": "8468a15d-ecc0-43b6-98ca-e1e4ac9e2df3",
|
||||
"name": "Unitec switch (48111)",
|
||||
"idName": "switch",
|
||||
"createMethods": ["user"],
|
||||
"paramTypes": [
|
||||
{
|
||||
"name": "Name",
|
||||
"name": "name",
|
||||
"type": "QString",
|
||||
"inputType": "TextLine"
|
||||
},
|
||||
{
|
||||
"name": "Channel",
|
||||
"name": "channel",
|
||||
"type": "QString",
|
||||
"allowedValues": ["A", "B", "C", "D"]
|
||||
}
|
||||
],
|
||||
"actionTypes": [
|
||||
{
|
||||
"id": "a85b5443-e91f-4814-a813-c75b04d7a823",
|
||||
"name": "Set power",
|
||||
"id": "3ca1ebc2-bb8e-4429-9664-a7bc4569e73b",
|
||||
"idName": "power",
|
||||
"name": "set power",
|
||||
"paramTypes": [
|
||||
{
|
||||
"name": "power",
|
||||
|
||||
@ -38,6 +38,9 @@
|
||||
The \l{DeviceClass::SetupMethod}{setupMethod} describes the setup method of the \l{Device}.
|
||||
The detailed implementation of each \l{DeviceClass} can be found in the source code.
|
||||
|
||||
\note If a \l{StateType} has the parameter \tt{"writable": true}, an \l{ActionType} with the same uuid and \l{ParamType}{ParamTypes}
|
||||
will be created automatically.
|
||||
|
||||
\quotefile plugins/deviceplugins/wakeonlan/devicepluginwakeonlan.json
|
||||
*/
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
"inputType": "TextLine"
|
||||
},
|
||||
{
|
||||
"name": "Mac",
|
||||
"name": "mac",
|
||||
"type": "QString",
|
||||
"inputType": "MacAddress"
|
||||
}
|
||||
@ -26,7 +26,7 @@
|
||||
{
|
||||
"id": "fb9b9d87-218f-4f0d-9e16-39f8a105029a",
|
||||
"idName": "wol",
|
||||
"name": "Wake up device"
|
||||
"name": "wake up device"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -40,6 +40,9 @@
|
||||
The \l{DeviceClass::SetupMethod}{setupMethod} describes the setup method of the \l{Device}.
|
||||
The detailed implementation of each \l{DeviceClass} can be found in the source code.
|
||||
|
||||
\note If a \l{StateType} has the parameter \tt{"writable": true}, an \l{ActionType} with the same uuid and \l{ParamType}{ParamTypes}
|
||||
will be created automatically.
|
||||
|
||||
\quotefile plugins/deviceplugins/wemo/devicepluginwemo.json
|
||||
*/
|
||||
|
||||
|
||||
@ -38,7 +38,9 @@
|
||||
"idName": "power",
|
||||
"name": "power",
|
||||
"type": "bool",
|
||||
"defaultValue": false
|
||||
"defaultValue": false,
|
||||
"writable": true
|
||||
|
||||
},
|
||||
{
|
||||
"id": "ec2f5b49-585c-4455-a233-b7aa4c608dbc",
|
||||
@ -49,17 +51,6 @@
|
||||
}
|
||||
],
|
||||
"actionTypes": [
|
||||
{
|
||||
"id": "269f25eb-d0b7-4144-b9ef-801f4ff3e90c",
|
||||
"idName": "power",
|
||||
"name": "set power",
|
||||
"paramTypes": [
|
||||
{
|
||||
"name": "power",
|
||||
"type": "bool"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "269cf3b8-d4dd-42e9-8309-6cb3ca8842df",
|
||||
"idName": "rediscover",
|
||||
|
||||
@ -37,6 +37,9 @@
|
||||
The \l{DeviceClass::SetupMethod}{setupMethod} describes the setup method of the \l{Device}.
|
||||
The detailed implementation of each \l{DeviceClass} can be found in the source code.
|
||||
|
||||
\note If a \l{StateType} has the parameter \tt{"writable": true}, an \l{ActionType} with the same uuid and \l{ParamType}{ParamTypes}
|
||||
will be created automatically.
|
||||
|
||||
\quotefile plugins/deviceplugins/wifidetector/devicepluginwifidetector.json
|
||||
*/
|
||||
|
||||
|
||||
@ -12,12 +12,12 @@
|
||||
"createMethods": ["user"],
|
||||
"paramTypes": [
|
||||
{
|
||||
"name": "Name",
|
||||
"name": "name",
|
||||
"type": "QString",
|
||||
"inputType": "TextLine"
|
||||
},
|
||||
{
|
||||
"name": "MAC",
|
||||
"name": "mac",
|
||||
"type": "QString",
|
||||
"inputType": "MacAddress"
|
||||
}
|
||||
@ -26,7 +26,7 @@
|
||||
{
|
||||
"id": "cb43e1b5-4f61-4538-bfa2-c33055c542cf",
|
||||
"idName": "inRange",
|
||||
"name": "In Range",
|
||||
"name": "in Range",
|
||||
"type": "bool",
|
||||
"defaultValue": false
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@ import sys
|
||||
|
||||
inputFile = open(sys.argv[1], "r")
|
||||
outputfile = open(sys.argv[2], "w")
|
||||
variableNames = []
|
||||
|
||||
def out(line):
|
||||
outputfile.write("%s\n" % line)
|
||||
@ -19,8 +20,7 @@ except:
|
||||
def extractVendors(pluginMap):
|
||||
for vendor in pluginMap['vendors']:
|
||||
try:
|
||||
vendorIdName = pluginMap["idName"];
|
||||
out("VendorId %s = VendorId(\"%s\");" % pluginMap["idName"], pluginMap["id"])
|
||||
out("VendorId %sVendorId = VendorId(\"%s\");" % pluginMap["idName"], pluginMap["id"])
|
||||
except:
|
||||
pass
|
||||
extractDeviceClasses(vendor)
|
||||
@ -30,8 +30,12 @@ def extractDeviceClasses(vendorMap):
|
||||
for deviceClass in vendorMap["deviceClasses"]:
|
||||
print("have deviceclass %s" % deviceClass["deviceClassId"])
|
||||
try:
|
||||
deviceClassIdName = deviceClass["idName"]
|
||||
out("DeviceClassId %sDeviceClassId = DeviceClassId(\"%s\");" % (deviceClassIdName, deviceClass["deviceClassId"]))
|
||||
variableName = "%sDeviceClassId" % (deviceClass["idName"])
|
||||
if not variableName in variableNames:
|
||||
variableNames.append(variableName)
|
||||
out("DeviceClassId %s = DeviceClassId(\"%s\");" % (variableName, deviceClass["deviceClassId"]))
|
||||
else:
|
||||
print("duplicated variable name \"%s\" for DeviceClassId %s -> skipping") % (variableName, deviceClass["deviceClassId"])
|
||||
except:
|
||||
pass
|
||||
extractActionTypes(deviceClass)
|
||||
@ -43,30 +47,55 @@ def extractStateTypes(deviceClassMap):
|
||||
try:
|
||||
for stateType in deviceClassMap["stateTypes"]:
|
||||
try:
|
||||
stateTypeIdName = stateType["idName"]
|
||||
out("StateTypeId %sStateTypeId = StateTypeId(\"%s\");" % (stateTypeIdName, stateType["id"]))
|
||||
variableName = "%sStateTypeId" % (stateType["idName"])
|
||||
if not variableName in variableNames:
|
||||
variableNames.append(variableName)
|
||||
out("StateTypeId %s = StateTypeId(\"%s\");" % (variableName, stateType["id"]))
|
||||
else:
|
||||
print("duplicated variable name \"%s\" for StateTypeId %s -> skipping") % (variableName, stateType["id"])
|
||||
|
||||
# create ActionTypeId if the state is writable
|
||||
if 'writable' in stateType:
|
||||
if stateType['writable'] == True:
|
||||
print("create ActionTypeId for StateType %s" % stateType["id"])
|
||||
vName = "%sActionTypeId" % (stateType["idName"])
|
||||
if not vName in variableNames:
|
||||
variableNames.append(vName)
|
||||
out("ActionTypeId %s = ActionTypeId(\"%s\");" % (vName, stateType["id"]))
|
||||
else:
|
||||
print("duplicated variable name \"%s\" for ActionTypeId %s -> skipping") % (variableName, stateType["id"])
|
||||
except:
|
||||
pass
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
def extractActionTypes(deviceClassMap):
|
||||
try:
|
||||
for actionType in deviceClassMap["actionTypes"]:
|
||||
try:
|
||||
actionTypeIdName = actionType["idName"]
|
||||
out("ActionTypeId %sActionTypeId = ActionTypeId(\"%s\");" % (actionTypeIdName, actionType["id"]))
|
||||
variableName = "%sActionTypeId" % (actionType["idName"])
|
||||
if not variableName in variableNames:
|
||||
variableNames.append(variableName)
|
||||
out("ActionTypeId %s = ActionTypeId(\"%s\");" % (variableName, actionType["id"]))
|
||||
else:
|
||||
print("duplicated variable name \"%s\" for ActionTypeId %s -> skipping") % (variableName, actionType["id"])
|
||||
except:
|
||||
pass
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
def extractEventTypes(deviceClassMap):
|
||||
try:
|
||||
for eventType in deviceClassMap["eventTypes"]:
|
||||
try:
|
||||
eventTypeIdName = eventType["idName"]
|
||||
out("EventTypeId %sEventTypeId = EventTypeId(\"%s\");" % (eventTypeIdName, eventType["id"]))
|
||||
variableName = "%sEventTypeId" % (eventType["idName"])
|
||||
if not variableName in variableNames:
|
||||
variableNames.append(variableName)
|
||||
out("EventTypeId %s = EventTypeId(\"%s\");" % (variableName, eventType["id"]))
|
||||
else:
|
||||
print("duplicated variable name \"%s\" for EventTypeId %s -> skipping") % (variableName, eventType["id"])
|
||||
except:
|
||||
pass
|
||||
except:
|
||||
@ -74,20 +103,18 @@ def extractEventTypes(deviceClassMap):
|
||||
|
||||
|
||||
# write header
|
||||
out("/* This file is generated by the guh build system. Any changes to this fille")
|
||||
out("/* This file is generated by the guh build system. Any changes to this file will")
|
||||
out(" * be lost.")
|
||||
out("")
|
||||
out(" *")
|
||||
out(" * If you want to change this file, edit the plugin's json file and add")
|
||||
out(" * idName tags where appropriate.")
|
||||
out(" */")
|
||||
|
||||
out("#ifndef PLUGININFO_H")
|
||||
out("#define PLUGININFO_H")
|
||||
out("#include \"typeutils.h\"");
|
||||
|
||||
|
||||
out("#include \"typeutils.h\"")
|
||||
out("")
|
||||
out("PluginId pluginId = PluginId(\"%s\");" % pluginMap['id'])
|
||||
extractVendors(pluginMap)
|
||||
|
||||
|
||||
out("")
|
||||
out("#endif")
|
||||
|
||||
Reference in New Issue
Block a user