diff --git a/doc/plugin-json.qdoc b/doc/plugin-json.qdoc index d696819e..efe5d2cf 100644 --- a/doc/plugin-json.qdoc +++ b/doc/plugin-json.qdoc @@ -267,11 +267,14 @@ A \l{StateType} has following parameters: "id": "uuid", "idName": "stateName", "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." - "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 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 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 ". 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 ". 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 ". @@ -300,12 +303,11 @@ This mechanism was created to ensure that the \l{EventType} and \l{ActionType} w "id": "9bc84381-785f-46bf-94c8-6e35116f50d3", "idName": "volume", "name": "volume", - "unit": "Percentage", + "unit": "UnitPercentage", "type": "int", - "writable": { - "minValue": 0, - "maxValue": 100 - } + "minValue": 0, + "maxValue": 100, + "writable": true } \endcode @@ -316,10 +318,10 @@ This mechanism was created to ensure that the \l{EventType} and \l{ActionType} w "name": "set volume", "paramTypes": [ { - "maxValue": 100, - "minValue": 0, "name": "volume", "type": "int", + "maxValue": 100, + "minValue": 0, "unit": "UnitPercentage" } ] @@ -333,11 +335,8 @@ This mechanism was created to ensure that the \l{EventType} and \l{ActionType} w "name": "volume changed", "paramTypes": [ { - "maxValue": 100, - "minValue": 0, "name": "volume", - "type": "int", - "unit": "UnitPercentage" + "type": "int" } ] } diff --git a/doc/tutorial4.qdoc b/doc/tutorial4.qdoc index c8fe9f2d..5facf689 100644 --- a/doc/tutorial4.qdoc +++ b/doc/tutorial4.qdoc @@ -32,7 +32,7 @@ "name": "power", "type": "bool", "defaultValue": false, - "writable": {} + "writable": true } ] } diff --git a/server/rest/rulesresource.cpp b/server/rest/rulesresource.cpp index 7fe495a0..5e42e129 100644 --- a/server/rest/rulesresource.cpp +++ b/server/rest/rulesresource.cpp @@ -268,7 +268,6 @@ HttpReply *RulesResource::addRule(const QByteArray &payload) const if (actionsVerification.second != RuleEngine::RuleErrorNoError) return createRuleErrorReply(HttpReply::BadRequest, actionsVerification.second); - // Check and unpack exitActions QPair, RuleEngine::RuleError> exitActionsVerification = JsonTypes::verifyExitActions(params); QList exitActions = exitActionsVerification.first;