Hi,<br><br><div><span class="gmail_quote">2008/3/3, Jussi Kukkonen <<a href="mailto:jhkukkon@cc.hut.fi">jhkukkon@cc.hut.fi</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>The C function looks like this:<br> <br> GeocluePositionFields<br> geoclue_position_get_position (GeocluePosition *position,<br> int *timestamp,<br> double *latitude,<br>
double *longitude,<br> double *altitude,<br> GeoclueAccuracy **accuracy,<br> GError **error);<br>
<br> where the return value is a validity bitfield. So a check for altitude<br> validity would be "if (retval & GEOCLUE_POSITION_FIELDS_ALTITUDE)".</blockquote><div><br>As you allocate output structures and fill the call stack with pointers anyway, I'd prefer that with a handier signature:<br>
<br>GeocluePositionData *<br>geoclue_position_retrieve (GeocluePosition *position, GError **error);<br><br>Then a validity check would be:<br><br>if ((data->field_flags & GEOCLUE_POSITION_FIELDS_ALTITUDE) != 0) {<br>
/* use data->altitude */<br>}<br><br>For convenience, the field validity checks could be macroized around a pointer to GeocluePositionData.<br><br>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.<br>
</div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">> Then, if we consider Python bindings, a straightforward binding would<br> > turn the above into:<br>
> (time, lat, lon, alt, accuracy) = pos.get_position()<br> ><br> > Not very convenient if you need only some of those values.<br> <br> <br>Not much of a python developer myself, so I can't judge how inconvenient<br>
that is...Would you say it's difficult for the binding to wrap that in a<br> way that would be more natural to a python developer?</blockquote><div><br>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.<br>
</div><br></div>Best regards,<br> Mikhail<br>