Exemplo n.º 1
0
 def gps(self):
     # required to be initialized when using gpsd_control stuff
     gobject.threads_init()
 
     # create a gps device object (which is a full pythonic gobject)
     gps = liblocation.gps_device_get_new()
 
     # connect its gobject 'changed' signal to our callback function
     gps.connect('changed', self.notify_gps_update)
 
     # create a gpsd_control object (which is a full pythonic gobject)
     gpsd_control = liblocation.gpsd_control_get_default()
 
     # are we the first one to grab gpsd?  If so, we can and must
     # start it running.  If we didn't grab it first, then we cannot
     # control it.
     if gpsd_control.struct().can_control:
         liblocation.gpsd_control_start(gpsd_control)   
 
     # wait for 'changed' event callbacks
     mainloop = gobject.MainLoop()
     try:
         mainloop.run()
     except KeyboardInterrupt:
         print "k."
Exemplo n.º 2
0
 def start_location(self):
     # are we the first one to grab gpsd?  If so, we can and must
     # start it running.  If we didn't grab it first, then we cannot
     # control it.
     print "GPS Maemo4 start_location"
     if self.gpsd_control.struct().can_control:
         liblocation.gpsd_control_start(self.gpsd_control)
         self.stop_on_exit = True
Exemplo n.º 3
0
 def setgps(self):
    # Start or stop the gps daemon
    if self.gpson==0:
     liblocation.gpsd_control_start(gpsd_control)
     self.gpsb.setText('Disconnect from\nthe GPS device')
     self.statuslabel.setText('Status: Connecting...')
     self.gpson=1
    else:          
     if self.doingtrack==1:
       self.stoptrack()
     liblocation.gpsd_control_stop(gpsd_control)
     self.gpsb.setText('Connect to the\nGPS device')
     self.statuslabel.setText('Status: Disconnected')
     self.gpson=0