Hi,
Ich habe den patch mal an die dev ML FWD.
vg Tarek
-------- Forwarded Message -------- Subject: Hoodselector Parch get GeoPosition From Webservice Date: Thu, 29 Dec 2016 22:34:23 +0100 From: Johannes Rudolph johannes.rudolph@gmx.com To: Jan-Tarek Butt tarek@ring0.de
Moin,
als Vorbereitung für die Unit Tests die ich einbauen möchte müssen wir mal ein bisschen was segmentieren im hoodselector und besser trennen
Gruß
Johannes
From 28f0fa7aa55b732585197c261c8a242fd2d60a0c Mon Sep 17 00:00:00 2001 From: Johannes Rudolph johannes.rudolph@gmx.com Date: Thu, 29 Dec 2016 22:30:59 +0100 Subject: [PATCH] split getGeoLocationFromWebService
--- files/usr/sbin/hoodselector | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/files/usr/sbin/hoodselector b/files/usr/sbin/hoodselector index 072217b..a70a186 100755 --- a/files/usr/sbin/hoodselector +++ b/files/usr/sbin/hoodselector @@ -45,7 +45,7 @@ local function get_geolocation() local lat = uci:get('gluon-node-info', uci:get_first('gluon-node-info', 'location'), 'latitude') local lng = uci:get('gluon-node-info', uci:get_first('gluon-node-info', 'location'), 'longitude') if ( lat == nil or lng == nil ) then - for scan in io.popen(string.format("lwtrace -t 2> /dev/null"), 'r'):lines() do + for scan in get_geoLocationFromWebService():lines() do if string.find(scan,"(lat)") then local last_val = nil for geo in string.gmatch(scan,"[^%s]+") do @@ -66,6 +66,11 @@ local function get_geolocation() return ret end
+-- Get GeoPositon from Webservice +local function get_geoLocationFromWebService() + return io.popen(string.format("lwtrace -t 2> /dev/null"), 'r') +end + -- Return hood from the hood file based on geo position. This method -- can return the following data: -- * real hood if a hood could be determined for the given position