![]() |
2012-01-10
, 13:44
|
Posts: 1,048 |
Thanked: 1,127 times |
Joined on Jan 2010
@ Amsterdam
|
#2
|
The Following User Says Thank You to anthonie For This Useful Post: | ||
![]() |
2012-01-10
, 15:03
|
Posts: 432 |
Thanked: 917 times |
Joined on Jun 2011
|
#3
|
![]() |
2012-01-10
, 15:24
|
|
Posts: 1,411 |
Thanked: 1,330 times |
Joined on Jan 2010
@ Tatooine
|
#4
|
The Following User Says Thank You to jedi For This Useful Post: | ||
![]() |
2012-01-10
, 18:51
|
Posts: 432 |
Thanked: 917 times |
Joined on Jun 2011
|
#5
|
![]() |
2012-01-11
, 09:48
|
|
Posts: 1,411 |
Thanked: 1,330 times |
Joined on Jan 2010
@ Tatooine
|
#6
|
#!/usr/bin/python import location import gobject def on_error(control, error, data): print "location error: %d... quitting" % error data.quit() def on_changed(device, data): if not device: return #Uncomment line below to show progress... #print "Accuracy: ",device.fix[6]," Lat/Long: ",device.fix[4:6] if not device.fix[6] == device.fix[6]: return if device.fix[6] > 50000: return if device.fix: if device.fix[1] & location.GPS_DEVICE_LATLONG_SET: print device.fix[4]," ",device.fix[5]," ",device.fix[6] data.stop() def on_stop(control, data): data.quit() def start_location(data): data.start() return False loop = gobject.MainLoop() control = location.GPSDControl.get_default() device = location.GPSDevice() control.set_properties(preferred_method=location.METHOD_USER_SELECTED, preferred_interval=location.INTERVAL_DEFAULT) control.connect("error-verbose", on_error, loop) device.connect("changed", on_changed, control) control.connect("gpsd-stopped", on_stop, loop) gobject.idle_add(start_location, control) loop.run()
![]() |
2012-01-13
, 01:08
|
Posts: 432 |
Thanked: 917 times |
Joined on Jun 2011
|
#7
|
Thanks