2015-05-25 15:55:10 +00:00
/*!
2015-06-05 23:21:00 +00:00
* \ file gps_cnav_navigation_message . h
* \ brief Interface of a GPS CNAV Data message decoder
2015-05-25 15:55:10 +00:00
* \ author Javier Arribas , 2015. jarribas ( at ) cttc . es
*
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*
2018-05-13 20:49:11 +00:00
* Copyright ( C ) 2010 - 2018 ( see AUTHORS file for a list of contributors )
2015-05-25 15:55:10 +00:00
*
* GNSS - SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS - SDR .
*
* GNSS - SDR is free software : you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation , either version 3 of the License , or
* ( at your option ) any later version .
*
* GNSS - SDR is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
2018-05-13 20:49:11 +00:00
* along with GNSS - SDR . If not , see < https : //www.gnu.org/licenses/>.
2015-05-25 15:55:10 +00:00
*
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
2016-01-10 13:30:04 +00:00
# ifndef GNSS_SDR_GPS_CNAV_NAVIGATION_MESSAGE_H_
# define GNSS_SDR_GPS_CNAV_NAVIGATION_MESSAGE_H_
2015-05-25 15:55:10 +00:00
2018-02-26 02:15:53 +00:00
# include "GPS_CNAV.h"
# include "gps_cnav_ephemeris.h"
# include "gps_cnav_iono.h"
# include "gps_cnav_utc_model.h"
2015-05-25 15:55:10 +00:00
# include <bitset>
2018-08-10 18:34:03 +00:00
# include <cstdint>
2015-05-25 15:55:10 +00:00
# include <map>
# include <string>
# include <utility>
2018-12-09 21:00:09 +00:00
# include <vector>
2018-02-26 02:15:53 +00:00
2015-05-25 15:55:10 +00:00
//TODO: Create GPS CNAV almanac
//#include "gps_almanac.h"
/*!
2016-10-29 15:21:13 +00:00
* \ brief This class decodes a GPS CNAV Data message as described in IS - GPS - 200 H
2015-05-25 15:55:10 +00:00
*
2016-10-29 15:21:13 +00:00
* See http : //www.gps.gov/technical/icwg/IS-GPS-200H.pdf Appendix III
2015-05-25 15:55:10 +00:00
*/
class Gps_CNAV_Navigation_Message
{
public :
2019-07-01 21:44:42 +00:00
/*!
* Default constructor
*/
Gps_CNAV_Navigation_Message ( ) ;
2018-12-14 01:31:01 +00:00
int32_t d_TOW ;
2015-06-05 23:21:00 +00:00
bool b_flag_ephemeris_1 ;
bool b_flag_ephemeris_2 ;
2018-03-25 17:47:28 +00:00
bool b_flag_iono_valid ; //!< If set, it indicates that the ionospheric parameters are filled and are not yet read by the get_iono
bool b_flag_utc_valid ; //!< If set, it indicates that the utc parameters are filled and are not yet read by the get_utc_model
2015-05-25 15:55:10 +00:00
2018-08-13 23:13:07 +00:00
std : : map < int32_t , std : : string > satelliteBlock ; //!< Map that stores to which block the PRN belongs http://www.navcen.uscg.gov/?Do=constellationStatus
2015-05-25 15:55:10 +00:00
// satellite positions
2018-03-03 01:03:39 +00:00
double d_satpos_X ; //!< Earth-fixed coordinate x of the satellite [m]. Intersection of the IERS Reference Meridian (IRM) and the plane passing through the origin and normal to the Z-axis.
double d_satpos_Y ; //!< Earth-fixed coordinate y of the satellite [m]. Completes a right-handed, Earth-Centered, Earth-Fixed orthogonal coordinate system.
double d_satpos_Z ; //!< Earth-fixed coordinate z of the satellite [m]. The direction of the IERS (International Earth Rotation and Reference Systems Service) Reference Pole (IRP).
2015-05-25 15:55:10 +00:00
// satellite identification info
2018-08-13 23:13:07 +00:00
int32_t i_channel_ID ;
uint32_t i_satellite_PRN ;
2015-05-25 15:55:10 +00:00
// Satellite velocity
2018-03-03 01:03:39 +00:00
double d_satvel_X ; //!< Earth-fixed velocity coordinate x of the satellite [m]
double d_satvel_Y ; //!< Earth-fixed velocity coordinate y of the satellite [m]
double d_satvel_Z ; //!< Earth-fixed velocity coordinate z of the satellite [m]
2015-05-25 15:55:10 +00:00
// public functions
void reset ( ) ;
2017-12-11 11:17:01 +00:00
void decode_page ( std : : bitset < GPS_CNAV_DATA_PAGE_BITS > data_bits ) ;
2018-08-13 23:13:07 +00:00
2015-05-25 15:55:10 +00:00
/*!
* \ brief Obtain a GPS SV Ephemeris class filled with current SV data
*/
Gps_CNAV_Ephemeris get_ephemeris ( ) ;
2018-08-13 23:13:07 +00:00
2015-06-05 16:46:00 +00:00
/*!
2017-03-23 14:45:41 +00:00
* \ brief Check if we have a new iono record stored in the GPS ephemeris class
2015-06-05 16:46:00 +00:00
*/
bool have_new_iono ( ) ;
2018-08-13 23:13:07 +00:00
2015-05-25 15:55:10 +00:00
/*!
* \ brief Obtain a GPS ionospheric correction parameters class filled with current SV data
*/
Gps_CNAV_Iono get_iono ( ) ;
/*!
* \ brief Obtain a GPS UTC model parameters class filled with current SV data
*/
Gps_CNAV_Utc_Model get_utc_model ( ) ;
2015-06-05 16:46:00 +00:00
/*!
2017-03-23 14:45:41 +00:00
* \ briefCheck if we have a new GPS UTC model record stored in the GPS ephemeris class
*/
bool have_new_utc_model ( ) ;
/*!
* \ brief Check if we have a new ephemeris stored in the GPS ephemeris class
2015-06-05 16:46:00 +00:00
*/
bool have_new_ephemeris ( ) ;
2015-05-25 15:55:10 +00:00
2019-07-01 21:44:42 +00:00
private :
uint64_t read_navigation_unsigned ( std : : bitset < GPS_CNAV_DATA_PAGE_BITS > bits , const std : : vector < std : : pair < int32_t , int32_t > > & parameter ) ;
int64_t read_navigation_signed ( std : : bitset < GPS_CNAV_DATA_PAGE_BITS > bits , const std : : vector < std : : pair < int32_t , int32_t > > & parameter ) ;
bool read_navigation_bool ( std : : bitset < GPS_CNAV_DATA_PAGE_BITS > bits , const std : : vector < std : : pair < int32_t , int32_t > > & parameter ) ;
Gps_CNAV_Ephemeris ephemeris_record ;
Gps_CNAV_Iono iono_record ;
Gps_CNAV_Utc_Model utc_model_record ;
2015-05-25 15:55:10 +00:00
} ;
# endif