diff --git a/.gitignore b/.gitignore index 568d4ca0..0daaec4a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *.pro.user builddir doc/html +*api.json.new diff --git a/server/jsonrpc/jsonrpcserver.cpp b/server/jsonrpc/jsonrpcserver.cpp index 5d5467e7..dc146d44 100644 --- a/server/jsonrpc/jsonrpcserver.cpp +++ b/server/jsonrpc/jsonrpcserver.cpp @@ -42,7 +42,7 @@ #include #include -#define JSON_PROTOCOL_VERSION 6 +#define JSON_PROTOCOL_VERSION 7 JsonRPCServer::JsonRPCServer(QObject *parent): JsonHandler(parent), diff --git a/tests/auto/api.json b/tests/auto/api.json index ca9f3bbc..620dc2c3 100644 --- a/tests/auto/api.json +++ b/tests/auto/api.json @@ -1,4 +1,4 @@ -6 +7 { "methods": { "Actions.ExecuteAction": { @@ -326,6 +326,13 @@ ] }, "BasicType": [ + "Uuid", + "String", + "Int", + "Double", + "Bool", + "Variant", + "Object" ], "CreateMethod": [ "CreateMethodUser", diff --git a/tests/auto/api.json.new b/tests/auto/api.json.new deleted file mode 100644 index ca9f3bbc..00000000 --- a/tests/auto/api.json.new +++ /dev/null @@ -1,512 +0,0 @@ -6 -{ - "methods": { - "Actions.ExecuteAction": { - "description": "Execute a single action.", - "params": { - "actionTypeId": "Uuid", - "deviceId": "Uuid", - "o:params": [ - "$ref:Param" - ] - }, - "returns": { - "deviceError": "$ref:DeviceError" - } - }, - "Actions.GetActionType": { - "description": "Get the ActionType for the given ActionTypeId", - "params": { - "actionTypeId": "Uuid" - }, - "returns": { - "deviceError": "$ref:DeviceError", - "o:actionType": { - "id": "Uuid", - "name": "Uuid", - "paramTypes": [ - "$ref:ParamType" - ] - } - } - }, - "Devices.AddConfiguredDevice": { - "description": "Add a configured device with a setupMethod of SetupMethodJustAdd. For devices with a setupMethod different than SetupMethodJustAdd, use PairDevice. Use deviceDescriptorId or deviceParams, depending on the createMethod of the device class. CreateMethodJustAdd takes the parameters you want to have with that device. CreateMethodDiscovery requires the use of a deviceDescriptorId.", - "params": { - "deviceClassId": "Uuid", - "o:deviceDescriptorId": "Uuid", - "o:deviceParams": [ - "$ref:Param" - ] - }, - "returns": { - "deviceError": "$ref:DeviceError", - "o:deviceId": "Uuid" - } - }, - "Devices.ConfirmPairing": { - "description": "Confirm an ongoing pairing. In case of SetupMethodEnterPin also provide the pin in the params.", - "params": { - "o:secret": "String", - "pairingTransactionId": "Uuid" - }, - "returns": { - "deviceError": "$ref:DeviceError", - "o:deviceId": "Uuid" - } - }, - "Devices.GetActionTypes": { - "description": "Get action types for a specified deviceClassId.", - "params": { - "deviceClassId": "Uuid" - }, - "returns": { - "actionTypes": [ - "$ref:ActionType" - ] - } - }, - "Devices.GetConfiguredDevices": { - "description": "Returns a list of configured devices.", - "params": { - }, - "returns": { - "devices": [ - "$ref:Device" - ] - } - }, - "Devices.GetDiscoveredDevices": { - "description": "Performs a device discovery and returns the results. This function may take a while to return.", - "params": { - "deviceClassId": "Uuid", - "o:discoveryParams": [ - "$ref:Param" - ] - }, - "returns": { - "deviceError": "$ref:DeviceError", - "o:deviceDescriptors": [ - "$ref:DeviceDescriptor" - ] - } - }, - "Devices.GetEventTypes": { - "description": "Get event types for a specified deviceClassId.", - "params": { - "deviceClassId": "Uuid" - }, - "returns": { - "eventTypes": [ - "$ref:EventType" - ] - } - }, - "Devices.GetPluginConfiguration": { - "description": "Get a plugin's params.", - "params": { - "pluginId": "Uuid" - }, - "returns": { - "deviceError": "$ref:DeviceError", - "o:configuration": [ - "$ref:Param" - ] - } - }, - "Devices.GetPlugins": { - "description": "Returns a list of loaded plugins.", - "params": { - }, - "returns": { - "plugins": [ - "$ref:Plugin" - ] - } - }, - "Devices.GetStateTypes": { - "description": "Get state types for a specified deviceClassId.", - "params": { - "deviceClassId": "Uuid" - }, - "returns": { - "stateTypes": [ - "$ref:StateType" - ] - } - }, - "Devices.GetStateValue": { - "description": "Get the value of the given device and the given stateType", - "params": { - "deviceId": "Uuid", - "stateTypeId": "Uuid" - }, - "returns": { - "deviceError": "$ref:DeviceError", - "o:value": "Variant" - } - }, - "Devices.GetSupportedDevices": { - "description": "Returns a list of supported Device classes, optionally filtered by vendorId.", - "params": { - "o:vendorId": "Uuid" - }, - "returns": { - "deviceClasses": [ - "$ref:DeviceClass" - ] - } - }, - "Devices.GetSupportedVendors": { - "description": "Returns a list of supported Vendors.", - "params": { - }, - "returns": { - "vendors": [ - "$ref:Vendor" - ] - } - }, - "Devices.PairDevice": { - "description": "Pair a device. Use this for DeviceClasses with a setupMethod different than SetupMethodJustAdd.Use deviceDescriptorId or deviceParams, depending on the createMethod of the device class. CreateMethodJustAdd takes the parameters you want to have with that device. CreateMethodDiscovery requires the use of a deviceDescriptorId. If success is true, the return values will contain a pairingTransactionId, a displayMessage and the setupMethod. Depending on the setupMethod you should either proceed with AddConfiguredDevice or PairDevice.", - "params": { - "deviceClassId": "Uuid", - "o:deviceDescriptorId": "Uuid", - "o:deviceParams": [ - "$ref:Param" - ] - }, - "returns": { - "deviceError": "$ref:DeviceError", - "o:displayMessage": "String", - "o:pairingTransactionId": "Uuid", - "o:setupMethod": "$ref:SetupMethod" - } - }, - "Devices.RemoveConfiguredDevice": { - "description": "Remove a device from the system.", - "params": { - "deviceId": "Uuid", - "o:removePolicyList": [ - { - "policy": "$ref:RemovePolicy", - "ruleId": "Uuid" - } - ] - }, - "returns": { - "deviceError": "$ref:DeviceError" - } - }, - "Devices.SetPluginConfiguration": { - "description": "Set a plugin's params.", - "params": { - "configuration": [ - "$ref:Param" - ], - "pluginId": "Uuid" - }, - "returns": { - "deviceError": "$ref:DeviceError" - } - }, - "JSONRPC.Introspect": { - "description": "Introspect this API.", - "params": { - }, - "returns": { - "methods": "Object", - "types": "Object" - } - }, - "JSONRPC.SetNotificationStatus": { - "description": "Enable/Disable notifications for this connections.", - "params": { - "enabled": "Bool" - }, - "returns": { - "enabled": "Bool" - } - }, - "JSONRPC.Version": { - "description": "Version of this Guh/JSONRPC interface.", - "params": { - }, - "returns": { - "protocol version": "String", - "version": "String" - } - }, - "Rules.AddRule": { - "description": "Add a rule. You can describe rules by one or many EventDesciptors and a StateEvaluator. Note that onlyone of either eventDescriptor or eventDescriptorList may be passed at a time.", - "params": { - "actions": [ - "$ref:Action" - ], - "o:eventDescriptor": "$ref:EventDescriptor", - "o:eventDescriptorList": [ - "$ref:EventDescriptor" - ], - "o:stateEvaluator": "$ref:StateEvaluator" - }, - "returns": { - "o:ruleId": "Uuid", - "ruleError": "$ref:RuleError" - } - }, - "Rules.FindRules": { - "description": "Find a list of rules containing any of the given parameters.", - "params": { - "deviceId": "Uuid" - }, - "returns": { - "ruleIds": [ - "Uuid" - ] - } - }, - "Rules.GetRuleDetails": { - "description": "Get details for the rule identified by ruleId", - "params": { - "ruleId": "Uuid" - }, - "returns": { - "rule": "$ref:Rule" - } - }, - "Rules.GetRules": { - "description": "Get all configured rules", - "params": { - }, - "returns": { - "ruleIds": [ - "Uuid" - ] - } - }, - "Rules.RemoveRule": { - "description": "Remove a rule", - "params": { - "ruleId": "Uuid" - }, - "returns": { - "ruleError": "$ref:RuleError" - } - } - }, - "notifications": { - "Devices.StateChanged": { - "description": "Emitted whenever a State of a device changes.", - "params": { - "deviceId": "Uuid", - "stateTypeId": "Uuid", - "value": "Variant" - } - }, - "Events.EventTriggered": { - "description": "Emitted whenever an Event is triggered.", - "params": { - "event": "$ref:Event" - } - } - }, - "types": { - "Action": { - "actionTypeId": "Uuid", - "deviceId": "Uuid", - "o:params": [ - "$ref:Param" - ] - }, - "ActionType": { - "id": "Uuid", - "name": "Uuid", - "paramTypes": [ - "$ref:ParamType" - ] - }, - "BasicType": [ - ], - "CreateMethod": [ - "CreateMethodUser", - "CreateMethodAuto", - "CreateMethodDiscovery" - ], - "Device": { - "deviceClassId": "Uuid", - "id": "Uuid", - "name": "String", - "params": [ - "$ref:Param" - ], - "setupComplete": "Bool" - }, - "DeviceClass": { - "actionTypes": [ - "$ref:ActionType" - ], - "createMethods": [ - "$ref:CreateMethod" - ], - "discoveryParamTypes": [ - "$ref:ParamType" - ], - "eventTypes": [ - "$ref:EventType" - ], - "id": "Uuid", - "name": "String", - "paramTypes": [ - "$ref:ParamType" - ], - "setupMethod": "$ref:SetupMethod", - "stateTypes": [ - "$ref:StateType" - ], - "vendorId": "Uuid" - }, - "DeviceDescriptor": { - "description": "String", - "id": "Uuid", - "title": "String" - }, - "DeviceError": [ - "DeviceErrorNoError", - "DeviceErrorPluginNotFound", - "DeviceErrorDeviceNotFound", - "DeviceErrorDeviceClassNotFound", - "DeviceErrorActionTypeNotFound", - "DeviceErrorStateTypeNotFound", - "DeviceErrorEventTypeNotFound", - "DeviceErrorDeviceDescriptorNotFound", - "DeviceErrorMissingParameter", - "DeviceErrorInvalidParameter", - "DeviceErrorSetupFailed", - "DeviceErrorDuplicateUuid", - "DeviceErrorCreationMethodNotSupported", - "DeviceErrorSetupMethodNotSupported", - "DeviceErrorHardwareNotAvailable", - "DeviceErrorHardwareFailure", - "DeviceErrorAsync", - "DeviceErrorDeviceInUse", - "DeviceErrorPairingTransactionIdNotFound" - ], - "Event": { - "deviceId": "Uuid", - "eventTypeId": "Uuid", - "o:params": [ - "$ref:Param" - ] - }, - "EventDescriptor": { - "deviceId": "Uuid", - "eventTypeId": "Uuid", - "o:paramDescriptors": [ - "$ref:ParamDescriptor" - ] - }, - "EventType": { - "id": "Uuid", - "name": "String", - "paramTypes": [ - "$ref:ParamType" - ] - }, - "Param": { - "name": "String", - "value": "$ref:BasicType" - }, - "ParamDescriptor": { - "name": "String", - "operator": "$ref:ValueOperator", - "value": "$ref:BasicType" - }, - "ParamType": { - "name": "String", - "o:allowedValues": [ - "Variant" - ], - "o:defaultValue": "Variant", - "o:maxValue": "Variant", - "o:minValue": "Variant", - "type": "$ref:BasicType" - }, - "Plugin": { - "id": "Uuid", - "name": "String", - "params": [ - "$ref:Param" - ] - }, - "RemovePolicy": [ - "RemovePolicyCascade", - "RemovePolicyUpdate" - ], - "Rule": { - "actions": [ - "$ref:Action" - ], - "eventDescriptors": [ - "$ref:EventDescriptor" - ], - "id": "Uuid", - "stateEvaluator": "$ref:StateEvaluator" - }, - "RuleError": [ - "RuleErrorNoError", - "RuleErrorInvalidRuleId", - "RuleErrorRuleNotFound", - "RuleErrorDeviceNotFound", - "RuleErrorEventTypeNotFound", - "RuleErrorActionTypeNotFound", - "RuleErrorInvalidParameter", - "RuleErrorMissingParameter" - ], - "SetupMethod": [ - "SetupMethodJustAdd", - "SetupMethodDisplayPin", - "SetupMethodEnterPin", - "SetupMethodPushButton" - ], - "State": { - "deviceId": "Uuid", - "stateTypeId": "Uuid", - "value": "Variant" - }, - "StateDescriptor": { - "deviceId": "Uuid", - "operator": "$ref:ValueOperator", - "stateTypeId": "Uuid", - "value": "Variant" - }, - "StateEvaluator": { - "o:childEvaluators": [ - "$ref:StateEvaluator" - ], - "o:operator": "$ref:StateOperator", - "o:stateDescriptor": "$ref:StateDescriptor" - }, - "StateOperator": [ - "StateOperatorAnd", - "StateOperatorOr" - ], - "StateType": { - "defaultValue": "Variant", - "id": "Uuid", - "name": "String", - "type": "$ref:BasicType" - }, - "ValueOperator": [ - "ValueOperatorEquals", - "ValueOperatorNotEquals", - "ValueOperatorLess", - "ValueOperatorGreater", - "ValueOperatorLessOrEqual", - "ValueOperatorGreaterOrEqual" - ], - "Vendor": { - "id": "Uuid", - "name": "String" - } - } -}