Reply
Thread Tools
Banned | Posts: 34 | Thanked: 3 times | Joined on Jul 2011
#1
And a maemo system command line open GPS in words

As title, I in the maemo. Org for two days only found open GPS python statements and program, and I want to shell script of statements directly call everybody knows it, thanks
 
Banned | Posts: 34 | Thanked: 3 times | Joined on Jul 2011
#2
Thank you, I have found
The following is a reference to use


import location
import gobject

nn = 0

def on_error(control, error, data):
print "location error: %d... quitting" % error
data.quit()

def on_changed(device, data):
if not device:
return
if device.fix:
if device.fix[1] & location.GPS_DEVICE_LATLONG_SET:
print "lat = %f, long = %f" % device.fix[4:6]
# data.stop() commented out to allow continuous loop for a reliable fix - press ctrl c to break the loop, or program your own way of exiting)

def on_stop(control, data):
print "quitting"
data.quit()

def start_location(data):
data.start()
return False

while nn < 5:

loop = gobject.MainLoop()
control = location.GPSDControl.get_default()
device = location.GPSDevice()
control.set_properties(preferred_method=location.M ETHOD_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)
nn = nn + 1
if nn > 5:
break
gobject.timeout_add(8000,exit)
loop.run()

Last edited by xsmabbs; 2012-03-21 at 13:14.
 
jedi's Avatar
Posts: 1,411 | Thanked: 1,330 times | Joined on Jan 2010 @ Tatooine
#3
Is this a question?

Or a statement?

Or just a demonstation of code you've modified from the Wiki example?
__________________
May the source be with you.
 
Reply


 
Forum Jump


All times are GMT. The time now is 10:20.