From fa9313f6f8ca4475befa1b15dfb947099afccfbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=BCrz?= Date: Mon, 14 Apr 2014 00:33:09 +0200 Subject: [PATCH] openweather autodetect when empty string works --- plugins/deviceplugins/openweathermap/openweathermap.cpp | 7 ++++++- plugins/deviceplugins/openweathermap/openweathermap.h | 1 + tests/scripts/getdiscovereddevices.sh | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/plugins/deviceplugins/openweathermap/openweathermap.cpp b/plugins/deviceplugins/openweathermap/openweathermap.cpp index c5a77a84..852b9af7 100644 --- a/plugins/deviceplugins/openweathermap/openweathermap.cpp +++ b/plugins/deviceplugins/openweathermap/openweathermap.cpp @@ -138,7 +138,7 @@ void OpenWeatherMap::processSearchLocationResponse(QByteArray data) cityList.append(city); m_cityId = elemant.value("id").toString(); - updateWeatherData(); + search(m_cityName); return; } } @@ -258,6 +258,11 @@ void OpenWeatherMap::update() updateLocationData(); } +void OpenWeatherMap::searchAutodetect() +{ + updateLocationData(); +} + void OpenWeatherMap::search(const QString &searchString) { QString urlString = "http://api.openweathermap.org/data/2.5/find?q=" + searchString + "&type=like&units=metric&mode=json"; diff --git a/plugins/deviceplugins/openweathermap/openweathermap.h b/plugins/deviceplugins/openweathermap/openweathermap.h index e672fcd4..94161ad6 100644 --- a/plugins/deviceplugins/openweathermap/openweathermap.h +++ b/plugins/deviceplugins/openweathermap/openweathermap.h @@ -72,6 +72,7 @@ signals: public slots: void update(); + void searchAutodetect(); void search(const QString &searchString); private slots: diff --git a/tests/scripts/getdiscovereddevices.sh b/tests/scripts/getdiscovereddevices.sh index b0fe207a..d1aa7237 100755 --- a/tests/scripts/getdiscovereddevices.sh +++ b/tests/scripts/getdiscovereddevices.sh @@ -3,7 +3,7 @@ if [ -z $2 ]; then echo "usage $0 host deviceclassid [paramname paramvalue]" elif [ -z $3 ]; then - (echo '{"id":1, "method":"Devices.GetDiscoveredDevices", "params":{"deviceClassId":"'$2'"}}'; sleep 6) | nc $1 1234 + (echo '{"id":1, "method":"Devices.GetDiscoveredDevices", "params":{"deviceClassId":"'$2'", "discoveryParams": {"location":""}}}'; sleep 6) | nc $1 1234 elif [ -z $4 ]; then echo "usage $0 host deviceclassid [paramname paramvalue]" else