[Telepathy] Geolocation in Telepathy
Mikhail Zabaluev
mikhail.zabaluev at gmail.com
Mon Mar 3 12:20:50 PST 2008
Hi,
2008/3/3, Jussi Kukkonen <jhkukkon at cc.hut.fi>:
>
>
> The C function looks like this:
>
> GeocluePositionFields
> geoclue_position_get_position (GeocluePosition *position,
> int *timestamp,
> double *latitude,
> double *longitude,
> double *altitude,
> GeoclueAccuracy **accuracy,
> GError **error);
>
> where the return value is a validity bitfield. So a check for altitude
> validity would be "if (retval & GEOCLUE_POSITION_FIELDS_ALTITUDE)".
As you allocate output structures and fill the call stack with pointers
anyway, I'd prefer that with a handier signature:
GeocluePositionData *
geoclue_position_retrieve (GeocluePosition *position, GError **error);
Then a validity check would be:
if ((data->field_flags & GEOCLUE_POSITION_FIELDS_ALTITUDE) != 0) {
/* use data->altitude */
}
For convenience, the field validity checks could be macroized around a
pointer to GeocluePositionData.
BTW, position data could even be DBus properties on GeocluePosition. In
Telepathy, we're considering DBus properties where a Telepathy-specific
property access interface, or other assorted methods, are currently used.
Simon knows better if it's a worthwhile approach or not.
> Then, if we consider Python bindings, a straightforward binding would
> > turn the above into:
> > (time, lat, lon, alt, accuracy) = pos.get_position()
> >
> > Not very convenient if you need only some of those values.
>
>
> Not much of a python developer myself, so I can't judge how inconvenient
> that is...Would you say it's difficult for the binding to wrap that in a
> way that would be more natural to a python developer?
No, I'd create an object with data access fields or methods anyway. I just
can't see why the C API should be much different then.
Best regards,
Mikhail
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/telepathy/attachments/20080303/548b7aa6/attachment.html
More information about the Telepathy
mailing list