|
|
2009-12-15
, 21:07
|
|
Posts: 486 |
Thanked: 153 times |
Joined on Sep 2009
@ New York City
|
#12
|
The GPS module is being worked by the Pymaemo guys. They have something in the SVN and they will be pushing a package to the repository soon enough.
http://wiki.maemo.org/PyMaemo/Using_Location_API
https://bugs.maemo.org/show_bug.cgi?id=5748#c2
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
if device.fix:
if device.fix[1] & location.GPS_DEVICE_LATLONG_SET:
print "lat = %f, long = %f" % device.fix[4:6]
data.stop()
def on_stop(control, data):
print "quitting"
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()
Nokia-N900-42-11:~# python test-location.py lat = 39.400000, long = 0.000000 quitting
|
|
2009-12-16
, 01:48
|
|
Posts: 486 |
Thanked: 153 times |
Joined on Sep 2009
@ New York City
|
#13
|
Nokia-N900-42-11:~# python test-location2.py lat = 39.400000, long = 0.000000 lat = 40.796683, long = -73.922741
|
|
2010-03-18
, 18:50
|
|
Posts: 217 |
Thanked: 20 times |
Joined on Jan 2010
|
#14
|
|
|
2010-03-22
, 18:02
|
|
Posts: 53 |
Thanked: 90 times |
Joined on Nov 2009
@ Manaus, Brazil
|
#15
|
Hi
Do you have and example like this but using ctypes?
I need a faster refresh and this wrapper only allows 1 sec or higher
thanks
| The Following User Says Thank You to lizardo For This Useful Post: | ||
|
|
2010-04-01
, 20:38
|
|
Posts: 217 |
Thanked: 20 times |
Joined on Jan 2010
|
#16
|
I not going to attempt to migrate the code because I don't have an n900 device to test with. If someone else would like to try it, it should involve making the python ctypes structures and function calls line up with whatever is now changed in the C API. This would involve chasing through the new liblocation docs and header files. The python wrapper is very thin so there's not a whole lot that can be going wrong, unless the new API is radically different.