align jsonrpc param descriptions with the rest of the type system

This commit is contained in:
Michael Zanetti 2014-06-08 17:08:51 +02:00
parent 43a063c10e
commit bbd05ca7fd
4 changed files with 35 additions and 27 deletions

6
debian/changelog vendored
View File

@ -1,3 +1,9 @@
guh (0.1.5) UNRELEASED; urgency=medium
* align params/paramTypes with the rest of the type system
-- Michael Zanetti <micha@noneyet> Sun, 08 Jun 2014 16:36:27 +0200
guh (0.1.4) trusty; urgency=medium guh (0.1.4) trusty; urgency=medium
* Add discoveryParams to DeviceClass * Add discoveryParams to DeviceClass

View File

@ -89,7 +89,7 @@ void JsonTypes::init()
// EventType // EventType
s_eventType.insert("id", "uuid"); s_eventType.insert("id", "uuid");
s_eventType.insert("name", "string"); s_eventType.insert("name", "string");
s_eventType.insert("params", QVariantList() << paramTypeRef()); s_eventType.insert("paramTypes", QVariantList() << paramTypeRef());
// Event // Event
s_event.insert("eventTypeId", "uuid"); s_event.insert("eventTypeId", "uuid");
@ -104,7 +104,7 @@ void JsonTypes::init()
// ActionType // ActionType
s_actionType.insert("id", "uuid"); s_actionType.insert("id", "uuid");
s_actionType.insert("name", "string"); s_actionType.insert("name", "string");
s_actionType.insert("params", QVariantList() << paramTypeRef()); s_actionType.insert("paramTypes", QVariantList() << paramTypeRef());
// Action // Action
s_action.insert("actionTypeId", "uuid"); s_action.insert("actionTypeId", "uuid");
@ -114,7 +114,7 @@ void JsonTypes::init()
// Pugin // Pugin
s_plugin.insert("id", "uuid"); s_plugin.insert("id", "uuid");
s_plugin.insert("name", "string"); s_plugin.insert("name", "string");
s_plugin.insert("params", QVariantList() << paramTypeRef()); s_plugin.insert("params", QVariantList() << paramRef());
// Vendor // Vendor
s_vendor.insert("id", "uuid"); s_vendor.insert("id", "uuid");
@ -124,11 +124,11 @@ void JsonTypes::init()
s_deviceClass.insert("id", "uuid"); s_deviceClass.insert("id", "uuid");
s_deviceClass.insert("vendorId", "uuid"); s_deviceClass.insert("vendorId", "uuid");
s_deviceClass.insert("name", "string"); s_deviceClass.insert("name", "string");
s_deviceClass.insert("states", QVariantList() << stateTypeRef()); s_deviceClass.insert("stateTypes", QVariantList() << stateTypeRef());
s_deviceClass.insert("events", QVariantList() << eventTypeRef()); s_deviceClass.insert("eventTypes", QVariantList() << eventTypeRef());
s_deviceClass.insert("actions", QVariantList() << actionTypeRef()); s_deviceClass.insert("actionTypes", QVariantList() << actionTypeRef());
s_deviceClass.insert("params", QVariantList() << paramTypeRef()); s_deviceClass.insert("paramTypes", QVariantList() << paramTypeRef());
s_deviceClass.insert("discoveryParams", QVariantList() << paramTypeRef()); s_deviceClass.insert("discoveryParamTypes", QVariantList() << paramTypeRef());
s_deviceClass.insert("setupMethod", setupMethodTypesRef()); s_deviceClass.insert("setupMethod", setupMethodTypesRef());
s_deviceClass.insert("createMethod", createMethodTypesRef()); s_deviceClass.insert("createMethod", createMethodTypesRef());
@ -191,7 +191,7 @@ QVariantMap JsonTypes::packEventType(const EventType &eventType)
QVariantMap variant; QVariantMap variant;
variant.insert("id", eventType.id()); variant.insert("id", eventType.id());
variant.insert("name", eventType.name()); variant.insert("name", eventType.name());
variant.insert("params", eventType.parameters()); variant.insert("paramTypes", eventType.parameters());
return variant; return variant;
} }
@ -226,11 +226,11 @@ QVariantMap JsonTypes::packActionType(const ActionType &actionType)
QVariantMap variantMap; QVariantMap variantMap;
variantMap.insert("id", actionType.id()); variantMap.insert("id", actionType.id());
variantMap.insert("name", actionType.name()); variantMap.insert("name", actionType.name());
QVariantList params; QVariantList paramTypes;
foreach (const ParamType &paramType, actionType.parameters()) { foreach (const ParamType &paramType, actionType.parameters()) {
params.append(packParamType(paramType)); paramTypes.append(packParamType(paramType));
} }
variantMap.insert("params", params); variantMap.insert("paramTypes", paramTypes);
return variantMap; return variantMap;
} }
@ -325,11 +325,11 @@ QVariantMap JsonTypes::packDeviceClass(const DeviceClass &deviceClass)
discoveryParamTypes.append(packParamType(paramType)); discoveryParamTypes.append(packParamType(paramType));
} }
variant.insert("params", paramTypes); variant.insert("paramTypes", paramTypes);
variant.insert("discoveryParams", discoveryParamTypes); variant.insert("discoveryParamTypes", discoveryParamTypes);
variant.insert("states", stateTypes); variant.insert("stateTypes", stateTypes);
variant.insert("events", eventTypes); variant.insert("eventTypes", eventTypes);
variant.insert("actions", actionTypes); variant.insert("actionTypes", actionTypes);
variant.insert("createMethod", s_createMethodTypes.at(deviceClass.createMethod())); variant.insert("createMethod", s_createMethodTypes.at(deviceClass.createMethod()));
variant.insert("setupMethod", s_setupMethodTypes.at(deviceClass.setupMethod())); variant.insert("setupMethod", s_setupMethodTypes.at(deviceClass.setupMethod()));
return variant; return variant;

View File

@ -1,5 +1,7 @@
include(../guh.pri) include(../guh.pri)
message("Building guh version $${GUH_VERSION_STRING}")
TARGET = guh TARGET = guh
TEMPLATE = app TEMPLATE = app

View File

@ -1,4 +1,4 @@
0.1.4 0.1.5
{ {
"methods": { "methods": {
"Actions.ExecuteAction": { "Actions.ExecuteAction": {
@ -25,7 +25,7 @@
"o:actionType": { "o:actionType": {
"id": "uuid", "id": "uuid",
"name": "string", "name": "string",
"params": [ "paramTypes": [
"$ref:ParamType" "$ref:ParamType"
] ]
}, },
@ -266,7 +266,7 @@
"ActionType": { "ActionType": {
"id": "uuid", "id": "uuid",
"name": "string", "name": "string",
"params": [ "paramTypes": [
"$ref:ParamType" "$ref:ParamType"
] ]
}, },
@ -292,23 +292,23 @@
"setupComplete": "bool" "setupComplete": "bool"
}, },
"DeviceClass": { "DeviceClass": {
"actions": [ "actionTypes": [
"$ref:ActionType" "$ref:ActionType"
], ],
"createMethod": "$ref:CreateMethodType", "createMethod": "$ref:CreateMethodType",
"discoveryParams": [ "discoveryParamTypes": [
"$ref:ParamType" "$ref:ParamType"
], ],
"events": [ "eventTypes": [
"$ref:EventType" "$ref:EventType"
], ],
"id": "uuid", "id": "uuid",
"name": "string", "name": "string",
"params": [ "paramTypes": [
"$ref:ParamType" "$ref:ParamType"
], ],
"setupMethod": "$ref:SetupMethodType", "setupMethod": "$ref:SetupMethodType",
"states": [ "stateTypes": [
"$ref:StateType" "$ref:StateType"
], ],
"vendorId": "uuid" "vendorId": "uuid"
@ -335,7 +335,7 @@
"EventType": { "EventType": {
"id": "uuid", "id": "uuid",
"name": "string", "name": "string",
"params": [ "paramTypes": [
"$ref:ParamType" "$ref:ParamType"
] ]
}, },
@ -367,7 +367,7 @@
"id": "uuid", "id": "uuid",
"name": "string", "name": "string",
"params": [ "params": [
"$ref:ParamType" "$ref:Param"
] ]
}, },
"Rule": { "Rule": {