summaryrefslogtreecommitdiff
path: root/docs/reference/xml/gypsy-course.xml
blob: 0dfeab1e3f92863a4566e1709d66671d195965e8 (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
<?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="GypsyCourse">
<refmeta>
<refentrytitle role="top_of_page">GypsyCourse</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GYPSY Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>GypsyCourse</refname>
<refpurpose>Object for obtaining course information</refpurpose>
<!--[<xref linkend="desc" endterm="desc.title"/>]-->
</refnamediv>

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

<synopsis>



                    <link linkend="GypsyCourse-struct">GypsyCourse</link>;
#define             <link linkend="GYPSY-COURSE-DBUS-INTERFACE:CAPS">GYPSY_COURSE_DBUS_INTERFACE</link>
#define             <link linkend="GYPSY-COURSE-DBUS-SERVICE:CAPS">GYPSY_COURSE_DBUS_SERVICE</link>
enum                <link linkend="GypsyCourseFields">GypsyCourseFields</link>;
<link linkend="GypsyCourse">GypsyCourse</link>*        <link linkend="gypsy-course-new">gypsy_course_new</link>                    (const <link linkend="char">char</link> *object_path);
<link linkend="GypsyCourseFields">GypsyCourseFields</link>   <link linkend="gypsy-course-get-course">gypsy_course_get_course</link>             (<link linkend="GypsyCourse">GypsyCourse</link> *course,
                                                         <link linkend="int">int</link> *timestamp,
                                                         <link linkend="double">double</link> *speed,
                                                         <link linkend="double">double</link> *direction,
                                                         <link linkend="double">double</link> *climb,
                                                         <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>
   +----GypsyCourse
</synopsis>

</refsect1>





<refsect1 role="properties">
<title role="properties.title">Properties</title>
<synopsis>

  &quot;<link linkend="GypsyCourse--object-path">object-path</link>&quot;              <link linkend="gchararray">gchararray</link>            : Write / Construct Only
</synopsis>
</refsect1>

<refsect1 role="signal_proto">
<title role="signal_proto.title">Signals</title>
<synopsis>

  &quot;<link linkend="GypsyCourse-course-changed">course-changed</link>&quot;                                 : Run First / No Recursion
</synopsis>
</refsect1>


<refsect1 role="desc">
<title role="desc.title">Description</title>
<para>
<link linkend="GypsyCourse"><type>GypsyCourse</type></link> is used whenever the client program wishes to know about
GPS course changes. It can report the current course, and has a signal
to notify listeners of changes. The course consists of the speed, direction
and rate of ascent or descent (called the climb).
</para>
<para>
A <link linkend="GypsyCourse"><type>GypsyCourse</type></link> object is created using <link linkend="gypsy-course-new"><function>gypsy_course_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
course with <link linkend="gypsy-course-get-course"><function>gypsy_course_get_course()</function></link>.
</para>
<para>
As the course information changes <link linkend="GypsyCourse"><type>GypsyCourse</type></link> will emit the 
course-changed signal. This signal contains the course information if 
gypsy-daemon knows it. It has a fields paramater which is a bitmask of
<link linkend="GypsyCourseFields"><type>GypsyCourseFields</type></link> which indicates which of the speed, direction or
climb contains valid information. The timestamp will always be valid
if it is greater than 0.
</para>
<para>
<informalexample>
<programlisting>
GypsyCourse *course;
GError *error = NULL;

. . .

/ * path comes from the gypsy_control_create() function * /
course = gypsy_course_new (path);
g_signal_connect (course, "course-changed", G_CALLBACK (course_changed), NULL);

. . .

static void 
course_changed (GypsyCourse *course, 
GypsyCourseFields fields,
int timestamp,
double speed,
double direction,
double climb,
gpointer userdata)
{
&nbsp;&nbsp;g_print ("speed: %fm/s\n", (fields &amp; GYPSY_COURSE_FIELDS_SPEED) ? speed : -1.0);
}
</programlisting>
</informalexample></para>
<para>

</para>
</refsect1>

<refsect1 role="details">
<title role="details.title">Details</title>
<refsect2>
<title><anchor id="GypsyCourse-struct" role="struct"/>GypsyCourse</title>
<indexterm><primary>GypsyCourse</primary></indexterm><programlisting>typedef struct _GypsyCourse GypsyCourse;</programlisting>
<para>
There are no public fields in <link linkend="GypsyCourse"><type>GypsyCourse</type></link>.</para>
<para>

</para></refsect2>
<refsect2>
<title><anchor id="GYPSY-COURSE-DBUS-INTERFACE:CAPS" role="macro"/>GYPSY_COURSE_DBUS_INTERFACE</title>
<indexterm><primary>GYPSY_COURSE_DBUS_INTERFACE</primary></indexterm><programlisting>#define GYPSY_COURSE_DBUS_INTERFACE "org.freedesktop.Gypsy.Course"
</programlisting>
<para>
A define containing the name of the Course interface</para>
<para>

</para></refsect2>
<refsect2>
<title><anchor id="GYPSY-COURSE-DBUS-SERVICE:CAPS" role="macro"/>GYPSY_COURSE_DBUS_SERVICE</title>
<indexterm><primary>GYPSY_COURSE_DBUS_SERVICE</primary></indexterm><programlisting>#define GYPSY_COURSE_DBUS_SERVICE "org.freedesktop.Gypsy"
</programlisting>
<para>
A define containing the address of the Course service</para>
<para>

</para></refsect2>
<refsect2>
<title><anchor id="GypsyCourseFields" role="enum"/>enum GypsyCourseFields</title>
<indexterm><primary>GypsyCourseFields</primary></indexterm><programlisting>typedef enum {
	GYPSY_COURSE_FIELDS_NONE = 0,
	GYPSY_COURSE_FIELDS_SPEED = 1 &lt;&lt; 0,
	GYPSY_COURSE_FIELDS_DIRECTION = 1 &lt;&lt; 1,
	GYPSY_COURSE_FIELDS_CLIMB = 1 &lt;&lt; 2
} GypsyCourseFields;
</programlisting>
<para>
A bitfield telling which fields in the course_changed callback are valid</para>
<para>

</para><variablelist role="enum">
<varlistentry>
<term><anchor id="GYPSY-COURSE-FIELDS-NONE:CAPS" role="constant"/><literal>GYPSY_COURSE_FIELDS_NONE</literal></term>
<listitem><simpara> None of the fields are valid
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="GYPSY-COURSE-FIELDS-SPEED:CAPS" role="constant"/><literal>GYPSY_COURSE_FIELDS_SPEED</literal></term>
<listitem><simpara> The speed field is valid
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="GYPSY-COURSE-FIELDS-DIRECTION:CAPS" role="constant"/><literal>GYPSY_COURSE_FIELDS_DIRECTION</literal></term>
<listitem><simpara> The direction field is valid
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="GYPSY-COURSE-FIELDS-CLIMB:CAPS" role="constant"/><literal>GYPSY_COURSE_FIELDS_CLIMB</literal></term>
<listitem><simpara> The climb field is valid
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gypsy-course-new" role="function"/>gypsy_course_new ()</title>
<indexterm><primary>gypsy_course_new</primary></indexterm><programlisting><link linkend="GypsyCourse">GypsyCourse</link>*        gypsy_course_new                    (const <link linkend="char">char</link> *object_path);</programlisting>
<para>
Creates a new <link linkend="GypsyCourse"><type>GypsyCourse</type></link> object that listens for course changes
from the GPS device found at <parameter>object_path</parameter>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>object_path</parameter>&nbsp;:</term>
<listitem><simpara> Object path to the GPS device.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> A <link linkend="GypsyCourse"><type>GypsyCourse</type></link> object
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gypsy-course-get-course" role="function"/>gypsy_course_get_course ()</title>
<indexterm><primary>gypsy_course_get_course</primary></indexterm><programlisting><link linkend="GypsyCourseFields">GypsyCourseFields</link>   gypsy_course_get_course             (<link linkend="GypsyCourse">GypsyCourse</link> *course,
                                                         <link linkend="int">int</link> *timestamp,
                                                         <link linkend="double">double</link> *speed,
                                                         <link linkend="double">double</link> *direction,
                                                         <link linkend="double">double</link> *climb,
                                                         <link linkend="GError">GError</link> **error);</programlisting>
<para>
Obtains the course details from <parameter>course</parameter>. <parameter>timestamp</parameter>, <parameter>speed</parameter>, <parameter>direction</parameter> and
<parameter>climb</parameter> can be <link linkend="NULL:CAPS"><type>NULL</type></link> if that detail is not required.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>course</parameter>&nbsp;:</term>
<listitem><simpara> A <link linkend="GypsyCourse"><type>GypsyCourse</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>timestamp</parameter>&nbsp;:</term>
<listitem><simpara> Pointer for the timestamp to be returned
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>speed</parameter>&nbsp;:</term>
<listitem><simpara> Pointer for the speed to be returned
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>direction</parameter>&nbsp;:</term>
<listitem><simpara> Pointer for the direction to be returned
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>climb</parameter>&nbsp;:</term>
<listitem><simpara> Pointer for the climb to be returned
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>error</parameter>&nbsp;:</term>
<listitem><simpara> A <link linkend="GError"><type>GError</type></link> for error return
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> A bitmask of the fields that are set.
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>
<refsect1 role="property_details">
<title role="property_details.title">Property Details</title>
<refsect2><title><anchor id="GypsyCourse--object-path"/>The &quot;<literal>object-path</literal>&quot; property</title>
<indexterm><primary>GypsyCourse:object-path</primary></indexterm><programlisting>  &quot;object-path&quot;              <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="GypsyCourse-course-changed"/>The &quot;course-changed&quot; signal</title>
<indexterm><primary>GypsyCourse::course-changed</primary></indexterm><programlisting><link linkend="void">void</link>                user_function                      (<link linkend="GypsyCourse">GypsyCourse</link> *fields,
                                                        <link linkend="gint">gint</link>         timestamp,
                                                        <link linkend="gint">gint</link>         speed,
                                                        <link linkend="gdouble">gdouble</link>      direction,
                                                        <link linkend="gdouble">gdouble</link>      climb,
                                                        <link linkend="gdouble">gdouble</link>      arg5,
                                                        <link linkend="gpointer">gpointer</link>     user_data)      : Run First / No Recursion</programlisting>
<para>
The ::course-changed signal is emitted when the GPS device
indicates that one or more of the course 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>&nbsp;:</term>
<listitem><simpara> A bitmask of <link linkend="GypsyCourseFields"><type>GypsyCourseFields</type></link> indicating which of the following fields are valid
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>timestamp</parameter>&nbsp;:</term>
<listitem><simpara> The time this change occurred
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>speed</parameter>&nbsp;:</term>
<listitem><simpara> The new speed
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>direction</parameter>&nbsp;:</term>
<listitem><simpara> The new direction
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>climb</parameter>&nbsp;:</term>
<listitem><simpara> The new rate of climb
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>user_data</parameter>&nbsp;:</term>
<listitem><simpara>user data set when the signal handler was connected.</simpara></listitem></varlistentry>
</variablelist></refsect2>
</refsect1>



</refentry>