1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
|
<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<refentry id="GypsyPosition">
<refmeta>
<refentrytitle role="top_of_page">GypsyPosition</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GYPSY Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>GypsyPosition</refname>
<refpurpose>Object for obtaining positions from gypsy-daemon</refpurpose>
<!--[<xref linkend="desc" endterm="desc.title"/>]-->
</refnamediv>
<refsynopsisdiv role="synopsis">
<title role="synopsis.title">Synopsis</title>
<synopsis>
<link linkend="GypsyPosition-struct">GypsyPosition</link>;
#define <link linkend="GYPSY-POSITION-DBUS-INTERFACE:CAPS">GYPSY_POSITION_DBUS_INTERFACE</link>
#define <link linkend="GYPSY-POSITION-DBUS-SERVICE:CAPS">GYPSY_POSITION_DBUS_SERVICE</link>
enum <link linkend="GypsyPositionFields">GypsyPositionFields</link>;
<link linkend="GypsyPosition">GypsyPosition</link>* <link linkend="gypsy-position-new">gypsy_position_new</link> (const <link linkend="char">char</link> *object_path);
<link linkend="GypsyPositionFields">GypsyPositionFields</link> <link linkend="gypsy-position-get-position">gypsy_position_get_position</link> (<link linkend="GypsyPosition">GypsyPosition</link> *position,
<link linkend="int">int</link> *timestamp,
<link linkend="double">double</link> *latitude,
<link linkend="double">double</link> *longitude,
<link linkend="double">double</link> *altitude,
<link linkend="GError">GError</link> **error);
</synopsis>
</refsynopsisdiv>
<refsect1 role="object_hierarchy">
<title role="object_hierarchy.title">Object Hierarchy</title>
<synopsis>
<link linkend="GObject">GObject</link>
+----GypsyPosition
</synopsis>
</refsect1>
<refsect1 role="properties">
<title role="properties.title">Properties</title>
<synopsis>
"<link linkend="GypsyPosition--object-path">object-path</link>" <link linkend="gchararray">gchararray</link> : Write / Construct Only
</synopsis>
</refsect1>
<refsect1 role="signal_proto">
<title role="signal_proto.title">Signals</title>
<synopsis>
"<link linkend="GypsyPosition-position-changed">position-changed</link>" : Run First / No Recursion
</synopsis>
</refsect1>
<refsect1 role="desc">
<title role="desc.title">Description</title>
<para>
<link linkend="GypsyPosition"><type>GypsyPosition</type></link> is used whenever the client program wishes to know about
GPS position changes. It can report the current position, and has a signal
to notify listeners of changes.
</para>
<para>
A <link linkend="GypsyPosition"><type>GypsyPosition</type></link> object is created using <link linkend="gypsy-position-new"><function>gypsy_position_new()</function></link> using the
D-Bus path of the GPS device. This path is returned from the
<link linkend="gypsy-control-create"><function>gypsy_control_create()</function></link> function. The client can then find out about the
position with <link linkend="gypsy-position-get-position"><function>gypsy_position_get_position()</function></link>.
</para>
<para>
As the position information changes <link linkend="GypsyPosition"><type>GypsyPosition</type></link> will emit the
position-changed signal. This signal contains the fix position if
gypsy-daemon knows it. It has a fields paramater which is a bitmask of
<link linkend="GypsyPositionFields"><type>GypsyPositionFields</type></link> which indicates which of the latitude, longitude or
altitude contains valid information. The timestamp will always be valid
if it is greater than 0.
</para>
<para>
<informalexample>
<programlisting>
GypsyPosition *position;
GError *error = NULL;
. . .
/ * path comes from the gypsy_control_create() function * /
position = gypsy_position_new (path);
g_signal_connect (position, "position-changed", G_CALLBACK (position_changed), NULL);
. . .
static void position_changed (GypsyPosition *position,
GypsyPositionFields fields,
int timestamp,
double latitude,
double longitude,
double altitude,
gpointer userdata)
{
g_print ("latitude, longitude (%f, %f)\n", (fields & GYPSY_POSITION_FIELDS_LATITUDE) ? latitude : -1.0, (fields & GYPSY_POSITION_FIELDS_LONGITUDE) ? longitude : -1.0);
}
</programlisting>
</informalexample></para>
<para>
</para>
</refsect1>
<refsect1 role="details">
<title role="details.title">Details</title>
<refsect2>
<title><anchor id="GypsyPosition-struct" role="struct"/>GypsyPosition</title>
<indexterm><primary>GypsyPosition</primary></indexterm><programlisting>typedef struct _GypsyPosition GypsyPosition;</programlisting>
<para>
There are no public fields in <link linkend="GypsyPosition"><type>GypsyPosition</type></link>.</para>
<para>
</para></refsect2>
<refsect2>
<title><anchor id="GYPSY-POSITION-DBUS-INTERFACE:CAPS" role="macro"/>GYPSY_POSITION_DBUS_INTERFACE</title>
<indexterm><primary>GYPSY_POSITION_DBUS_INTERFACE</primary></indexterm><programlisting>#define GYPSY_POSITION_DBUS_INTERFACE "org.freedesktop.Gypsy.Position"
</programlisting>
<para>
A define containing the name of the Position interface</para>
<para>
</para></refsect2>
<refsect2>
<title><anchor id="GYPSY-POSITION-DBUS-SERVICE:CAPS" role="macro"/>GYPSY_POSITION_DBUS_SERVICE</title>
<indexterm><primary>GYPSY_POSITION_DBUS_SERVICE</primary></indexterm><programlisting>#define GYPSY_POSITION_DBUS_SERVICE "org.freedesktop.Gypsy"
</programlisting>
<para>
A define containing the address of the Position service</para>
<para>
</para></refsect2>
<refsect2>
<title><anchor id="GypsyPositionFields" role="enum"/>enum GypsyPositionFields</title>
<indexterm><primary>GypsyPositionFields</primary></indexterm><programlisting>typedef enum {
GYPSY_POSITION_FIELDS_NONE = 0,
GYPSY_POSITION_FIELDS_LATITUDE = 1 << 0,
GYPSY_POSITION_FIELDS_LONGITUDE = 1 << 1,
GYPSY_POSITION_FIELDS_ALTITUDE = 1 << 2
} GypsyPositionFields;
</programlisting>
<para>
A bitmask telling which fields in the position_changed callback are valid</para>
<para>
</para><variablelist role="enum">
<varlistentry>
<term><anchor id="GYPSY-POSITION-FIELDS-NONE:CAPS" role="constant"/><literal>GYPSY_POSITION_FIELDS_NONE</literal></term>
<listitem><simpara> None of the fields are valid
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="GYPSY-POSITION-FIELDS-LATITUDE:CAPS" role="constant"/><literal>GYPSY_POSITION_FIELDS_LATITUDE</literal></term>
<listitem><simpara> The latitude field is valid
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="GYPSY-POSITION-FIELDS-LONGITUDE:CAPS" role="constant"/><literal>GYPSY_POSITION_FIELDS_LONGITUDE</literal></term>
<listitem><simpara> The longitude field is valid
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="GYPSY-POSITION-FIELDS-ALTITUDE:CAPS" role="constant"/><literal>GYPSY_POSITION_FIELDS_ALTITUDE</literal></term>
<listitem><simpara> The altitude field is valid
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gypsy-position-new" role="function"/>gypsy_position_new ()</title>
<indexterm><primary>gypsy_position_new</primary></indexterm><programlisting><link linkend="GypsyPosition">GypsyPosition</link>* gypsy_position_new (const <link linkend="char">char</link> *object_path);</programlisting>
<para>
Creates a new <link linkend="GypsyPosition"><type>GypsyPosition</type></link> object that listens for position changes
from the GPS found at <parameter>object_path</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>object_path</parameter> :</term>
<listitem><simpara> Object path to the GPS device
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> A <link linkend="GypsyPosition"><type>GypsyPosition</type></link> object
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gypsy-position-get-position" role="function"/>gypsy_position_get_position ()</title>
<indexterm><primary>gypsy_position_get_position</primary></indexterm><programlisting><link linkend="GypsyPositionFields">GypsyPositionFields</link> gypsy_position_get_position (<link linkend="GypsyPosition">GypsyPosition</link> *position,
<link linkend="int">int</link> *timestamp,
<link linkend="double">double</link> *latitude,
<link linkend="double">double</link> *longitude,
<link linkend="double">double</link> *altitude,
<link linkend="GError">GError</link> **error);</programlisting>
<para>
Obtains the current position, if known, from the GPS device.
<parameter>timestamp</parameter>, <parameter>latitude</parameter>, <parameter>longitude</parameter> and <parameter>altitude</parameter> can be <link linkend="NULL:CAPS"><type>NULL</type></link> if the result
is not required.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>position</parameter> :</term>
<listitem><simpara> A <link linkend="GypsyPosition"><type>GypsyPosition</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>timestamp</parameter> :</term>
<listitem><simpara> Pointer to store the timestamp
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>latitude</parameter> :</term>
<listitem><simpara> Pointer to store the latitude
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>longitude</parameter> :</term>
<listitem><simpara> Pointer to store the longitude
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>altitude</parameter> :</term>
<listitem><simpara> Pointer to store the altitude
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>error</parameter> :</term>
<listitem><simpara> Pointer to store a <link linkend="GError"><type>GError</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> Bitmask of <link linkend="GypsyPositionFields"><type>GypsyPositionFields</type></link> indicating what field was set
</simpara></listitem></varlistentry>
</variablelist></refsect2>
</refsect1>
<refsect1 role="property_details">
<title role="property_details.title">Property Details</title>
<refsect2><title><anchor id="GypsyPosition--object-path"/>The "<literal>object-path</literal>" property</title>
<indexterm><primary>GypsyPosition:object-path</primary></indexterm><programlisting> "object-path" <link linkend="gchararray">gchararray</link> : Write / Construct Only</programlisting>
<para>
The path of the Gypsy GPS object</para>
<para>
</para><para>Default value: ""</para>
</refsect2>
</refsect1>
<refsect1 role="signals">
<title role="signals.title">Signal Details</title>
<refsect2><title><anchor id="GypsyPosition-position-changed"/>The "position-changed" signal</title>
<indexterm><primary>GypsyPosition::position-changed</primary></indexterm><programlisting><link linkend="void">void</link> user_function (<link linkend="GypsyPosition">GypsyPosition</link> *fields,
<link linkend="gint">gint</link> timestamp,
<link linkend="gint">gint</link> latitude,
<link linkend="gdouble">gdouble</link> longitude,
<link linkend="gdouble">gdouble</link> altitude,
<link linkend="gdouble">gdouble</link> arg5,
<link linkend="gpointer">gpointer</link> user_data) : Run First / No Recursion</programlisting>
<para>
The ::position-changed signal is emitted when the GPS device
indicates that one or more of the position fields has changed.
The fields which have changed will be indicated in the <parameter>fields</parameter>
bitmask.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>fields</parameter> :</term>
<listitem><simpara> A bitmask of <link linkend="GypsyPositionFields"><type>GypsyPositionFields</type></link> indicating which of the following fields are valid
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>timestamp</parameter> :</term>
<listitem><simpara> The timestamp when this change occurred
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>latitude</parameter> :</term>
<listitem><simpara> The new latitude
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>longitude</parameter> :</term>
<listitem><simpara> The new longitude
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>altitude</parameter> :</term>
<listitem><simpara> The new altitude
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>user_data</parameter> :</term>
<listitem><simpara>user data set when the signal handler was connected.</simpara></listitem></varlistentry>
</variablelist></refsect2>
</refsect1>
</refentry>
|