gpsd 3.25.0.489__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gpsd-3.25.0.489/AUTHORS +10 -0
- gpsd-3.25.0.489/COPYING +35 -0
- gpsd-3.25.0.489/LICENSE +32 -0
- gpsd-3.25.0.489/PKG-INFO +57 -0
- gpsd-3.25.0.489/README.md +32 -0
- gpsd-3.25.0.489/pyproject.toml +6 -0
- gpsd-3.25.0.489/setup.cfg +38 -0
- gpsd-3.25.0.489/src/clients/gegps +225 -0
- gpsd-3.25.0.489/src/clients/gpscsv +378 -0
- gpsd-3.25.0.489/src/clients/gpsplot +405 -0
- gpsd-3.25.0.489/src/clients/gpsprof +1315 -0
- gpsd-3.25.0.489/src/clients/gpssubframe +1401 -0
- gpsd-3.25.0.489/src/clients/ubxtool +557 -0
- gpsd-3.25.0.489/src/clients/xgps +1923 -0
- gpsd-3.25.0.489/src/clients/xgpsspeed +1027 -0
- gpsd-3.25.0.489/src/clients/zerk +1928 -0
- gpsd-3.25.0.489/src/contrib/gpsData +85 -0
- gpsd-3.25.0.489/src/contrib/gpssim +332 -0
- gpsd-3.25.0.489/src/contrib/ntpshmviz +137 -0
- gpsd-3.25.0.489/src/contrib/skyview2svg +378 -0
- gpsd-3.25.0.489/src/contrib/webgps +560 -0
- gpsd-3.25.0.489/src/example_aiogps +118 -0
- gpsd-3.25.0.489/src/gps/__init__.py +26 -0
- gpsd-3.25.0.489/src/gps/aiogps.py +305 -0
- gpsd-3.25.0.489/src/gps/client.py +379 -0
- gpsd-3.25.0.489/src/gps/clienthelpers.py +970 -0
- gpsd-3.25.0.489/src/gps/fake.py +883 -0
- gpsd-3.25.0.489/src/gps/gps.py +856 -0
- gpsd-3.25.0.489/src/gps/misc.py +484 -0
- gpsd-3.25.0.489/src/gps/ubx.py +9840 -0
- gpsd-3.25.0.489/src/gps/watch_options.py +16 -0
- gpsd-3.25.0.489/src/gpsd-logo.png +0 -0
- gpsd-3.25.0.489/src/gpsd.egg-info/PKG-INFO +57 -0
- gpsd-3.25.0.489/src/gpsd.egg-info/SOURCES.txt +38 -0
- gpsd-3.25.0.489/src/gpsd.egg-info/dependency_links.txt +1 -0
- gpsd-3.25.0.489/src/gpsd.egg-info/top_level.txt +1 -0
- gpsd-3.25.0.489/tests/test_clienthelpers.py +352 -0
- gpsd-3.25.0.489/tests/test_misc.py +140 -0
- gpsd-3.25.0.489/tests/test_xgps_deps.py +27 -0
gpsd-3.25.0.489/AUTHORS
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Remco Treffkorn <remco@rvt.com>
|
|
2
|
+
Derrick J. Brashear <shadow@dementia.org>
|
|
3
|
+
Russ Nelson <nelson@crynwyr.com>
|
|
4
|
+
Eric S. Raymond <esr@thyrsus.com>
|
|
5
|
+
Gary E. Miller <gem@rellim.com>
|
|
6
|
+
Jeff Francis <jeff@gritch.org>
|
|
7
|
+
Amaury Jacquot <sxpert@esitcom.org>
|
|
8
|
+
Chris Kuethe <chris.kuethe@gmail.com>
|
|
9
|
+
Ville Nuorvala <vnuorval@tcs.hut.fi>
|
|
10
|
+
Fulup Ar Foll <fulup@sinagot.net>
|
gpsd-3.25.0.489/COPYING
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
COPYRIGHTS
|
|
2
|
+
|
|
3
|
+
Compilation copyright is held by the GPSD project. All rights reserved.
|
|
4
|
+
|
|
5
|
+
GPSD project copyrights are assigned to the project lead, currently
|
|
6
|
+
Eric S. Raymond. Other portions of the GPSD code are Copyright
|
|
7
|
+
1997, 1998, 1999, 2000, 2001, 2002 by Remco Treffkorn, and others
|
|
8
|
+
Copyright 2005 by Eric S. Raymond. For other copyrights, see
|
|
9
|
+
individual files.
|
|
10
|
+
|
|
11
|
+
LICENSE
|
|
12
|
+
(SPDX short identifier: BSD-2-Clause)
|
|
13
|
+
|
|
14
|
+
Redistribution and use in source and binary forms, with or without
|
|
15
|
+
modification, are permitted provided that the following conditions
|
|
16
|
+
are met:
|
|
17
|
+
|
|
18
|
+
1. Redistributions of source code must retain the above copyright
|
|
19
|
+
notice, this list of conditions and the following disclaimer.
|
|
20
|
+
|
|
21
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
22
|
+
notice, this list of conditions and the following disclaimer in the
|
|
23
|
+
documentation and/or other materials provided with the distribution.
|
|
24
|
+
|
|
25
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
26
|
+
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
27
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
28
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
|
|
29
|
+
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
30
|
+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
31
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
32
|
+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
33
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
34
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
35
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
gpsd-3.25.0.489/LICENSE
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
Valid-License-Identifier: BSD-2-Clause
|
|
2
|
+
SPDX-URL: https://spdx.org/licenses/BSD-2-Clause.html
|
|
3
|
+
Usage-Guide:
|
|
4
|
+
To use the BSD 2-clause "Simplified" License put the following SPDX
|
|
5
|
+
tag/value pair into a comment according to the placement guidelines in
|
|
6
|
+
the licensing rules documentation:
|
|
7
|
+
SPDX-License-Identifier: BSD-2-Clause
|
|
8
|
+
License-Text:
|
|
9
|
+
|
|
10
|
+
Copyright (c) <year> <owner> . All rights reserved.
|
|
11
|
+
|
|
12
|
+
Redistribution and use in source and binary forms, with or without
|
|
13
|
+
modification, are permitted provided that the following conditions are met:
|
|
14
|
+
|
|
15
|
+
1. Redistributions of source code must retain the above copyright notice,
|
|
16
|
+
this list of conditions and the following disclaimer.
|
|
17
|
+
|
|
18
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
19
|
+
notice, this list of conditions and the following disclaimer in the
|
|
20
|
+
documentation and/or other materials provided with the distribution.
|
|
21
|
+
|
|
22
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
23
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
24
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
25
|
+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
26
|
+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
27
|
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
28
|
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
29
|
+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
30
|
+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
31
|
+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
32
|
+
POSSIBILITY OF SUCH DAMAGE.
|
gpsd-3.25.0.489/PKG-INFO
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: gpsd
|
|
3
|
+
Version: 3.25.0.489
|
|
4
|
+
Summary: "fork of gps module from gpsd."
|
|
5
|
+
Home-page: https://gpsd.io/
|
|
6
|
+
Author: Eric S Raymond
|
|
7
|
+
Author-email: esr@thyrsus.com
|
|
8
|
+
Maintainer: James T Browning
|
|
9
|
+
Maintainer-email: JamesB.fe80@gmail.com
|
|
10
|
+
License: BSD 2-Clause License
|
|
11
|
+
Project-URL: Bug Tracker, https://gitlab.com/jamesb_fe80/gpsd/-/issues
|
|
12
|
+
Project-URL: IRC, https://web.libera.chat/
|
|
13
|
+
Project-URL: Project, https://gitlab.com/jamesb_fe80/gpsd
|
|
14
|
+
Project-URL: Support, https://gpsd.io/SUPPORT.html
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 2
|
|
17
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
18
|
+
Classifier: Operating System :: POSIX
|
|
19
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
License-File: COPYING
|
|
23
|
+
License-File: AUTHORS
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
|
|
26
|
+
# Pessimus GPS
|
|
27
|
+
|
|
28
|
+
WARNING: Any files at GitLab, GitHub, or other providers are not official
|
|
29
|
+
release files. The releases only occur at PyPI, similar to GPSDs
|
|
30
|
+
releases only at savannah.
|
|
31
|
+
|
|
32
|
+
## General
|
|
33
|
+
|
|
34
|
+
This module is a Fork of GPSds 'gps' python module for installs not blessed
|
|
35
|
+
by GPSD. It includes some clients interacting with GPSD.
|
|
36
|
+
|
|
37
|
+
## Resources and Support
|
|
38
|
+
|
|
39
|
+
There are none; deal with it. In particular, DON'T clog the GPSD community
|
|
40
|
+
support asking for help with this.
|
|
41
|
+
|
|
42
|
+
## Credit
|
|
43
|
+
|
|
44
|
+
The credit belongs to all the people who worked on GPSD; Gary E Miller, Eric S
|
|
45
|
+
Raymond, Chris Keuthe, Brook Milligan, Russ Nelson, Remco Treffkorn,
|
|
46
|
+
Timo Ylhainen, Carl Carter, Ville Nuorvala, Amaury Jacquot, Curt Mills,
|
|
47
|
+
Derrick J. Brashear, Bob Lorenzini, Carsten Tschach, and too many other
|
|
48
|
+
people to list.
|
|
49
|
+
|
|
50
|
+
## LICENSE
|
|
51
|
+
|
|
52
|
+
This parent software (GPSD) releases under the terms and conditions of the
|
|
53
|
+
BSD License, including a copy in the file gps/COPYING.
|
|
54
|
+
|
|
55
|
+
This parent software and its bits are Copyright 2013 by the GPSD project.
|
|
56
|
+
|
|
57
|
+
I see no need to use another license.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Pessimus GPS
|
|
2
|
+
|
|
3
|
+
WARNING: Any files at GitLab, GitHub, or other providers are not official
|
|
4
|
+
release files. The releases only occur at PyPI, similar to GPSDs
|
|
5
|
+
releases only at savannah.
|
|
6
|
+
|
|
7
|
+
## General
|
|
8
|
+
|
|
9
|
+
This module is a Fork of GPSds 'gps' python module for installs not blessed
|
|
10
|
+
by GPSD. It includes some clients interacting with GPSD.
|
|
11
|
+
|
|
12
|
+
## Resources and Support
|
|
13
|
+
|
|
14
|
+
There are none; deal with it. In particular, DON'T clog the GPSD community
|
|
15
|
+
support asking for help with this.
|
|
16
|
+
|
|
17
|
+
## Credit
|
|
18
|
+
|
|
19
|
+
The credit belongs to all the people who worked on GPSD; Gary E Miller, Eric S
|
|
20
|
+
Raymond, Chris Keuthe, Brook Milligan, Russ Nelson, Remco Treffkorn,
|
|
21
|
+
Timo Ylhainen, Carl Carter, Ville Nuorvala, Amaury Jacquot, Curt Mills,
|
|
22
|
+
Derrick J. Brashear, Bob Lorenzini, Carsten Tschach, and too many other
|
|
23
|
+
people to list.
|
|
24
|
+
|
|
25
|
+
## LICENSE
|
|
26
|
+
|
|
27
|
+
This parent software (GPSD) releases under the terms and conditions of the
|
|
28
|
+
BSD License, including a copy in the file gps/COPYING.
|
|
29
|
+
|
|
30
|
+
This parent software and its bits are Copyright 2013 by the GPSD project.
|
|
31
|
+
|
|
32
|
+
I see no need to use another license.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
[metadata]
|
|
2
|
+
name = gpsd
|
|
3
|
+
version = 3.25.0.489
|
|
4
|
+
description = "fork of gps module from gpsd."
|
|
5
|
+
long_description = file: README.md
|
|
6
|
+
long_description_content_type = text/markdown
|
|
7
|
+
author = Eric S Raymond
|
|
8
|
+
author_email = esr@thyrsus.com
|
|
9
|
+
maintainer = James T Browning
|
|
10
|
+
maintainer_email = JamesB.fe80@gmail.com
|
|
11
|
+
url = https://gpsd.io/
|
|
12
|
+
license = BSD 2-Clause License
|
|
13
|
+
project_urls =
|
|
14
|
+
Bug Tracker = https://gitlab.com/jamesb_fe80/gpsd/-/issues
|
|
15
|
+
IRC = https://web.libera.chat/
|
|
16
|
+
Project = https://gitlab.com/jamesb_fe80/gpsd
|
|
17
|
+
Support = https://gpsd.io/SUPPORT.html
|
|
18
|
+
classifiers =
|
|
19
|
+
Programming Language :: Python :: 3
|
|
20
|
+
Programming Language :: Python :: 2
|
|
21
|
+
License :: OSI Approved :: BSD License
|
|
22
|
+
Operating System :: POSIX
|
|
23
|
+
Development Status :: 5 - Production/Stable
|
|
24
|
+
|
|
25
|
+
[options]
|
|
26
|
+
package_dir =
|
|
27
|
+
= src
|
|
28
|
+
packages = gps
|
|
29
|
+
scripts = src/clients/gegps,src/clients/gpscsv,src/clients/gpsplot,src/clients/gpsprof,src/clients/gpssubframe,src/clients/ubxtool,src/clients/xgps,src/clients/xgpsspeed,src/clients/zerk,src/contrib/gpsData,src/contrib/gpssim,src/contrib/ntpshmviz,src/contrib/skyview2svg,src/contrib/webgps,src/example_aiogps
|
|
30
|
+
|
|
31
|
+
[options.data_files]
|
|
32
|
+
share/gpsd/icons =
|
|
33
|
+
src/gpsd-logo.png
|
|
34
|
+
|
|
35
|
+
[egg_info]
|
|
36
|
+
tag_build =
|
|
37
|
+
tag_date = 0
|
|
38
|
+
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
# This code is generated by waf. Do not hand-hack it!
|
|
4
|
+
# This file is Copyright 2010 by the GPSD project
|
|
5
|
+
# SPDX-License-Identifier: BSD-2-clause
|
|
6
|
+
|
|
7
|
+
# This code runs compatibly under Python 2 and 3.x for x >= 2.
|
|
8
|
+
# Preserve this property!
|
|
9
|
+
"""Feed location data from a running GPSD to a Google Earth instance.
|
|
10
|
+
|
|
11
|
+
This code originally by Jaroslaw Zachwieja and a guy referring
|
|
12
|
+
to himself/herself as TJ(http://tjworld.net)
|
|
13
|
+
Modified by Chen Wei <weichen302@aol.com> for use with gpsd
|
|
14
|
+
Cleaned up and adapted for the GPSD project by Eric S. Raymond.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from __future__ import absolute_import, print_function, division
|
|
18
|
+
|
|
19
|
+
import argparse
|
|
20
|
+
import os
|
|
21
|
+
import socket # for socket.error
|
|
22
|
+
import sys
|
|
23
|
+
|
|
24
|
+
# pylint wants local modules last
|
|
25
|
+
try:
|
|
26
|
+
import gps
|
|
27
|
+
except ImportError as error:
|
|
28
|
+
sys.stderr.write(
|
|
29
|
+
"gegps: can't load Python gps libraries -- check PYTHONPATH.\n")
|
|
30
|
+
sys.stderr.write("%s\n" % error)
|
|
31
|
+
sys.exit(1)
|
|
32
|
+
|
|
33
|
+
gps_version = '3.25.1~dev'
|
|
34
|
+
if gps.__version__ != gps_version:
|
|
35
|
+
sys.stderr.write("gegps: ERROR: need gps module version %s, got %s\n" %
|
|
36
|
+
(gps_version, gps.__version__))
|
|
37
|
+
sys.exit(1)
|
|
38
|
+
|
|
39
|
+
KML_OPEN_IN_GE = '''\
|
|
40
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
41
|
+
<kml xmlns="http://earth.google.com/kml/2.2">
|
|
42
|
+
<NetworkLink>
|
|
43
|
+
<name>Realtime GPS</name>
|
|
44
|
+
<open>1</open>
|
|
45
|
+
<Link>
|
|
46
|
+
<href>Realtime_GPS.kml</href>
|
|
47
|
+
<refreshMode>onInterval</refreshMode>
|
|
48
|
+
</Link>
|
|
49
|
+
</NetworkLink>
|
|
50
|
+
</kml>
|
|
51
|
+
'''
|
|
52
|
+
|
|
53
|
+
if str is bytes:
|
|
54
|
+
# This is here only because open in Python 2 throws a TypeError
|
|
55
|
+
# when given an encoding argument. Do not change it until the
|
|
56
|
+
# last Python 2 user dies, or someone retcons Python 2 open to
|
|
57
|
+
# accept encoding. DO NOT trust anything that says it can go.
|
|
58
|
+
polyopen = open
|
|
59
|
+
else:
|
|
60
|
+
|
|
61
|
+
def polyopen(filename, mode):
|
|
62
|
+
"""Open a file with utf-8 encoding to silence linters."""
|
|
63
|
+
return open(filename, mode, encoding="utf-8")
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def kmlize(tpv):
|
|
67
|
+
"""Kmlize.
|
|
68
|
+
|
|
69
|
+
http://code.google.com/apis/kml/documentation/kmlreference.html
|
|
70
|
+
for official kml document.
|
|
71
|
+
"""
|
|
72
|
+
latitude = tpv['lat']
|
|
73
|
+
longitude = tpv['lon']
|
|
74
|
+
|
|
75
|
+
# not all TPV includes speed, like when acquiring fix
|
|
76
|
+
if 'speed' in tpv:
|
|
77
|
+
speed_in = tpv['speed'] # meter/second
|
|
78
|
+
speed = speed_in * gps.MPS_TO_KPH # Km/h
|
|
79
|
+
else:
|
|
80
|
+
speed = 0
|
|
81
|
+
|
|
82
|
+
# not all TPV includes heading, like when acquiring fix
|
|
83
|
+
if 1 <= speed and 'track' in tpv:
|
|
84
|
+
heading = int(round(tpv['track'], 0))
|
|
85
|
+
else:
|
|
86
|
+
heading = 0
|
|
87
|
+
|
|
88
|
+
# not all TPV includes altitude
|
|
89
|
+
# like ublox8 in fixed position (time) mode
|
|
90
|
+
if 'alt' in tpv:
|
|
91
|
+
altitude = tpv['alt']
|
|
92
|
+
else:
|
|
93
|
+
altitude = 0
|
|
94
|
+
|
|
95
|
+
return """<?xml version="1.0" encoding="UTF-8"?>
|
|
96
|
+
<kml xmlns="http://earth.google.com/kml/2.0">
|
|
97
|
+
<Placemark>
|
|
98
|
+
<name>%s km/h,heading %s</name>
|
|
99
|
+
<description>Realtime GPS feeding</description>
|
|
100
|
+
<LookAt>
|
|
101
|
+
<longitude>%s</longitude>
|
|
102
|
+
<latitude>%s</latitude>
|
|
103
|
+
</LookAt>
|
|
104
|
+
<Point>
|
|
105
|
+
<coordinates>%s,%s,%s</coordinates>
|
|
106
|
+
</Point>
|
|
107
|
+
</Placemark>
|
|
108
|
+
</kml>""" % (speed, heading, longitude, latitude, longitude,
|
|
109
|
+
latitude, altitude)
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
if __name__ == "__main__":
|
|
113
|
+
description = 'Feed location data from GPSD to Google Earth.'
|
|
114
|
+
usage = '%(prog)s [OPTIONS] [host[:port[:device]]]'
|
|
115
|
+
epilog = ('BSD terms apply: see the file COPYING in the distribution root'
|
|
116
|
+
' for details.')
|
|
117
|
+
|
|
118
|
+
parser = argparse.ArgumentParser(
|
|
119
|
+
description=description,
|
|
120
|
+
epilog=epilog,
|
|
121
|
+
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
122
|
+
usage=usage)
|
|
123
|
+
parser.add_argument(
|
|
124
|
+
'-?',
|
|
125
|
+
action="help",
|
|
126
|
+
help='show this help message and exit'
|
|
127
|
+
)
|
|
128
|
+
parser.add_argument(
|
|
129
|
+
'-d', '--kmldir',
|
|
130
|
+
default='.',
|
|
131
|
+
dest='kmldir',
|
|
132
|
+
help='Google Earth kml directory. [Default %(default)s]',
|
|
133
|
+
)
|
|
134
|
+
parser.add_argument(
|
|
135
|
+
'-D',
|
|
136
|
+
'--debug',
|
|
137
|
+
default=0,
|
|
138
|
+
dest='debug',
|
|
139
|
+
help='Set level of debug. Must be integer. [Default %(default)s]',
|
|
140
|
+
type=int,
|
|
141
|
+
)
|
|
142
|
+
parser.add_argument(
|
|
143
|
+
'--device',
|
|
144
|
+
default='',
|
|
145
|
+
dest='device',
|
|
146
|
+
help='The device to connect. [Default %(default)s]',
|
|
147
|
+
)
|
|
148
|
+
parser.add_argument(
|
|
149
|
+
'--host',
|
|
150
|
+
default='localhost',
|
|
151
|
+
dest='host',
|
|
152
|
+
help='The host to connect. [Default %(default)s]',
|
|
153
|
+
)
|
|
154
|
+
parser.add_argument(
|
|
155
|
+
'-i', '--initialize',
|
|
156
|
+
action='store_true',
|
|
157
|
+
default=False,
|
|
158
|
+
dest='initialize',
|
|
159
|
+
help='Google Earth kml directory. [Default %(default)s]',
|
|
160
|
+
)
|
|
161
|
+
parser.add_argument(
|
|
162
|
+
'--port',
|
|
163
|
+
default=gps.GPSD_PORT,
|
|
164
|
+
dest='port',
|
|
165
|
+
help='The port to connect. [Default %(default)s]',
|
|
166
|
+
)
|
|
167
|
+
parser.add_argument(
|
|
168
|
+
'-V', '--version',
|
|
169
|
+
action='version',
|
|
170
|
+
help='Output version to stderr, then exit',
|
|
171
|
+
version="%(prog)s: Version " + gps_version + "\n",
|
|
172
|
+
)
|
|
173
|
+
parser.add_argument(
|
|
174
|
+
'target',
|
|
175
|
+
help='[host[:port[:device]]]',
|
|
176
|
+
nargs='?',
|
|
177
|
+
)
|
|
178
|
+
options = parser.parse_args()
|
|
179
|
+
|
|
180
|
+
# the options host, port, device are set by the defaults
|
|
181
|
+
if options.target:
|
|
182
|
+
# override host, port and device with target
|
|
183
|
+
arg = options.target.split(':')
|
|
184
|
+
len_arg = len(arg)
|
|
185
|
+
if 1 == len_arg:
|
|
186
|
+
(options.host,) = arg
|
|
187
|
+
elif 2 == len_arg:
|
|
188
|
+
(options.host, options.port) = arg
|
|
189
|
+
elif 3 == len_arg:
|
|
190
|
+
(options.host, options.port, options.device) = arg
|
|
191
|
+
else:
|
|
192
|
+
parser.print_help()
|
|
193
|
+
sys.exit(0)
|
|
194
|
+
|
|
195
|
+
if options.initialize:
|
|
196
|
+
with polyopen(os.path.join(options.kmldir,
|
|
197
|
+
'Open_in_Google_Earth_RT_GPS.kml'), 'w',
|
|
198
|
+
) as f:
|
|
199
|
+
f.write(KML_OPEN_IN_GE)
|
|
200
|
+
sys.exit(0)
|
|
201
|
+
|
|
202
|
+
try:
|
|
203
|
+
session = gps.gps(host=options.host, port=options.port,
|
|
204
|
+
verbose=options.debug)
|
|
205
|
+
except socket.error:
|
|
206
|
+
sys.stderr.write("gegps: Could not connect to gpsd daemon\n")
|
|
207
|
+
sys.exit(1)
|
|
208
|
+
|
|
209
|
+
session.stream(gps.WATCH_ENABLE)
|
|
210
|
+
|
|
211
|
+
try:
|
|
212
|
+
while 0 == session.read():
|
|
213
|
+
if not hasattr(session, "data"):
|
|
214
|
+
# no data yet
|
|
215
|
+
continue
|
|
216
|
+
|
|
217
|
+
if 'TPV' == session.data['class']:
|
|
218
|
+
with polyopen(os.path.join(options.kmldir,
|
|
219
|
+
'Realtime_GPS.kml'), 'w') as f:
|
|
220
|
+
f.write(kmlize(session.data))
|
|
221
|
+
except KeyboardInterrupt:
|
|
222
|
+
print('gegps stopped ')
|
|
223
|
+
|
|
224
|
+
# end
|
|
225
|
+
# vim: set expandtab shiftwidth=4
|