X-Git-Url: http://git.maemo.org/git/?p=gigfinder;a=blobdiff_plain;f=src%2Fopt%2Fgigfinder%2Flocator.py;h=e562e8d442fa5bbf6ded3a01e11210ec69f6bd5e;hp=089a822458a9ef9d25e51fa02881c46f8f846c8b;hb=69662219a729a4e95f5c0bd7e653290f221ab12e;hpb=f1c76dbba4d149bfd639f8da73e9196b0d2556de diff --git a/src/opt/gigfinder/locator.py b/src/opt/gigfinder/locator.py index 089a822..e562e8d 100644 --- a/src/opt/gigfinder/locator.py +++ b/src/opt/gigfinder/locator.py @@ -7,10 +7,13 @@ class LocationUpdater: self.lat = None self.long = None self.loop = gobject.MainLoop() + self.fix_count = 0 self.control = location.GPSDControl.get_default() - self.control.set_properties(preferred_method=location.METHOD_AGNSS, - preferred_interval=location.INTERVAL_DEFAULT) + self.control.set_properties(preferred_method=location\ + .METHOD_USER_SELECTED, + preferred_interval=location\ + .INTERVAL_DEFAULT) self.control.connect("error-verbose", self.on_error, self.loop) self.control.connect("gpsd-stopped", self.on_stop, self.loop) @@ -35,8 +38,10 @@ class LocationUpdater: if device.fix: # once fix is found and long, lat available set long lat if device.fix[1] & location.GPS_DEVICE_LATLONG_SET: - self.lat, self.long = device.fix[4:6] - data.stop() + self.fix_count += 1 + if self.fix_count > 1: + self.lat, self.long = device.fix[4:6] + data.stop() def on_stop(self, control, data): """ Stop the location service """ @@ -45,6 +50,7 @@ class LocationUpdater: def start_location(self, data): """ Start the location service """ + self.fix_count = 0 data.start() return False