Package: gpsdshm
Overviewpython-gpsdshmprovides a read-only(!) Python interface togpsd’s shared memory. It provides
a single classShmthat exposes the fields of the shared memory structure as attributes. Thepython-gpsdshmAPI is (loosely) modelled on gpsd version 3.16 (API 6.1). gpsd releases earlier
than 3.0 are not supported.python-gpsdshmis implemented usingSwigand requires thegpsdheader files for compilation.Many Linux distributions ship the gpsd packagewithoutshared memory support.
SeeCompiling gpsd with shared memory supportfor details how to build gpsd
with shared memory support.ExampleThe example below shows all attributes and typical values (of a stationary GPS, placed about one metre inside a window).>>>importgpsdshm>>>gpsd_shm=gpsdshm.Shm()>>>gpsd_shm.setTODO:<SwigObjectoftype'gps_mask_t *'at0x133bf50>>>>gpsd_shm.online# True if GPS is onlinegpsd_shm.onlineTODO:Out[6]:1454057376.6934643>>>gpsd_shm.status# Do we have a fix (True/False)?gpsd_shm.statusTODOOut[7]:1>>>gpsd_shm.skyview_time# Skyview timestamp>>>gpsd_shm.satellites_visible# Number of satellites in viewTODO:nan>>>gpsd_shm.fix.time# Time of update1454057448.0>>>gpsd_shm.fix.mode# Mode of fix (0=not seen, 1=no fix, 2=2D, 3=3D)3>>>gpsd_shm.fix.ept# Expected time uncertainty0.005>>>gpsd_shm.fix.latitude# Latitude in degrees (valid if mode >= 2)-37.75859333333334>>>gpsd_shm.fix.epy# Latitude position uncertainty, meters14.853882022256698>>>gpsd_shm.fix.longitude# Longitude in degrees (valid if mode >= 2)144.99911>>>gpsd_shm.fix.epx# Longitude position uncertainty, meters10.040781879264545>>>gpsd_shm.fix.alitude# Altitude in meters (valid if mode == 3)68.2>>>gpsd_shm.fix.epv# Vertical position uncertainty, meters19.55>>>gpsd_shm.fix.track# Course made good (relative to true north)44.45>>>gpsd_shm.fix.epd# Track uncertainty, degreesnan>>>gpsd_shm.fix.speed# Speed over ground, meters/sec0.3446777748>>>gpsd_shm.fix.eps# Speed uncertainty, meters/sec29.707764044513397>>>gpsd_shm.fix.climb# Vertical speed, meters/sec0.0>>>gpsd_shm.fix.epc# Vertical speed uncertaintynan>>>gpsd_shm.dop.xdop0.6693854586176363>>>gpsd_shm.dop.ydop0.9902588014837799>>>gpsd_shm.dop.pdop1.17>>>gpsd_shm.dop.hdop0.99>>>gpsd_shm.dop.vdop0.82>>>gpsd_shm.dop.tdop1.2548625723457216>>>gpsd_shm.dop.gdop2.4342743978108503Information about satellites is contained in thesatelliteslist.>>>gpsd_shm.satellites[0].ss# Signal-to-noise ratio (dB)16.0>>>gpsd_shm.satellites[0].used# Used in solution?False>>>gpsd_shm.satellites[0].prn# PRNs of satellite6>>>gpsd_shm.satellites[0].elevation# Elevation of satellite, degrees56>>>gpsd_shm.satellites[0].azimuth# Azimuth, degrees59Compiling gpsd with shared memory support$gitclonegit://git.sv.gnu.org/gpsd.git# git clone http://git.savannah.gnu.org/r/gpsd.git$cdgpsd$gittag$gitcheckoutrelease-3.16$sconsprefix=/usr/localshm_export=yes$sudosconsinstallThen run start gpsd and check whether the shared segment has been created.$sudo/usr/local/sbin/gpsd-n/dev/ttyAMA0$ipcs-m|grep0x47505344------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status
0x47505344 163844     root       666        31616      1History0.1.0 (04-Feb-2016)Initial version