From 19b6cbbf653f3c19d19eaeb2a10bdcf37abca854 Mon Sep 17 00:00:00 2001 From: Daniel Caujolle-Bert Date: Wed, 24 Jun 2020 11:35:27 +0200 Subject: [PATCH 1/2] Take care if the gpsd API version with gps_read() as function prototype as changed in version 7. Fix the comment about enabling gpsd support. --- Common/APRSWriter.cpp | 5 +++++ Makefile | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Common/APRSWriter.cpp b/Common/APRSWriter.cpp index 3fab725..563468a 100644 --- a/Common/APRSWriter.cpp +++ b/Common/APRSWriter.cpp @@ -448,8 +448,13 @@ void CAPRSWriter::sendIdFramesMobile() if (!::gps_waiting(&m_gpsdData, 0)) return; +#if GPSD_API_MAJOR_VERSION >= 7 if (::gps_read(&m_gpsdData, NULL, 0) <= 0) return; +#else + if (::gps_read(&m_gpsdData) <= 0) + return; +#endif if (m_gpsdData.status != STATUS_FIX) return; diff --git a/Makefile b/Makefile index b3d02ec..067f0b1 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ endif # Add -DDCS_LINK to the end of the CFLAGS line below to add DCS linking to StarNet # Add -DDEXTRA_LINK to the end of the CFLAGS line below to add DExtra linking to StarNet -# Add -DUSE_GPS to the end of the CFLAGS line to enable the use of gpsd, and add -lgps to +# Add -DUSE_GPSD to the end of the CFLAGS line to enable the use of gpsd, and add -lgps to # end of the LIBS line. DEBUGFLAGS := -g -D_DEBUG From 0c7eef460d36592666f2dc24def973dbc4c996c6 Mon Sep 17 00:00:00 2001 From: Daniel Caujolle-Bert Date: Wed, 24 Jun 2020 12:04:32 +0200 Subject: [PATCH 2/2] altMSL appeared in API 9. --- Common/APRSWriter.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Common/APRSWriter.cpp b/Common/APRSWriter.cpp index 563468a..e109335 100644 --- a/Common/APRSWriter.cpp +++ b/Common/APRSWriter.cpp @@ -469,7 +469,11 @@ void CAPRSWriter::sendIdFramesMobile() float rawLatitude = float(m_gpsdData.fix.latitude); float rawLongitude = float(m_gpsdData.fix.longitude); +#if GPSD_API_MAJOR_VERSION >= 9 float rawAltitude = float(m_gpsdData.fix.altMSL); +#else + float rawAltitude = float(m_gpsdData.fix.altitude); +#endif float rawVelocity = float(m_gpsdData.fix.speed); float rawBearing = float(m_gpsdData.fix.track);