Docs and specs?
Henri Bergius
henri.bergius at iki.fi
Thu Aug 9 08:35:08 PDT 2007
On 8/9/07, keith preston <keithpre at gmail.com> wrote:
> I just took a look and no luck, gajim is in python. However this generally
> isn't a problem. Geoclue is first and foremost a DBus API specification.
> We for ease of use provide easy c client bindings and most of the backends
> are written in C, but a Python bindings should not be difficult at all.
Getting location in Python is really not very difficult:
# 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()
print "According to GeoClue you are in %s %s." % (coordinates[0],
coordinates[1])
This is a bit old code done for a maemo application, so it uses only
coordinate-based location (not civic as it could), and doesn't check
for appropriate backend to use from GeoClue's GConf (gconf support was
not available in maemo-python at that time).
So even with pure D-Bus this isn't much code. On top of this I've
understood the INdT guys are looking to make Python bindings.
> Keith Preston
/Bergie
--
Henri Bergius
Motorcycle Adventures and Free Software
http://bergie.iki.fi/
Skype: henribergius
Jabber: henri.bergius at gmail.com
Jaiku: http://bergie.jaiku.com/
More information about the GeoClue
mailing list