diff --git a/debian/changelog b/debian/changelog index a8150b5e..42a40f02 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,14 @@ -guh (0.1.3) UNRELEASED; urgency=medium +guh (0.1.4) trusty; urgency=medium + + * Add discoveryParams to DeviceClass + + -- Michael Zanetti Mon, 05 May 2014 20:30:49 +0200 + +guh (0.1.3) trusty; urgency=medium * Added Actions.GetActionType(actionTypeId) to JSONRPC - * - -- Michael Zanetti Mon, 05 May 2014 20:26:49 +0200 + -- Michael Zanetti Mon, 05 May 2014 20:30:38 +0200 guh (0.1.2) trusty; urgency=medium diff --git a/libguh/plugin/deviceclass.cpp b/libguh/plugin/deviceclass.cpp index c899e487..e605d741 100644 --- a/libguh/plugin/deviceclass.cpp +++ b/libguh/plugin/deviceclass.cpp @@ -141,6 +141,16 @@ void DeviceClass::setParams(const QList ¶ms) m_params = params; } +QList DeviceClass::discoveryParams() const +{ + return m_discoveryParams; +} + +void DeviceClass::setDiscoveryParams(const QList ¶ms) +{ + m_discoveryParams = params; +} + DeviceClass::CreateMethod DeviceClass::createMethod() const { return m_createMethod; diff --git a/libguh/plugin/deviceclass.h b/libguh/plugin/deviceclass.h index cff2134f..dc54435f 100644 --- a/libguh/plugin/deviceclass.h +++ b/libguh/plugin/deviceclass.h @@ -66,6 +66,9 @@ public: QList params() const; void setParams(const QList ¶ms); + QList discoveryParams() const; + void setDiscoveryParams(const QList ¶ms); + CreateMethod createMethod() const; void setCreateMethod(CreateMethod createMethod); SetupMethod setupMethod() const; @@ -82,6 +85,7 @@ private: QList m_events; QList m_actions; QList m_params; + QList m_discoveryParams; CreateMethod m_createMethod; SetupMethod m_setupMethod; }; diff --git a/plugins/deviceplugins/openweathermap/devicepluginopenweathermap.cpp b/plugins/deviceplugins/openweathermap/devicepluginopenweathermap.cpp index 986e9ab1..860a2a51 100644 --- a/plugins/deviceplugins/openweathermap/devicepluginopenweathermap.cpp +++ b/plugins/deviceplugins/openweathermap/devicepluginopenweathermap.cpp @@ -325,6 +325,9 @@ QList DevicePluginOpenweathermap::supportedDevices() const ParamType locationParam("location", QVariant::String); params.append(locationParam); + //Location is all we need for discovery. + deviceClassOpenweathermap.setDiscoveryParams(params); + ParamType countryParam("country", QVariant::String); params.append(countryParam); diff --git a/server/jsonrpc/jsontypes.cpp b/server/jsonrpc/jsontypes.cpp index 14c308fa..03ad07b3 100644 --- a/server/jsonrpc/jsontypes.cpp +++ b/server/jsonrpc/jsontypes.cpp @@ -128,6 +128,7 @@ void JsonTypes::init() s_deviceClass.insert("events", QVariantList() << eventTypeRef()); s_deviceClass.insert("actions", QVariantList() << actionTypeRef()); s_deviceClass.insert("params", QVariantList() << paramTypeRef()); + s_deviceClass.insert("discoveryParams", QVariantList() << paramTypeRef()); s_deviceClass.insert("setupMethod", setupMethodTypesRef()); s_deviceClass.insert("createMethod", createMethodTypesRef()); @@ -319,8 +320,13 @@ QVariantMap JsonTypes::packDeviceClass(const DeviceClass &deviceClass) foreach (const ParamType ¶mType, deviceClass.params()) { paramTypes.append(packParamType(paramType)); } + QVariantList discoveryParamTypes; + foreach (const ParamType ¶mType, deviceClass.discoveryParams()) { + discoveryParamTypes.append(packParamType(paramType)); + } variant.insert("params", paramTypes); + variant.insert("discoveryParams", discoveryParamTypes); variant.insert("states", stateTypes); variant.insert("events", eventTypes); variant.insert("actions", actionTypes); diff --git a/tests/auto/api.json b/tests/auto/api.json index 001c2d90..f3fefa33 100644 --- a/tests/auto/api.json +++ b/tests/auto/api.json @@ -1,4 +1,4 @@ -0.1.3 +0.1.4 { "methods": { "Actions.ExecuteAction": { @@ -296,6 +296,9 @@ "$ref:ActionType" ], "createMethod": "$ref:CreateMethodType", + "discoveryParams": [ + "$ref:ParamType" + ], "events": [ "$ref:EventType" ],