From ac905e828cd87c74206822595a30884d38af03d5 Mon Sep 17 00:00:00 2001 From: Eraru Date: Wed, 20 Jan 2016 18:48:11 +0100 Subject: [PATCH 1/2] Added FIX/NO FIX logs (#66) --- gps/GPS.cc | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/gps/GPS.cc b/gps/GPS.cc index 3d14fc7..299430e 100644 --- a/gps/GPS.cc +++ b/gps/GPS.cc @@ -228,7 +228,18 @@ void GPS::parse_GGA(const string& frame) while(getline(ss, data, ',')) s_data.push_back(data); // Is the data valid? - this->active = s_data[6] > "0"; + bool active = s_data[6] > "0"; + + if (this->active && ! active) + { + this->logger->log("Fix lost."); + this->active = false; + } + else if ( ! this->active && active) + { + this->logger->log("Fix acquired."); + this->active = true; + } if (this->active) { @@ -264,7 +275,18 @@ void GPS::parse_GSA(const string& frame) while(getline(ss, data, ',')) s_data.push_back(data); // Is the data valid? - this->active = s_data[2] != "1"; + bool active = s_data[2] != "1"; + + if (this->active && ! active) + { + this->logger->log("Fix lost."); + this->active = false; + } + else if ( ! this->active && active) + { + this->logger->log("Fix acquired."); + this->active = true; + } if (this->active) { @@ -285,7 +307,18 @@ void GPS::parse_RMC(const string& frame) while(getline(ss, data, ',')) s_data.push_back(data); // Is the data valid? - this->active = s_data[2] == "A"; + bool active = s_data[2] == "A"; + + if (this->active && ! active) + { + this->logger->log("Fix lost."); + this->active = false; + } + else if ( ! this->active && active) + { + this->logger->log("Fix acquired"); + this->active = true; + } if (this->active) { From 1ef4ea15396ea2d6183807f788e506f2820cc6eb Mon Sep 17 00:00:00 2001 From: Eraru Date: Wed, 20 Jan 2016 18:58:49 +0100 Subject: [PATCH 2/2] Changed spaces for tabs --- gps/GPS.cc | 62 +++++++++++++++++++++++++++--------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/gps/GPS.cc b/gps/GPS.cc index 299430e..6264d1d 100644 --- a/gps/GPS.cc +++ b/gps/GPS.cc @@ -230,16 +230,16 @@ void GPS::parse_GGA(const string& frame) // Is the data valid? bool active = s_data[6] > "0"; - if (this->active && ! active) - { - this->logger->log("Fix lost."); - this->active = false; - } - else if ( ! this->active && active) - { - this->logger->log("Fix acquired."); - this->active = true; - } + if (this->active && ! active) + { + this->logger->log("Fix lost."); + this->active = false; + } + else if ( ! this->active && active) + { + this->logger->log("Fix acquired."); + this->active = true; + } if (this->active) { @@ -277,16 +277,16 @@ void GPS::parse_GSA(const string& frame) // Is the data valid? bool active = s_data[2] != "1"; - if (this->active && ! active) - { - this->logger->log("Fix lost."); - this->active = false; - } - else if ( ! this->active && active) - { - this->logger->log("Fix acquired."); - this->active = true; - } + if (this->active && ! active) + { + this->logger->log("Fix lost."); + this->active = false; + } + else if ( ! this->active && active) + { + this->logger->log("Fix acquired."); + this->active = true; + } if (this->active) { @@ -308,17 +308,17 @@ void GPS::parse_RMC(const string& frame) // Is the data valid? bool active = s_data[2] == "A"; - - if (this->active && ! active) - { - this->logger->log("Fix lost."); - this->active = false; - } - else if ( ! this->active && active) - { - this->logger->log("Fix acquired"); - this->active = true; - } + + if (this->active && ! active) + { + this->logger->log("Fix lost."); + this->active = false; + } + else if ( ! this->active && active) + { + this->logger->log("Fix acquired"); + this->active = true; + } if (this->active) {