Hi,<br><br><div><span class="gmail_quote">2008/3/3, Jussi Kukkonen &lt;<a href="mailto:jhkukkon@cc.hut.fi">jhkukkon@cc.hut.fi</a>&gt;:</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>&nbsp;&nbsp;&nbsp;&nbsp;GeocluePositionFields<br>&nbsp;&nbsp;&nbsp;&nbsp;geoclue_position_get_position (GeocluePosition&nbsp;&nbsp;*position,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*timestamp,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; double&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *latitude,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; double&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *longitude,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; double&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *altitude,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GeoclueAccuracy **accuracy,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GError&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**error);<br>
 <br> where the return value is a validity bitfield. So a check for altitude<br> validity would be &quot;if (retval &amp; GEOCLUE_POSITION_FIELDS_ALTITUDE)&quot;.</blockquote><div><br>As you allocate output structures and fill the call stack with pointers anyway, I&#39;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-&gt;field_flags &amp; GEOCLUE_POSITION_FIELDS_ALTITUDE) != 0) {<br>
&nbsp;&nbsp;&nbsp; /* use data-&gt;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&#39;re considering DBus properties where a Telepathy-specific property access interface, or other assorted methods, are currently used. Simon knows better if it&#39;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;">&gt; Then, if we consider Python bindings, a straightforward binding would<br> &gt; turn the above into:<br>
 &gt; (time, lat, lon, alt, accuracy) = pos.get_position()<br> &gt;<br> &gt; Not very convenient if you need only some of those values.<br> <br> <br>Not much of a python developer myself, so I can&#39;t judge how inconvenient<br>
 that is...Would you say it&#39;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&#39;d create an object with data access fields or methods anyway. I just can&#39;t see why the C API should be much different then.<br>
</div><br></div>Best regards,<br>&nbsp; Mikhail<br>