From 3a959a6a44083d5ac9258c05308da106dcf34265 Mon Sep 17 00:00:00 2001 From: PepMS <jmarti@iri.upc.edu> Date: Thu, 20 Jun 2019 12:26:59 +0200 Subject: [PATCH] Receiver: Navigation and Observation attributes --- include/gnss_utils.h | 36 ++++++++++-------------------- src/gnss_utils.cpp | 52 ++++++++++---------------------------------- 2 files changed, 22 insertions(+), 66 deletions(-) diff --git a/include/gnss_utils.h b/include/gnss_utils.h index 805187b..80c4757 100644 --- a/include/gnss_utils.h +++ b/include/gnss_utils.h @@ -4,6 +4,8 @@ #include <vector> #include <iostream> #include <memory> +#include "observations.h" +#include "navigation.h" extern "C" { @@ -15,32 +17,16 @@ namespace GNSSUtils class Receiver { public: + // Public objects + // Constructor & Destructor Receiver(); ~Receiver(); - // Public objects // Public methods - - - /* - Observations - */ - - void clearObservations(); - - void pushObservation(obsd_t obs); - - std::vector<obsd_t> getObservations(); - - - /* - Navigation - */ - - void clearNavigation(); - - void setNavigation(nav_t nav); - - nav_t getNavigation(); - + const std::shared_ptr<GNSSUtils::Observations> getObs(); + const std::shared_ptr<GNSSUtils::Navigation> getNav(); /* - Processing Options - */ @@ -73,13 +59,13 @@ namespace GNSSUtils int computeSPP(double *azel, char *msg); - private: + protected: // Private objects - // rtklib-like attribute to represent the different observation msgs for a given epoch - std::vector<obsd_t> _obsVector; + // GNSSUtils::Observation attribute to represent the different observation msgs for a given epoch + std::shared_ptr<GNSSUtils::Observations> obs_ptr_; - // rtklib-like attribute to represent the different navigation msgs for a given epoch - nav_t _nav; + // GNSSUtils::Navigation attribute to represent the different navigation msgs for a given epoch + std::shared_ptr<GNSSUtils::Navigation> nav_ptr_; // rtklib-like attribute to represent the different options for a given epoch prcopt_t _opt; diff --git a/src/gnss_utils.cpp b/src/gnss_utils.cpp index eea7b3b..dfc94b6 100644 --- a/src/gnss_utils.cpp +++ b/src/gnss_utils.cpp @@ -6,7 +6,8 @@ using namespace GNSSUtils; Receiver::Receiver() { - + obs_ptr_ = std::make_shared<GNSSUtils::Observations>(); + nav_ptr_ = std::make_shared<GNSSUtils::Navigation>(); } Receiver::~Receiver() @@ -14,43 +15,16 @@ Receiver::~Receiver() } - -/* - Observation - */ - -void Receiver::clearObservations() -{ - _obsVector.clear(); -} - -void Receiver::pushObservation(obsd_t obs) -{ - _obsVector.push_back(obs); -} - -std::vector<obsd_t> Receiver::getObservations() -{ - return this->_obsVector; -} - - -/* - Navigation - */ - -void Receiver::clearNavigation() -{ - //_nav = NULL; -} - -void Receiver::setNavigation(nav_t nav) +const std::shared_ptr<GNSSUtils::Observations> Receiver::getObs() { - _nav = nav; + return obs_ptr_; } -nav_t Receiver::getNavigation() +const std::shared_ptr<GNSSUtils::Navigation> Receiver::getNav() { - return this->_nav; + return nav_ptr_; } - /* - Processing options - */ void Receiver::clearOptions() @@ -109,20 +83,16 @@ ssat_t Receiver::getSatStatus() int Receiver::computeSPP(double *azel, char *msg) { +/* const obsd_t *obs = &this->_obsVector[0]; int n = this->_obsVector.size(); - /* + const nav_t *nav = this->_nav; const prcopt_t *opt = this->_opt; sol_t *sol = this->_sol; ssat_t *ssat = this->_ssat; */ - - return pntpos(obs, n, &_nav, &_opt, &_sol, azel, &_ssat, msg); -} - - - - - + // return pntpos(obs, n, &_nav, &_opt, &_sol, azel, &_ssat, msg); + return 0; +} -- GitLab