Re: Using gps from command line

2009-07-21 Thread David Fokkema
On Sat, 2009-07-18 at 20:13 +0200, Laszlo KREKACS wrote:

 So anybody can show me a working code using the gps through frameworkd?

Like this?


import dbus
import time

bus = dbus.SystemBus()
usage = bus.get_object('org.freesmartphone.ousaged',
   '/org/freesmartphone/Usage')

gps = bus.get_object('org.freedesktop.Gypsy', '/org/freedesktop/Gypsy')
gps_device = dbus.Interface(gps, 'org.freedesktop.Gypsy.Device')
gps_position = dbus.Interface(gps, 'org.freedesktop.Gypsy.Position')

print usage.GetResourcePolicy('GPS')
print usage.GetResourceState('GPS')

usage.RequestResource('GPS')
print usage.GetResourceState('GPS')

t = time.time()
while True:
print 'Connection:', gps_device.GetConnectionStatus()
print 'Fix:', gps_device.GetFixStatus()
print 'Position:', gps_position.GetPosition()
time.sleep(2)
if time.time() - t  10:


break

usage.ReleaseResource('GPS')
print usage.GetResourceState('GPS')


David


___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Using gps from command line

2009-07-18 Thread Laszlo KREKACS
Hi!

I tried to follow a gps tutorial on my freeerunner using om2009.t5:
http://totalueberwachung.de/blog/2008/10/14/fso-tutorial-part-1-gps

cli-framework
usageiface.RequestResource(GPS)
gpsposition.GetPosition()

And it only returns with (0, 0, 0.0, 0.0, 0.0).

I thought it is because it didnt get a fix, but it is the same after a
half an hour.

So anybody can show me a working code using the gps through frameworkd?

Best regards,
 Laszlo

___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community