13(3)                                                                      3(3)
2
3
4

NAME

6       libgpsd - service library for GPS applications
7

SYNOPSIS

9       C:
10
11       #include <gpsd.h>
12
13
14
15
16       int gpsd_open_dgps (char * dgpsserver);
17
18       void gpsd_init (struct gps_device_t *session, struct * gps_context_t *,
19                       char * device);
20
21       int gpsd_activate (struct gps_device_t *session, bool reconfigurable);
22
23       void gpsd_deactivate (struct gps_device_t * session);
24
25       gps_mask_t gpsd_poll (struct gps_device_t * session);
26
27       void gpsd_wrap (struct gps_device_t * session);
28
29       void gpsd_report (int d, const char * fmt, ...);
30
31

DESCRIPTION

33       libgps is a service library which supports querying GPS  devices;  link
34       it  with the linker option -lgps. There are two interfaces supported in
35       it; one high-level interface that goes through gpsd(1) and is  intended
36       for concurrent use by several applications, and one low-level interface
37       that speaks directly with the serial or USB device to which the GPS  is
38       attached.  This  page  describes the low-level interface, which gpsd(1)
39       itself uses. See gpsd(3) for a description of the high-level interface,
40       which is almost certainly what you want.
41
42
43       Calling  gpsd_init()  initializes  a session structure to hold the data
44       collected by the GPS.
45
46
47       You may optionally specify a DGPS server, either as a string containing
48       a  server name or a string containining server name followed by a colon
49       and a port name or number. To specify no DGPS, pass the null pointer.
50
51
52       The second argument must be a context structure. The library  will  use
53       it  for  information that need to be shared between sessions; presently
54       this includes the leap-second correction and possibly a  pointer  to  a
55       shared-memory  segment used to communicate with the Network Time Proto‐
56       col daemon.
57
58
59       After the session structure has been set up, you may modify some of its
60       members.
61
62
63       gpsd_device
64              This member should hold the path name of the device.
65
66
67       baudrate
68              Communication  speed  in  bits  per second. For NMEA or SiRF de‐
69              vices, the library automatically  hunts  through  all  plausible
70              baud  rates, stopping on the one where it sees valid packets. By
71              setting this field you can designate a speed to be tried at  the
72              front of the hunt queue
73
74
75       raw_hook
76              A hook function to be executed on each NMEA sentence or as it is
77              read from the GPS. The data from non-NMEA GPSes like the  Earth‐
78              Mate  will be translated to an NMEA sentence before being passed
79              to the hook. Parameters are a pointer to  a  gps_data  structure
80              full  of  parsed data, the sentence, the length of the sentence,
81              and a rawness level.
82
83
84       gpsd_activate() initializes the connection  to  the  GPS.  gpsd_deacti‐
85       vate()  closes  the  connection.  These  functions are provided so that
86       long-running programs can release a connection when there is no activi‐
87       ty requiring the GPS, and re-acquire it later.
88
89
90       gpsd_poll()  queries the GPS and updates the part of the session struc‐
91       ture that holds position, speed, GPS signal quality, and other data re‐
92       turned  by  the  GPS.  It  returns  a mask describing which fields have
93       changed.
94
95
96       gpsd_wrap() ends the  session,  implicitly  performing  a  gpsd_deacti‐
97       vate().
98
99
100       The  calling  application must define one additional function: gpsd_re‐
101       port(). The library will use this to issue  ordinary  status  messages.
102       Use first argument of 0 for errors, 1 for ordinary status messages, and
103       2 or higher for debugging messages.
104
105
106       The low-level functions do not allocate or free  any  dynamic  storage.
107       They  can  thus  be used in a long-running application (such as gpsd(8)
108       itself) with a guarantee that they won't cause memory leaks.
109
110

BUGS

112       Writes to the context structure members are not guarded by a mutex.
113
114

SEE ALSO

116        gpsd(8), gps(1), libgpsd(3).
117
118

AUTHOR

120       Eric S. Raymond <esr@thyrsus.com> based partly on earlier work by Remco
121       Treffkorn, Derrick Brashear, and Russ Nelson.
122
123
124
125
126                                  14 Aug 2004                             3(3)
Impressum