summaryrefslogtreecommitdiff
path: root/gpsfake.xml
blob: 25fe767017f3b5b77cdacb7cbc4ee5263f9255a4 (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
<?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 id='gpsfake.1'>
<refentryinfo><date>12 Feb 2005</date></refentryinfo>
<refmeta>
<refentrytitle>gpsfake</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo class="source">The GPSD Project</refmiscinfo>
<refmiscinfo class="manual">GPSD Documentation</refmiscinfo>
</refmeta>
<refnamediv id='name'>
<refname>gpsfake</refname>
<refpurpose>test harness for gpsd, simulating a GPS</refpurpose>
</refnamediv>
<refsynopsisdiv id='synopsis'>

<cmdsynopsis>
  <command>gpsfake</command>  
      <arg choice='opt'>-1</arg>
      <arg choice='opt'>-h</arg>
      <arg choice='opt'>-b</arg>
      <arg choice='opt'>-c <replaceable>interval</replaceable></arg>
      <arg choice='opt'>-i</arg>
      <arg choice='opt'>-D <replaceable>debuglevel</replaceable></arg>
      <arg choice='opt'>-l</arg>
      <arg choice='opt'>-m <replaceable>monitor</replaceable></arg>
      <arg choice='opt'>-n</arg>
      <arg choice='opt'>-o <replaceable>options</replaceable></arg>
      <arg choice='opt'>-p</arg>
      <arg choice='opt'>-P <replaceable>port</replaceable></arg>
      <arg choice='opt'>-r <replaceable>initcmd</replaceable></arg>
      <arg choice='opt'>-s <replaceable>speed</replaceable></arg>
      <arg choice='opt'>-u</arg>
      <arg choice='opt'>-v</arg>
      <arg rep='repeat'>
            <arg choice='plain'><replaceable>logfile</replaceable></arg>
      </arg>
</cmdsynopsis>
</refsynopsisdiv>

<refsect1 id='description'><title>DESCRIPTION</title>

<para><application>gpsfake</application> is a test harness for 
<application>gpsd</application> and its clients.  It opens a pty
(pseudo-TTY), launches a <application>gpsd</application> instance that
thinks the slave side of the pty is its GPS device, and repeatedly
feeds the contents of one or more test logfiles through the master side to the
GPS. If there are multiple logfiles, sentences from them are
interleaved in the order the files are specified.</para>

<para><application>gpsfake</application> does not require root
privileges, and can be run concurrently with a production 
<application>gpsd</application> instance without causing problems.</para>

<para>The logfiles may be of NMEA, SiRF packets, TSIP packets, or
Zodiac packets.  Leading lines beginning with # will be treated as
comments and ignored.</para>

<para>The <application>gpsd</application> instance is run in
foreground.  The thread sending fake GPS data to the daemon 
is run in background.</para>

</refsect1>
<refsect1 id='options'><title>OPTIONS</title>

<para>With the -1 option, the logfile is interpreted once only rather
than repeatedly.  This option is intended to facilitate regression
testing.</para>

<para>The -b option enables a twirling-baton progress indicator
on standard error.  At termination, it reports elapsed time.</para>

<para>The -c option sets the delay between sentences in
seconds. Fractional values of seconds are legal.  The default is zero
(no delay).</para>

<para>The -l option makes the program dump a line or packet number
just before each sentence is fed to the daemon. If the sentence is
textual (e.g. NMEA), the text is dumped as well.  If not, the packet
will be dumped in hexadecimal (except for RTCM packets, which aren't
dumped at all).  This option is useful for checking that gpsfake is
getting packet boundaries right.</para>

<para>The -i option is for single-stepping through logfiles.  It dumps
the line or packet number (and the sentence if the protocol is
textual) followed by "? ".  Only when the user keys Enter is the line
actually fed to <application>gpsd</application>.</para>

<para>The -m option specifies a monitor program inside which the
daemon should be run.  This option is intended to be used with
<citerefentry><refentrytitle>valgrind</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>gdb</refentrytitle><manvolnum>1</manvolnum></citerefentry>
and similar programs.</para>

<para>The -g option uses the monitor facility to run the
<application>gpsd</application> instance within gpsfake under control
of gdb.</para>

<para>The -o option specifies options to pass to the daemon.  The -n
option passes -n to start the daemon reading the GPS without waiting
for a client (equivalent to -o "-n").  The -D option passes a -D
option to the daemon: thus -D 4 is shorthand for -o "-D 4".</para>

<para>The -p ("pipe") option sets watcher mode and dumps the NMEA and GPSD
notifications generated by the log to standard output. This is useful
for regression-testing.</para>

<para>The -P ("port") option sets the daemon's listening port.</para>

<para>The -r option specifies an initialization command to use in pipe mode.  
The default is <command>?WATCH={"enable":true,"json":true}</command>.</para>

<para>The -s option sets the baud rate for the slave tty.  The
default is 4800.</para>

<para>The -u option forces the test framework to use UDP rather than
pty devices. This may be useful for testing from within chroot jails
where access to pty devices is locked out.</para>

<para>The -v option enables verbose progress reports to stderr.  It is
mainly useful for debugging <application>gpsfake</application>
itself.</para>

<para>The -x option dumps packets as
<application>gpsfake</application> gathers them.  It is mainly useful
for debugging <application>gpsfake</application> itself.</para>

<para>The -h option makes <application>gpsfake</application> print 
a usage message and exit.</para>

<para>The argument must be the name of a file containing the 
data to be cycled at the device. <application>gpsfake</application> 
will print a notification each time it cycles.</para>

<para>Normally, gpsfake creates a pty for each logfile and passes the
slave side of the device to the daemon.  If the header comment in the
logfile contains the string "UDP", packets are instead shipped via UDP
port 5000 to the address 192.168.0.1.255.  You can monitor them with
this: <command>tcpdump -s0 -n -A -i lo udp and port 5000</command>.</para>

</refsect1>
<refsect1 id='custom'><title>CUSTOM TESTS</title>

<para><application>gpsfake</application> is a trivial wrapper around a
Python module, also named gpsfake, that can be used to fully script
sessions involving a <application>gpsd</application> instance, any
number of client sessions, and any number of fake GPSes feeding the
daemon instance with data from specified sentence logs.</para>

<para>Source and embedded documentation for this module is shipped with the 
<application>gpsd</application> development tools.  You can use it to
torture-test either <application>gpsd</application> itself or any
<application>gpsd</application>-aware client application.</para>

<para>Logfiles for the use with <application>gpsfake</application> can
be retrieved using <application>gpspipe</application>,
<application>gpscat</application>, or
<application>gpsmon</application> from the gpsd distribution, or any
other application which is able to create a compatible output.</para>

<para>If <application>gpsfake</application> exits with "Cannot execute
gpsd: executable not found." the environment variable GPSD_HOME can be
set to the path where gpsd can be found. (instead of adding that folder
to the PATH environment variable</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>,
<citerefentry><refentrytitle>libgpsd</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>gpsctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>gpspipe</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>gpsprof</refentrytitle><manvolnum>1</manvolnum></citerefentry>
<citerefentry><refentrytitle>gpsmon</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
</para>
</refsect1>

<refsect1 id='maintainer'><title>AUTHOR</title> 

<para>Eric S. Raymond <email>esr@thyrsus.com</email>.  There is a
project page for <application>gpsd</application> <ulink
url="http://gpsd.berlios.de/">here</ulink>.</para>

</refsect1>

</refentry>