mirror of
https://github.com/ShaYmez/NXDNClients.git
synced 2024-11-26 00:58:37 -05:00
Merge pull request #97 from f1rmb/gps_read_api_version_checking
Take care if the gpsd API version with gps_read() as function prototype as changed in version 7.
This commit is contained in:
commit
70eaed0835
@ -228,8 +228,13 @@ void CAPRSWriter::sendIdFrameMobile()
|
|||||||
if (!::gps_waiting(&m_gpsdData, 0))
|
if (!::gps_waiting(&m_gpsdData, 0))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#if GPSD_API_MAJOR_VERSION >= 7
|
||||||
if (::gps_read(&m_gpsdData, NULL, 0) <= 0)
|
if (::gps_read(&m_gpsdData, NULL, 0) <= 0)
|
||||||
return;
|
return;
|
||||||
|
#else
|
||||||
|
if (::gps_read(&m_gpsdData) <= 0)
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (m_gpsdData.status != STATUS_FIX)
|
if (m_gpsdData.status != STATUS_FIX)
|
||||||
return;
|
return;
|
||||||
@ -244,7 +249,11 @@ void CAPRSWriter::sendIdFrameMobile()
|
|||||||
|
|
||||||
float rawLatitude = float(m_gpsdData.fix.latitude);
|
float rawLatitude = float(m_gpsdData.fix.latitude);
|
||||||
float rawLongitude = float(m_gpsdData.fix.longitude);
|
float rawLongitude = float(m_gpsdData.fix.longitude);
|
||||||
|
#if GPSD_API_MAJOR_VERSION >= 9
|
||||||
float rawAltitude = float(m_gpsdData.fix.altMSL);
|
float rawAltitude = float(m_gpsdData.fix.altMSL);
|
||||||
|
#else
|
||||||
|
float rawAltitude = float(m_gpsdData.fix.altitude);
|
||||||
|
#endif
|
||||||
float rawVelocity = float(m_gpsdData.fix.speed);
|
float rawVelocity = float(m_gpsdData.fix.speed);
|
||||||
float rawBearing = float(m_gpsdData.fix.track);
|
float rawBearing = float(m_gpsdData.fix.track);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user