summaryrefslogtreecommitdiff
path: root/docs/reference/xml/gypsy-device.xml
blob: 26cb8761192ddc035d011c0a3b240fde0ced9660 (plain)
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
294
295
296
297
298
299
300
301
302
303
304
<?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="GypsyDevice">
<refmeta>
<refentrytitle role="top_of_page" id="GypsyDevice.top_of_page">GypsyDevice</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GYPSY Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>GypsyDevice</refname>
<refpurpose>Object for obtaining device information</refpurpose>
</refnamediv>

<refsynopsisdiv id="GypsyDevice.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>
                    <link linkend="GypsyDevice-struct">GypsyDevice</link>;
#define             <link linkend="GYPSY-DEVICE-DBUS-SERVICE--CAPS">GYPSY_DEVICE_DBUS_SERVICE</link>
#define             <link linkend="GYPSY-DEVICE-DBUS-INTERFACE--CAPS">GYPSY_DEVICE_DBUS_INTERFACE</link>
enum                <link linkend="GypsyDeviceFixStatus">GypsyDeviceFixStatus</link>;
<link linkend="GypsyDevice">GypsyDevice</link> *       <link linkend="gypsy-device-new">gypsy_device_new</link>                    (const <link linkend="char">char</link> *object_path);
<link linkend="gboolean">gboolean</link>            <link linkend="gypsy-device-get-connection-status">gypsy_device_get_connection_status</link>  (<link linkend="GypsyDevice">GypsyDevice</link> *device,
                                                         <link linkend="GError">GError</link> **error);
<link linkend="GypsyDeviceFixStatus">GypsyDeviceFixStatus</link>  <link linkend="gypsy-device-get-fix-status">gypsy_device_get_fix_status</link>       (<link linkend="GypsyDevice">GypsyDevice</link> *device,
                                                         <link linkend="GError">GError</link> **error);
<link linkend="gboolean">gboolean</link>            <link linkend="gypsy-device-start">gypsy_device_start</link>                  (<link linkend="GypsyDevice">GypsyDevice</link> *device,
                                                         <link linkend="GError">GError</link> **error);
<link linkend="gboolean">gboolean</link>            <link linkend="gypsy-device-stop">gypsy_device_stop</link>                   (<link linkend="GypsyDevice">GypsyDevice</link> *device,
                                                         <link linkend="GError">GError</link> **error);
</synopsis>
</refsynopsisdiv>

<refsect1 id="GypsyDevice.object-hierarchy" role="object_hierarchy">
<title role="object_hierarchy.title">Object Hierarchy</title>
<synopsis>
  <link linkend="GObject">GObject</link>
   +----GypsyDevice
</synopsis>
</refsect1>





<refsect1 id="GypsyDevice.properties" role="properties">
<title role="properties.title">Properties</title>
<synopsis>
  &quot;<link linkend="GypsyDevice--object-path">object-path</link>&quot;              <link linkend="gchar">gchar</link>*                : Write / Construct Only
</synopsis>
</refsect1>

<refsect1 id="GypsyDevice.signals" role="signal_proto">
<title role="signal_proto.title">Signals</title>
<synopsis>
  &quot;<link linkend="GypsyDevice-connection-changed">connection-changed</link>&quot;                             : Run First / No Recursion
  &quot;<link linkend="GypsyDevice-fix-status-changed">fix-status-changed</link>&quot;                             : Run First / No Recursion
</synopsis>
</refsect1>


<refsect1 id="GypsyDevice.description" role="desc">
<title role="desc.title">Description</title>
<para>
<link linkend="GypsyDevice"><type>GypsyDevice</type></link> is used whenever the client program wishes to know about
changes in the device's status. It has signals for connection status and
fix status. It can also be used to tell gypsy-daemon to start or stop parsing
sentences from the GPS device.
</para>
<para>
A <link linkend="GypsyDevice"><type>GypsyDevice</type></link> object is created using <link linkend="gypsy-device-new"><function>gypsy_device_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 start the GPS data stream with <link linkend="gypsy-device-start"><function>gypsy_device_start()</function></link>,
stop it with <link linkend="gypsy-device-stop"><function>gypsy_device_stop()</function></link>, or find out about the status with
<link linkend="gypsy-device-get-fix-status"><function>gypsy_device_get_fix_status()</function></link> and <link linkend="gypsy-device-get-connection-status"><function>gypsy_device_get_connection_status()</function></link>.
</para>
<para>
As the fix status and connection status change, <link linkend="GypsyDevice"><type>GypsyDevice</type></link> will emit the
<link linkend="GypsyDevice-fix-status-changed"><type>"fix-status-changed"</type></link> and <link linkend="GypsyDevice-connection-changed"><type>"connection-changed"</type></link> signals
respectively.
</para>
<para>
<informalexample>
<programlisting>
GypsyDevice *device;
GError *error = NULL;

. . .

/<!-- -->* path comes from the <link linkend="gypsy-control-create">gypsy_control_create</link>() function *<!-- -->/
device = <link linkend="gypsy-device-new">gypsy_device_new</link> (path);
g_signal_connect (device, "connection-changed", G_CALLBACK (connection_changed), NULL);
<link linkend="gypsy-device-start">gypsy_device_start</link> (device, &amp;error);
if (error != NULL) {
&nbsp;&nbsp;g_warning ("Error starting GPS: %s", error->message);
&nbsp;&nbsp;g_error_free (error);
}

. . .

static void connection_changed (GypsyDevice *device, gboolean connected, gpointer data)
{
&nbsp;&nbsp;g_print ("Connection status: %s\n", connected ? "Connected" : "Disconnected");
}
</programlisting>
</informalexample></para>
<para>
</para>
</refsect1>

<refsect1 id="GypsyDevice.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="GypsyDevice-struct" role="struct">
<title>GypsyDevice</title>
<indexterm zone="GypsyDevice-struct"><primary sortas="GypsyDevice">GypsyDevice</primary></indexterm><programlisting>typedef struct _GypsyDevice GypsyDevice;</programlisting>
<para>
There are no public fields in <link linkend="GypsyDevice"><type>GypsyDevice</type></link>.</para>
<para>
</para></refsect2>
<refsect2 id="GYPSY-DEVICE-DBUS-SERVICE--CAPS" role="macro">
<title>GYPSY_DEVICE_DBUS_SERVICE</title>
<indexterm zone="GYPSY-DEVICE-DBUS-SERVICE--CAPS"><primary sortas="GYPSY_DEVICE_DBUS_SERVICE">GYPSY_DEVICE_DBUS_SERVICE</primary></indexterm><programlisting>#define GYPSY_DEVICE_DBUS_SERVICE "org.freedesktop.Gypsy"
</programlisting>
<para>
A define containing the name of the Device service</para>
<para>
</para></refsect2>
<refsect2 id="GYPSY-DEVICE-DBUS-INTERFACE--CAPS" role="macro">
<title>GYPSY_DEVICE_DBUS_INTERFACE</title>
<indexterm zone="GYPSY-DEVICE-DBUS-INTERFACE--CAPS"><primary sortas="GYPSY_DEVICE_DBUS_INTERFACE">GYPSY_DEVICE_DBUS_INTERFACE</primary></indexterm><programlisting>#define GYPSY_DEVICE_DBUS_INTERFACE "org.freedesktop.Gypsy.Device"
</programlisting>
<para>
A define containing the name of the Device interface</para>
<para>
</para></refsect2>
<refsect2 id="GypsyDeviceFixStatus" role="enum">
<title>enum GypsyDeviceFixStatus</title>
<indexterm zone="GypsyDeviceFixStatus"><primary sortas="GypsyDeviceFixStatus">GypsyDeviceFixStatus</primary></indexterm><programlisting>typedef enum {
	GYPSY_DEVICE_FIX_STATUS_INVALID = 0,
	GYPSY_DEVICE_FIX_STATUS_NONE,
	GYPSY_DEVICE_FIX_STATUS_2D,
	GYPSY_DEVICE_FIX_STATUS_3D
} GypsyDeviceFixStatus;
</programlisting>
<para>
An enumeration representing the various fix states that a GPS device can be in.</para>
<para>
</para><variablelist role="enum">
<varlistentry id="GYPSY-DEVICE-FIX-STATUS-INVALID--CAPS" role="constant">
<term><literal>GYPSY_DEVICE_FIX_STATUS_INVALID</literal></term>
<listitem><simpara> The fix is invalid
</simpara></listitem>
</varlistentry>
<varlistentry id="GYPSY-DEVICE-FIX-STATUS-NONE--CAPS" role="constant">
<term><literal>GYPSY_DEVICE_FIX_STATUS_NONE</literal></term>
<listitem><simpara> A fix has not yet been obtained
</simpara></listitem>
</varlistentry>
<varlistentry id="GYPSY-DEVICE-FIX-STATUS-2D--CAPS" role="constant">
<term><literal>GYPSY_DEVICE_FIX_STATUS_2D</literal></term>
<listitem><simpara> A fix with latitude and longitude has been obtained
</simpara></listitem>
</varlistentry>
<varlistentry id="GYPSY-DEVICE-FIX-STATUS-3D--CAPS" role="constant">
<term><literal>GYPSY_DEVICE_FIX_STATUS_3D</literal></term>
<listitem><simpara> A fix with latitude, longitude and altitude has been obtained
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2 id="gypsy-device-new" role="function">
<title>gypsy_device_new ()</title>
<indexterm zone="gypsy-device-new"><primary sortas="gypsy_device_new">gypsy_device_new</primary></indexterm><programlisting><link linkend="GypsyDevice">GypsyDevice</link> *       gypsy_device_new                    (const <link linkend="char">char</link> *object_path);</programlisting>
<para>
Creates a new <link linkend="GypsyDevice"><type>GypsyDevice</type></link> that points to <parameter>object_path</parameter></para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>object_path</parameter>&#160;:</term>
<listitem><simpara> Object path to the device
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> A pointer to a <link linkend="GypsyDevice"><type>GypsyDevice</type></link>
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gypsy-device-get-connection-status" role="function">
<title>gypsy_device_get_connection_status ()</title>
<indexterm zone="gypsy-device-get-connection-status"><primary sortas="gypsy_device_get_connection_status">gypsy_device_get_connection_status</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            gypsy_device_get_connection_status  (<link linkend="GypsyDevice">GypsyDevice</link> *device,
                                                         <link linkend="GError">GError</link> **error);</programlisting>
<para>
Obtains the connection status of <parameter>device</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>device</parameter>&#160;:</term>
<listitem><simpara> A <link linkend="GypsyDevice"><type>GypsyDevice</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>error</parameter>&#160;:</term>
<listitem><simpara> A pointer to a <link linkend="GError"><type>GError</type></link> to return an error in.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="TRUE--CAPS"><type>TRUE</type></link> if the device is connected, <link linkend="FALSE--CAPS"><type>FALSE</type></link> otherwise.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gypsy-device-get-fix-status" role="function">
<title>gypsy_device_get_fix_status ()</title>
<indexterm zone="gypsy-device-get-fix-status"><primary sortas="gypsy_device_get_fix_status">gypsy_device_get_fix_status</primary></indexterm><programlisting><link linkend="GypsyDeviceFixStatus">GypsyDeviceFixStatus</link>  gypsy_device_get_fix_status       (<link linkend="GypsyDevice">GypsyDevice</link> *device,
                                                         <link linkend="GError">GError</link> **error);</programlisting>
<para>
Obtains the current fix status of <parameter>device</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>device</parameter>&#160;:</term>
<listitem><simpara> A <link linkend="GypsyDevice"><type>GypsyDevice</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>error</parameter>&#160;:</term>
<listitem><simpara> A pointer to a <link linkend="GError"><type>GError</type></link> to return a error in.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> A <link linkend="GypsyDeviceFixStatus"><type>GypsyDeviceFixStatus</type></link>
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gypsy-device-start" role="function">
<title>gypsy_device_start ()</title>
<indexterm zone="gypsy-device-start"><primary sortas="gypsy_device_start">gypsy_device_start</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            gypsy_device_start                  (<link linkend="GypsyDevice">GypsyDevice</link> *device,
                                                         <link linkend="GError">GError</link> **error);</programlisting>
<para>
Starts the connection to the physical device pointed to by <parameter>device</parameter>, and
listens for incoming messages.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>device</parameter>&#160;:</term>
<listitem><simpara> A <link linkend="GypsyDevice"><type>GypsyDevice</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>error</parameter>&#160;:</term>
<listitem><simpara> A pointer to a <link linkend="GError"><type>GError</type></link> to return the error in
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="TRUE--CAPS"><type>TRUE</type></link> on success, <link linkend="FALSE--CAPS"><type>FALSE</type></link> otherwise.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gypsy-device-stop" role="function">
<title>gypsy_device_stop ()</title>
<indexterm zone="gypsy-device-stop"><primary sortas="gypsy_device_stop">gypsy_device_stop</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            gypsy_device_stop                   (<link linkend="GypsyDevice">GypsyDevice</link> *device,
                                                         <link linkend="GError">GError</link> **error);</programlisting>
<para>
Stops the physical device pointed to by <parameter>device</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>device</parameter>&#160;:</term>
<listitem><simpara> A <link linkend="GypsyDevice"><type>GypsyDevice</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>error</parameter>&#160;:</term>
<listitem><simpara> A pointer to a <link linkend="GError"><type>GError</type></link> to return the error in
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="TRUE--CAPS"><type>TRUE</type></link> on success, <link linkend="FALSE--CAPS"><type>FALSE</type></link> otherwise.
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>
<refsect1 id="GypsyDevice.property-details" role="property_details">
<title role="property_details.title">Property Details</title>
<refsect2 id="GypsyDevice--object-path" role="property"><title>The <literal>&quot;object-path&quot;</literal> property</title>
<indexterm zone="GypsyDevice--object-path"><primary sortas="GypsyDevice:object-path">GypsyDevice:object-path</primary></indexterm><programlisting>  &quot;object-path&quot;              <link linkend="gchar">gchar</link>*                : Write / Construct Only</programlisting>
<para>
The path of the Gypsy GPS object</para>
<para>
</para><para>Default value: ""</para>
</refsect2>
</refsect1>

<refsect1 id="GypsyDevice.signal-details" role="signals">
<title role="signals.title">Signal Details</title>
<refsect2 id="GypsyDevice-connection-changed" role="signal"><title>The <literal>&quot;connection-changed&quot;</literal> signal</title>
<indexterm zone="GypsyDevice-connection-changed"><primary sortas="GypsyDevice::connection-changed">GypsyDevice::connection-changed</primary></indexterm><programlisting><link linkend="void">void</link>                user_function                      (<link linkend="GypsyDevice">GypsyDevice</link> *connected,
                                                        <link linkend="gboolean">gboolean</link>     arg1,
                                                        <link linkend="gpointer">gpointer</link>     user_data)      : Run First / No Recursion</programlisting>
<para>
The ::connection-changed signal is emitted whenever the device
connection changes.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>connected</parameter>&#160;:</term>
<listitem><simpara> Whether or not the device is connected
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>user_data</parameter>&#160;:</term>
<listitem><simpara>user data set when the signal handler was connected.</simpara></listitem></varlistentry>
</variablelist></refsect2><refsect2 id="GypsyDevice-fix-status-changed" role="signal"><title>The <literal>&quot;fix-status-changed&quot;</literal> signal</title>
<indexterm zone="GypsyDevice-fix-status-changed"><primary sortas="GypsyDevice::fix-status-changed">GypsyDevice::fix-status-changed</primary></indexterm><programlisting><link linkend="void">void</link>                user_function                      (<link linkend="GypsyDevice">GypsyDevice</link> *fix_status,
                                                        <link linkend="gint">gint</link>         arg1,
                                                        <link linkend="gpointer">gpointer</link>     user_data)       : Run First / No Recursion</programlisting>
<para>
The ::fix-status-changed signal is emitted whenever the GPS device
reports that its fix status has changed. <parameter>fix_status</parameter> is a
<link linkend="GypsyDeviceFixStatus"><type>GypsyDeviceFixStatus</type></link></para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>fix_status</parameter>&#160;:</term>
<listitem><simpara> The new fix status
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>user_data</parameter>&#160;:</term>
<listitem><simpara>user data set when the signal handler was connected.</simpara></listitem></varlistentry>
</variablelist></refsect2>
</refsect1>



</refentry>