Questions

Ian Lawrence xor81 at yahoo.com
Mon Jul 30 03:35:30 PDT 2007


Ola,
Just wanted to give a big-up for some cool software!.
I said this on IRC but i will say here too. I
installed geoclue and needed:
apt-get install gpsd libglib2.0-dev libgtk2.0-dev
libsoup2.2-dev libgconf2-dev libxml++2.6c2a

This then installed ok. When I run bergies python code

import gtk
import pygtk
import hildondesktop
import dbus
import os

class GeocluePlugin(hildondesktop.StatusbarItem):
    def __init__(self):
        hildondesktop.StatusbarItem.__init__(self)
        # Start with getting position from GeoClue
        bus = dbus.SessionBus()
        # TODO: Get the GeoClue interface to use from
/schemas/apps/geoclue/position/defaultpath 
        # and
/schemas/apps/geoclue/position/defaultserviceGConf
keys
        proxy_obj =
bus.get_object('org.foinse_project.geoclue.position.hostip',
'/org/foinse_project/geoclue/position/hostip')
        geoclue_iface = dbus.Interface(proxy_obj,
'org.foinse_project.geoclue.position')

        # Get the coordinates from the service
        coordinates = geoclue_iface.current_position()
        #location = geoclue_iface.current_location()
        # We can also use hardcoded
        #coordinates[0] = 60.158806494564
        #coordinates[1] = 24.9426341056824

        print "According to GeoClue you are in %s %s."
% (coordinates[0], coordinates[1])

def hd_plugin_get_objects():
    plugin = GeocluePlugin()
    return [plugin]]

in the pyphantom IDE it works every now and then (1
time out of about 10 tries on average). I tried
resetting d-bus (/etc/init.d/dbus restart) but this
seems to make little difference. It uses hostip.info
and the error on pyphantom is:

/var/lib/python-support/python2.5/dbus/proxies.py",
line 169, in __call__
    reply_message =
self._connection.send_message_with_reply_and_block(message,
timeout)
DBusException:
org.freedesktop.DBus.GLib.UnmappedError.GeocluePositionErrorQuark.Code1:
Position data from http://api.hostip.info/ could not
be parsed

HTH
[]'s
Ian


More information about the GeoClue mailing list