You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ad...@apache.org on 2021/03/29 09:45:13 UTC

[nifi-minifi-cpp] branch main updated: MINIFICPP-1493: Fixing incompatibility with gpsd versions >= 3.21

This is an automated email from the ASF dual-hosted git repository.

adebreceni pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git


The following commit(s) were added to refs/heads/main by this push:
     new bf79868  MINIFICPP-1493: Fixing incompatibility with gpsd versions >= 3.21
bf79868 is described below

commit bf79868c3af362a3052798b0dec9e273105aee15
Author: Martin Zink <ma...@protonmail.com>
AuthorDate: Mon Mar 29 11:43:32 2021 +0200

    MINIFICPP-1493: Fixing incompatibility with gpsd versions >= 3.21
    
    Signed-off-by: Adam Debreceni <ad...@apache.org>
    
    This closes #1033
---
 extensions/gps/GetGPS.cpp | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/extensions/gps/GetGPS.cpp b/extensions/gps/GetGPS.cpp
index 9c3dc98..a187495 100644
--- a/extensions/gps/GetGPS.cpp
+++ b/extensions/gps/GetGPS.cpp
@@ -86,6 +86,14 @@ void GetGPS::onSchedule(const std::shared_ptr<core::ProcessContext> &context, co
   logger_->log_trace("GPSD client scheduled");
 }
 
+int get_gps_status(struct gps_data_t* gps_data) {
+#if defined(GPSD_API_MAJOR_VERSION) && GPSD_API_MAJOR_VERSION >= 10
+  return gps_data->fix.status;
+#else
+  return gps_data->status;
+#endif
+}
+
 void GetGPS::onTrigger(const std::shared_ptr<core::ProcessContext>& /*context*/, const std::shared_ptr<core::ProcessSession> &session) {
   try {
     gpsmm gps_rec(gpsdHost_.c_str(), gpsdPort_.c_str());
@@ -106,7 +114,7 @@ void GetGPS::onTrigger(const std::shared_ptr<core::ProcessContext>& /*context*/,
         return;
       } else {
 
-        if (gpsdata->status > 0) {
+        if (get_gps_status(gpsdata) > 0) {
 
           if (gpsdata->fix.longitude != gpsdata->fix.longitude || gpsdata->fix.altitude != gpsdata->fix.altitude) {
             logger_->log_info("No GPS fix.");