update documentation of plugins

This commit is contained in:
Simon Stürz 2015-12-01 10:39:20 +01:00 committed by Michael Zanetti
parent 02a6e2cb96
commit 3a1d3ddcd4
3 changed files with 16 additions and 18 deletions

View File

@ -267,11 +267,14 @@ A \l{StateType} has following parameters:
"id": "uuid", "id": "uuid",
"idName": "stateName", "idName": "stateName",
"type": "DataType", "type": "DataType",
"unit": "The unit of the state value", "unit": "The unit of the state value.",
"defaultValue": "The state will be initialized with this value." "defaultValue": "The state will be initialized with this value."
"writable": { "minValue": "Numeric minimum value for this state.",
... "maxValue": "Numeric maximum value for this state.",
} "possibleValues": [
"value"
],
"writable": true
} }
] ]
} }
@ -284,7 +287,7 @@ A \l{StateType} has following parameters:
\li - \underline{\e type:} The data type of this state \unicode{0x2192} \l{StateType::type()}. \li - \underline{\e type:} The data type of this state \unicode{0x2192} \l{StateType::type()}.
\li - \underline{\e unit:} With this parameter you can specify the unit of the state value i.e. \unicode{0x00B0}C \unicode{0x2192} DegreeCelsius. \li - \underline{\e unit:} With this parameter you can specify the unit of the state value i.e. \unicode{0x00B0}C \unicode{0x2192} DegreeCelsius.
\li - \underline{\e defaultValue:} The state will be initialized with this value. \li - \underline{\e defaultValue:} The state will be initialized with this value.
\li - \underline{\e writable:} If you define the \e writable object an \l{ActionType} will be created to set the \l{State} value. The created \l{ActionType} has the same uuid (\l{ActionTypeId}) like the \l{StateType} uuid and will be named "set <stateName>". Since a \l{ParamType} has some properties which are not in the \l{StateType} definition like \e allowedValues or \e minValue / \e maxValue, you can specify them in the \e writable Object. \li - \underline{\e writable:} If you define the "\e writable : true" value an \l{ActionType} will be created to set the \l{State} value. The created \l{ActionType} has the same uuid (\l{ActionTypeId}) like the \l{StateType} uuid and will be named "set <stateName>". The \l{ParamType} of the created \l{ActionType} will have the same values in the \e allowedValues list as the \l{StateType} in the \e possibleValues list. Also the \e minValue / \e maxValue will be taken over from the \l{StateType}.
If a \l{StateType} has the property \e writable the \l{DeviceManager} will create automatically an \l{ActionType} for this state, which will also have exactly one \l{Param} with the same properties like the \l{StateType}. The created \l{ActionType} has the same uuid (\l{ActionTypeId}) like the \l{StateType} uuid and will be named "set <stateName>". If a \l{StateType} has the property \e writable the \l{DeviceManager} will create automatically an \l{ActionType} for this state, which will also have exactly one \l{Param} with the same properties like the \l{StateType}. The created \l{ActionType} has the same uuid (\l{ActionTypeId}) like the \l{StateType} uuid and will be named "set <stateName>".
@ -300,12 +303,11 @@ This mechanism was created to ensure that the \l{EventType} and \l{ActionType} w
"id": "9bc84381-785f-46bf-94c8-6e35116f50d3", "id": "9bc84381-785f-46bf-94c8-6e35116f50d3",
"idName": "volume", "idName": "volume",
"name": "volume", "name": "volume",
"unit": "Percentage", "unit": "UnitPercentage",
"type": "int", "type": "int",
"writable": { "minValue": 0,
"minValue": 0, "maxValue": 100,
"maxValue": 100 "writable": true
}
} }
\endcode \endcode
@ -316,10 +318,10 @@ This mechanism was created to ensure that the \l{EventType} and \l{ActionType} w
"name": "set volume", "name": "set volume",
"paramTypes": [ "paramTypes": [
{ {
"maxValue": 100,
"minValue": 0,
"name": "volume", "name": "volume",
"type": "int", "type": "int",
"maxValue": 100,
"minValue": 0,
"unit": "UnitPercentage" "unit": "UnitPercentage"
} }
] ]
@ -333,11 +335,8 @@ This mechanism was created to ensure that the \l{EventType} and \l{ActionType} w
"name": "volume changed", "name": "volume changed",
"paramTypes": [ "paramTypes": [
{ {
"maxValue": 100,
"minValue": 0,
"name": "volume", "name": "volume",
"type": "int", "type": "int"
"unit": "UnitPercentage"
} }
] ]
} }

View File

@ -32,7 +32,7 @@
"name": "power", "name": "power",
"type": "bool", "type": "bool",
"defaultValue": false, "defaultValue": false,
"writable": {} "writable": true
} }
] ]
} }

View File

@ -268,7 +268,6 @@ HttpReply *RulesResource::addRule(const QByteArray &payload) const
if (actionsVerification.second != RuleEngine::RuleErrorNoError) if (actionsVerification.second != RuleEngine::RuleErrorNoError)
return createRuleErrorReply(HttpReply::BadRequest, actionsVerification.second); return createRuleErrorReply(HttpReply::BadRequest, actionsVerification.second);
// Check and unpack exitActions // Check and unpack exitActions
QPair<QList<RuleAction>, RuleEngine::RuleError> exitActionsVerification = JsonTypes::verifyExitActions(params); QPair<QList<RuleAction>, RuleEngine::RuleError> exitActionsVerification = JsonTypes::verifyExitActions(params);
QList<RuleAction> exitActions = exitActionsVerification.first; QList<RuleAction> exitActions = exitActionsVerification.first;