#!/usr/bin/env python # Mike Rowehl - mike at rowehl dot com # # Uses the python GPS binding lib python-gpsbt on the Nokia N810 to pull up # google maps for your current location. # import gpsbt import time import os def main(): print 'Connecting...' context = gpsbt.start() if context == None: print 'Problem while connecting!' return # ensure that GPS device is ready to connect and to receive commands time.sleep(2) gpsdevice = gpsbt.gps() gpsdevice.get_fix() # while we dont have a fix while (gpsdevice.fix.mode == 1): # print information stored under 'fix' variable print 'Altitude: %.3f'%gpsdevice.fix.altitude # dump all information available print gpsdevice time.sleep(2) gpsdevice.get_fix() print 'lat : %.3f'%gpsdevice.fix.latitude print 'lon : %.3f'%gpsdevice.fix.longitude urlarg = '--url=http://maps.google.com?q=%s,%s'%(gpsdevice.fix.latitude,gpsdevice.fix.longitude) os.execl('/usr/bin/browser','/usr/bin/browser',urlarg) time.sleep(2) # ends Bluetooth connection gpsbt.stop(context) main()