summaryrefslogtreecommitdiff
path: root/libgpsd.xml
blob: f9a54f0554c857c60dcb294213b28633e20e58c3 (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
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
This file is Copyright (c) 2010 by the GPSD project
BSD terms apply: see the file COPYING in the distribution root for details.
-->
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
                   "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<refentry>
<refentryinfo><date>14 Aug 2004</date></refentryinfo>
<refmeta>
<refentrytitle>3</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo class="source">The GPSD Project</refmiscinfo>
<refmiscinfo class="manual">GPSD Documentation</refmiscinfo>
</refmeta>
<refnamediv id='name'>
<refname>libgpsd</refname>
<refpurpose>service library for GPS applications</refpurpose>
</refnamediv>
<refsynopsisdiv id='synopsis'>
<funcsynopsis>
<funcsynopsisinfo>
C:

#include &lt;gpsd.h&gt;

</funcsynopsisinfo>


<funcprototype>
<funcdef>int <function>gpsd_open_dgps</function></funcdef>
    <paramdef>char * <parameter>dgpsserver</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>void <function>gpsd_init</function></funcdef>
    <paramdef>struct gps_device_t *<parameter>session</parameter></paramdef>
    <paramdef>struct * <parameter>gps_context_t *</parameter></paramdef>
    <paramdef>char * <parameter>device</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>int <function>gpsd_activate</function></funcdef>
    <paramdef>struct gps_device_t *<parameter>session</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>void <function>gpsd_deactivate</function></funcdef>
    <paramdef>struct gps_device_t * <parameter>session</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>gps_mask_t <function>gpsd_poll</function></funcdef>
    <paramdef>struct gps_device_t * <parameter>session</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>void <function>gpsd_wrap</function></funcdef>
    <paramdef>struct gps_device_t * <parameter>session</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>

<refsect1 id='description'><title>DESCRIPTION</title>
<para><emphasis remap='B'>libgpsd</emphasis>
is a service library which supports querying GPS devices; link it with
the linker option -lgpsd.  It is a set of low-level
device-handling calls, which
<citerefentry><refentrytitle>gpsd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
itself uses.  See
<citerefentry><refentrytitle>gpsd</refentrytitle><manvolnum>3</manvolnum></citerefentry>
for a description of the high-level interface, which is almost
certainly what you want.</para>

<para>Calling
<function>gpsd_init()</function>
initializes a session structure to hold the data collected by the GPS.</para>

<para>The second argument must be a context structure.  The library
will use it for information that need to be shared between sessions;
presently this includes the leap-second correction and possibly a
pointer to a shared-memory segment used to communicate with the
Network Time Protocol daemon.</para>

<para>After the session structure has been set up, you may modify some
of its members.</para>

<variablelist>
<varlistentry>
<term><structfield>gpsd_device</structfield></term>
<listitem>
<para>This member should hold the path name of the device.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><structfield>baudrate</structfield></term>
<listitem>
<para>Communication speed in bits per second.  For NMEA or SiRF devices, the
library automatically hunts through all plausible baud rates, stopping
on the one where it sees valid packets.  By setting this field you can
designate a speed to be tried at the front of the hunt queue</para>
</listitem>
</varlistentry>
</variablelist>

<para><function>gpsd_activate()</function>
initializes the connection to the GPS.
<function>gpsd_deactivate()</function>
closes the connection. These functions are provided so that
long-running programs can release a connection when there is no
activity requiring the GPS, and re-acquire it later.</para>

<para><function>gpsd_poll()</function>
queries the GPS and updates the part of the session structure that
holds position, speed, GPS signal quality, and other data returned
by the GPS. It returns a mask describing which fields have changed.</para>

<para><function>gpsd_wrap()</function>
ends the session, implicitly performing a
<function>gpsd_deactivate()</function>.</para>

<para>The calling application must define one additional function:
<function>gpsd_report()</function>.
The library will use this to issue ordinary status messages.
See <filename>gpsd.h</filename> in the source distribution for
the set of logging levels.</para>

<para>The low-level functions do not allocate or free any dynamic
storage.  They can thus be used in a long-running application (such as
<citerefentry><refentrytitle>gpsd</refentrytitle><manvolnum>8</manvolnum></citerefentry>
itself) with a guarantee that they won't cause memory leaks.</para>

</refsect1>

<refsect1 id='bugs'><title>BUGS</title>

<para>Writes to the context structure members are not guarded by
a mutex.</para>

</refsect1>

<refsect1 id='see_also'><title>SEE ALSO</title>
<para>
<citerefentry><refentrytitle>gpsd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
<citerefentry><refentrytitle>gps</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>libgps</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
</para>
</refsect1>

<refsect1 id='author'><title>AUTHOR</title>
<para>Eric S. Raymond &lt;esr@thyrsus.com&gt; based partly on earlier work by
Remco Treffkorn, Derrick Brashear, and Russ Nelson.</para>
</refsect1>
</refentry>