GNSS_RxData.h

Go to the documentation of this file.
00001 /**
00002 \file    GNSS_RxData.h
00003 \brief   The header file for the GNSS_RxData class.
00004 
00005 \author  Glenn D. MacGougan (GDM)
00006 \date    2007-11-29
00007 \since   2006-11-13
00008 
00009 \b "LICENSE INFORMATION" \n
00010 Copyright (c) 2007, refer to 'author' doxygen tags \n
00011 All rights reserved. \n
00012 
00013 Redistribution and use in source and binary forms, with or without
00014 modification, are permitted provided the following conditions are met: \n
00015 
00016 - Redistributions of source code must retain the above copyright
00017   notice, this list of conditions and the following disclaimer. \n
00018 - Redistributions in binary form must reproduce the above copyright
00019   notice, this list of conditions and the following disclaimer in the
00020   documentation and/or other materials provided with the distribution. \n
00021 - The name(s) of the contributor(s) may not be used to endorse or promote 
00022   products derived from this software without specific prior written 
00023   permission. \n
00024 
00025 THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS 
00026 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
00027 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00028 DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
00029 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00030 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
00031 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
00032 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
00033 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 
00034 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 
00035 SUCH DAMAGE.
00036 */
00037 
00038 #ifndef _GNSS_RXDATA_H_
00039 #define _GNSS_RXDATA_H_
00040 
00041 #include <stdio.h>
00042 #include <string>
00043 #include "gnss_types.h"
00044 #include "gps.h"
00045 #include "rinex.h"
00046 
00047 
00048 /// This is the fixed number of channels contained in the array 
00049 /// for one GNSS_RxData object.
00050 #define GNSS_RXDATA_NR_CHANNELS (48)
00051 
00052 /// This is the buffer length (in bytes) for a data message buffer used
00053 /// by the receiver object in decoding data.
00054 #define GNSS_RXDATA_MSG_LENGTH  (16384)
00055 
00056 
00057 namespace GNSS
00058 {
00059   //============================================================================
00060   /// \class   GPS_BroadcastEphemerisAndAlmanacArray
00061   /// \brief   An array class for storing broadcast GPS ephemeris and almanac 
00062   ///          information.
00063   ///
00064   /// Each satellite is uniquely identified in GPS by it's PRN. Each PRN has
00065   /// an associated almanac structure, a most recent ephemeris structure,
00066   /// and a previous ephemeris structure (to faciliate ephemeris matching)
00067   /// 
00068   /// GPS         are  1-32    \n
00069   /// Pseudolites are  33-37   \n
00070   /// SBAS        are  120-138 \n
00071   /// WAAS, EGNOS, MSAS        \n
00072   ///
00073   /// WAAS: \n
00074   /// AOR-W       122 \n
00075   /// Anik        138 \n
00076   /// POR         134 \n
00077   /// PanAm       135 \n
00078   ///
00079   /// EGNOS: \n
00080   /// AOR-E       120 \n
00081   /// Artemis     124 \n
00082   /// IOR-W       126 \n
00083   /// IOR-E       131 \n
00084   ///
00085   /// MSAS: \n
00086   /// MTSAT-1     129 \n
00087   /// MTSAT-2     137 \n
00088   ///
00089   /// The index mapping is as follows:                      \n
00090   /// PRN 1-37    maps to indidex 0-36                      \n
00091   /// PRN 38-40   maps to indices 37-39 (reserved mappings) \n
00092   /// PRN 120-138 maps to indicex 40-58                     \n
00093   ///
00094   /// \author  Glenn D. MacGougan (GDM)
00095   /// \date    2007-10-29
00096   /// \since   2006-11-15
00097   ///
00098   class GPS_BroadcastEphemerisAndAlmanacArray
00099   {
00100   public:
00101 
00102     /// \brief    The default constructor (no data allocated yet).
00103     GPS_BroadcastEphemerisAndAlmanacArray();
00104 
00105     /// \brief    The destructor.
00106     virtual ~GPS_BroadcastEphemerisAndAlmanacArray();
00107 
00108     /// \brief    Add an ephemeris structure.
00109     /// \return   true if successful, false if error.
00110     bool AddEphemeris( const unsigned short prn, const GPS_structEphemeris &eph );
00111 
00112     /// \brief    Add an almanac structure.
00113     /// \return   true if successful, false if error.
00114     bool AddAlmanac( const unsigned short prn, const GPS_structAlmanac &alm );
00115 
00116 
00117     /// \brief    Check if ephemeris information is available for a PRN.
00118     /// \return   true if successful, false if error.    
00119     bool IsEphemerisAvailable( 
00120       const unsigned short prn, //!< The desired GPS PRN. (1-32 GPS, 120-138 SBAS).
00121       bool &isAvailable,        //!< This boolean indicates if ephemeris data is available or not.
00122       char iode = -1            //!< The issue of data for the ephemeris, -1 means get the most current.
00123       );
00124 
00125     /// \brief    Try to get the most current ephemeris or the ephemeris 
00126     ///           with the issue of data (ephemeris), iode, specified. 
00127     /// \remarks  (1) iode == -1, means retrieve the most current ephemeris. \n
00128     ///           (2) 
00129     /// \return   true if successful, false if error.
00130     bool GetEphemeris( 
00131       const unsigned short prn, //!< The desired GPS PRN. (1-32 GPS, 120-138 SBAS).
00132       GPS_structEphemeris &eph, //!< A reference to an ephemeris struct in which to store the data.
00133       bool &isAvailable,        //!< This boolean indicates if ephemeris data is available or not.
00134       char iode = -1            //!< The issue of data for the ephemeris, -1 means get the most current.
00135       );
00136 
00137     /**
00138     \brief    Try to get the week, and time of week of the most current ephemeris 
00139               for the prn specified if available.
00140     \author   Glenn D. MacGougan
00141     \date     2007-12-07
00142     \return   true if successful, false if error.
00143     */
00144     bool GetEphemerisTOW( 
00145       const unsigned short prn, //!< The desired GPS PRN. (1-32 GPS, 120-138 SBAS).
00146       bool &isAvailable,        //!< This boolean indicates if ephemeris data is available or not.
00147       unsigned short &week,     //!< The correct week corresponding to the time of week based on the Z-count in the Hand Over Word.
00148       unsigned &tow             //!< The time of week based on the Z-count in the Hand Over Word.
00149       );
00150 
00151   private:
00152     /// \brief   The copy constructor. Disabled!
00153     GPS_BroadcastEphemerisAndAlmanacArray( const GPS_BroadcastEphemerisAndAlmanacArray& rhs );
00154 
00155     /// \brief   The assignment operator. Disabled!
00156     void operator=(const GPS_BroadcastEphemerisAndAlmanacArray& rhs)
00157     {}
00158 
00159   protected:
00160 
00161     /// \brief   Allocate the array.
00162     /// \return  true if successful, false if error.
00163     bool AllocateArray();
00164 
00165     /// \brief   Get the index of the PRN in the array.
00166     /// \return  true if successful, false if error (e.g. unsupported PRN).
00167     bool GetIndexGivenPRN( const unsigned short prn, unsigned short &index );
00168 
00169   protected:
00170 
00171     struct GPS_structOrbitParameters
00172     {
00173       unsigned short prn;
00174       GPS_structEphemeris currentEph;
00175       GPS_structEphemeris previousEph;
00176       GPS_structAlmanac   almanac;
00177     };
00178 
00179     /// A pointer to the array of GPS satellite orbit information structs.
00180     GPS_structOrbitParameters* m_array; 
00181 
00182     /// The maximum number of elements in m_array.
00183     unsigned m_arrayLength;
00184   };
00185 
00186 
00187 #ifdef ASDFASDF
00188 
00189   /**
00190   \class   GPS_AmbiguitiesArray
00191   \brief   An array class for storing GPS amibiguity information.
00192   Each satellite is uniquely identified in GPS by it's PRN. This
00193   PRN is used to map to an index internal to the GPS_AmbiguitiesArray.
00194   L1 and L2 are supported for now.
00195 
00196   GPS         are  1-32    \n
00197   Pseudolites are  33-37   \n
00198   SBAS        are  120-138 \n
00199   WAAS, EGNOS, MSAS        \n
00200 
00201   WAAS: \n
00202   AOR-W       122 \n
00203   Anik        138 \n
00204   POR         134 \n
00205   PanAm       135 \n
00206 
00207   EGNOS: \n
00208   AOR-E       120 \n
00209   Artemis     124 \n
00210   IOR-W       126 \n
00211   IOR-E       131 \n
00212 
00213   MSAS: \n
00214   MTSAT-1     129 \n
00215   MTSAT-2     137 \n
00216 
00217   The index mapping is as follows:                      \n
00218   PRN 1-37    maps to indidex 0-36                      \n
00219   PRN 38-40   maps to indices 37-39 (reserved mappings) \n
00220   PRN 120-138 maps to indicex 40-58                     \n
00221 
00222   \author  Glenn D. MacGougan (GDM)
00223   \date    2007-10-29
00224   \since   2006-11-15
00225   */
00226   class GPS_AmbiguitiesArray
00227   {
00228   public:
00229 
00230     /// \brief    The default constructor (no data allocated yet).
00231     GPS_AmbiguitiesArray();
00232 
00233     /// \brief    The destructor.
00234     virtual ~GPS_AmbiguitiesArray();
00235 
00236     /**
00237     \brief    Add a GPS ambiguity.
00238     \author   Glenn D. MacGougan
00239     \remarks  - There cannot be more than one channel associated with a PRN.
00240     \return   true if successful, false if error.
00241     */
00242     bool AddAmbiguity( 
00243       const unsigned short channel,       //!< The receiver channel. Useful for real receiver data. Not useful for RINEX data. 
00244       const unsigned short prn,           //!< The desired GPS PRN. (1-32 GPS, 120-138 SBAS).
00245       const GNSS_enumFrequency freqType,  //!< The frequency type for this channel.
00246       const double ambiguity,             //!< The float ambiguity value [m].
00247       const short state_index             //!< The associated index of the rows and columns of, P, the variance-covariance matrix of the estimated parameters. -1 means no estimated.
00248       );
00249 
00250     /// \brief    Check if this PRN/frequency's ambiguity is actively estimated. i.e. It has a valid state index.
00251     /// \return   true if successful, false if error.    
00252     bool IsAmbiguityActive( 
00253       const unsigned short prn, //!< The GPS PRN. (1-32 GPS, 120-138 SBAS).
00254       const GNSS_enumFrequency freqType,  //!< The frequency type for this channel.
00255       bool &isActive            //!< This boolean indicates if the ambiguity is being actively estimated.
00256       );
00257 
00258     /**
00259     \brief    Update the GPS ambiguity array for a single ambiguity.
00260     \author   Glenn D. MacGougan
00261     \remarks  - There cannot be more than one channel associated with a PRN.
00262     \return   true if successful, false if error.
00263     */
00264     bool UpdateAmbiguity( 
00265       const unsigned short channel,       //!< The receiver channel. Useful for real receiver data. Not useful for RINEX data. 
00266       const unsigned short prn,           //!< The desired GPS PRN. (1-32 GPS, 120-138 SBAS).
00267       const GNSS_enumFrequency freqType,  //!< The frequency type for this channel.
00268       const double ambiguity,             //!< The float ambiguity value [m].
00269       const unsigned short state_index    //!< The associated index of the rows and columns of, P, the variance-covariance matrix of the estimated parameters. -1 means no estimated.
00270       );
00271 
00272     /**
00273     \brief    Get the state index associated with this PRN/frequency.
00274     \author   Glenn D. MacGougan
00275     \return   true if successful, false if error.
00276     */   
00277     bool GetStateIndex(
00278       const unsigned short prn,           //!< The desired GPS PRN. (1-32 GPS, 120-138 SBAS).
00279       const GNSS_enumFrequency freqType,  //!< The frequency type for this channel.
00280       unsigned short &state_index         //!< The associated index of the rows and columns of, P, the variance-covariance matrix of the estimated parameters. -1 means no estimated.
00281       );
00282 
00283     /**
00284     \brief    Get the float ambiguity value associated with this PRN/frequency.
00285     \author   Glenn D. MacGougan
00286     \return   true if successful, false if error.
00287     */       
00288     bool GetFloatAmbiguityeValue(
00289       const unsigned short prn,           //!< The desired GPS PRN. (1-32 GPS, 120-138 SBAS).
00290       const GNSS_enumFrequency freqType,  //!< The frequency type for this channel.
00291       double &ambiguity                   //!< The float ambiguity value [m].
00292       );
00293       
00294 
00295   private:
00296     /// \brief   The copy constructor. Disabled!
00297     GPS_AmbiguitiesArray( const GPS_AmbiguitiesArray& rhs );
00298 
00299     /// \brief   The assignment operator. Disabled!
00300     void operator=(const GPS_AmbiguitiesArray& rhs)
00301     {}
00302 
00303   protected:
00304 
00305     /// \brief   Allocate the array.
00306     /// \return  true if successful, false if error.
00307     bool AllocateArray();
00308 
00309     /// \brief   Get the index of the PRN in the array.
00310     /// \return  true if successful, false if error (e.g. unsupported PRN).
00311     bool GetIndexGivenPRN( const unsigned short prn, unsigned short &index );
00312 
00313   protected:
00314 
00315     struct stAmbiguityInfo
00316     {
00317       unsigned short      channel;          //!< The receiver channel number associated with this measurement.
00318       unsigned short      prn;              //!< The GPS PRN. (1-32 GPS, 120-138 SBAS).
00319       short               state_index;      //!< The index of the corresponding row and column of the state variance-covariance matrix. -1 means no estimated.
00320       GNSS_enumFrequency  freqType;         //!< The frequency type for this channel.
00321       double              ambiguity;        //!< The float ambiguity value [m].
00322       int                 fixed_ambiguity;  //!< The fixed ambiguity value [cycles].
00323     // GDM most recent ambiguity estimate
00324     // GDM time of last above
00325     // GDM flag indicating amb reset
00326     // GDM quality indicator?
00327     };    
00328 
00329     struct stFullAmbiguityInfo
00330     {
00331       stAmbiguityInfo L1;
00332       stAmbiguityInfo L2;
00333       // add L5 when ready
00334     };
00335 
00336     /// A pointer to the array of GPS stFullAmbiguityInfo.
00337     stFullAmbiguityInfo* m_array; 
00338 
00339     /// The maximum number of elements in m_array.
00340     unsigned m_arrayLength;
00341   };
00342 
00343 
00344 #endif
00345 
00346 
00347   //============================================================================
00348   /// \class   GNSS_RxData
00349   /// \brief   A class for handling GNSS information for ONE EPOCH for ONE
00350   ///          RECEIVER such as pseudorange, ADR, and Doppler measurements, 
00351   ///          user position, user velocity, and other associated information.
00352   ///          The previous epoch of data is also retained if available.
00353   /// 
00354   /// The 'measurement' data is public and can be accessed directly by the user! 
00355   /// This is struct style encapsulation and to allow easy access to the data but
00356   /// the user must be careful (especially with the observation array in to 
00357   /// avoiding out of bound array access).
00358   ///
00359   /// \author  Glenn D. MacGougan (GDM)
00360   /// \date    2007-10-29  
00361   /// \since   2006-11-13
00362   /// 
00363   class GNSS_RxData
00364   { 
00365   public: 
00366 
00367     /// \brief    The default constructor (no data allocated yet).
00368     GNSS_RxData();                                             
00369 
00370     /// \brief    The destructor.
00371     virtual ~GNSS_RxData();
00372 
00373   private:
00374 
00375     /// \brief   The copy constructor. Disabled!
00376     GNSS_RxData( const GNSS_RxData& rhs );
00377 
00378     /// \brief   The assignment operator. Disabled!
00379     GNSS_RxData& operator=(const GNSS_RxData& rhs)
00380     { return *this; }
00381 
00382   public: 
00383 
00384     /// \brief   Set all data in the measurement array to zero.
00385     /// \return  true if successful, false if error.    
00386     bool ZeroAllMeasurements();
00387 
00388 
00389     /// \brief   Set all PVT data to zero.
00390     /// \return  true if successful, false if error.        
00391     bool ZeroPVT();
00392 
00393 
00394     /// \brief   Set the initial receiver position, velocity, and time.
00395     /// \return  true if successful, false if error.        
00396     bool SetInitialPVT( 
00397       const double latitudeRads,   //!< The latitude [rad].
00398       const double longitudeRads,  //!< The longitude [rad].
00399       const double height,         //!< The orthometric height [m].
00400       const double vn,             //!< The northing velocity [m/s].
00401       const double ve,             //!< The easting velocity [m/s].
00402       const double vup,            //!< The up velocity [m/s].
00403       const double clk,            //!< The clock offset [m].
00404       const double clkdrift,       //!< The clock drift [m/s].
00405       const double std_lat,        //!< The standard deviation uncertainty in the latitude [m].
00406       const double std_lon,        //!< The standard deviation uncertainty in the longitude [m].
00407       const double std_hgt,        //!< The standard deviation uncertainty in the height [m].
00408       const double std_vn,         //!< The standard deviation uncertainty in the northing velocity [m/s].
00409       const double std_ve,         //!< The standard deviation uncertainty in the easting velocity [m/s].
00410       const double std_vup,        //!< The standard deviation uncertainty in the up velocity [m/s].
00411       const double std_clk,        //!< The standard deviation uncertainty in the clock offset [m].
00412       const double std_clkdrift,   //!< The standard deviation uncertainty in the clock drift [m/s].
00413       const double undulation = 0  //!< The undulation if known [m].
00414       );
00415 
00416     /// \brief   Update the receiver position and clock offset.
00417     /// \return  true if successful, false if error.            
00418     bool UpdatePositionAndRxClock( 
00419       const double latitudeRads,   //!< The latitude [rad].
00420       const double longitudeRads,  //!< The longitude [rad].
00421       const double height,         //!< The orthometric height [m].
00422       const double clk,            //!< The clock offset [m].
00423       const double std_lat,        //!< The standard deviation uncertainty in the latitude [m].
00424       const double std_lon,        //!< The standard deviation uncertainty in the longitude [m].
00425       const double std_hgt,        //!< The standard deviation uncertainty in the height [m].
00426       const double std_clk         //!< The standard deviation uncertainty in the clock offset [m].
00427       );
00428 
00429     /// \brief   Update the receiver velocity and clock drift.
00430     /// \return  true if successful, false if error.                
00431     bool UpdateVelocityAndClockDrift( 
00432       const double vn,             //!< The northing velocity [m/s].
00433       const double ve,             //!< The easting velocity [m/s].
00434       const double vup,            //!< The up velocity [m/s].
00435       const double clkdrift,       //!< The clock drift [m/s].
00436       const double std_vn,         //!< The standard deviation uncertainty in the northing velocity [m/s].
00437       const double std_ve,         //!< The standard deviation uncertainty in the easting velocity [m/s].
00438       const double std_vup,        //!< The standard deviation uncertainty in the up velocity [m/s].
00439       const double std_clkdrift    //!< The standard deviation uncertainty in the clock drift [m/s].
00440       );
00441 
00442 
00443   
00444     /// \brief  Get degrees, minutes, seconds from a decimal degrees angle.
00445     /// \return  true if successful, false if error.        
00446     static bool GetDMS( 
00447       const double angleDegs,  //!< The angle [degrees].
00448       short &degrees,          //!< The degrees part.
00449       short &minutes,          //!< The minutes part.
00450       float &seconds,          //!< The seconds part.
00451       char *dms_str,           //!< A DMS string e.g. dms_str = "-180'59'59.9999\""
00452       const unsigned maxLength_dms_str //!< The maximum length of the dms_str string.
00453       );
00454   
00455 
00456 
00457 
00458     /**
00459     \brief   Initialize the receiver data object with data path information.
00460     \author  Glenn D. MacGougan
00461     \date    2007-12-07
00462     \return  true if successful, false if error.    
00463     */
00464     bool Initialize( 
00465       const char* path,                  //!< The path to the Observation data file. 
00466       bool &isValidPath,                 //!< A boolean to indicate if the path is valid.
00467       const GNSS_enumRxDataType rxType,  //!< The receiver data type.
00468       const char* RINEX_ephemeris_path   //!< The path to a RINEX ephemeris file, NULL if not available.
00469       );
00470 
00471 
00472     /// \brief   Load the next epoch of data.
00473     /// \return  true if successful, false if error.
00474     /// \param   endOfStream - indicates if the end of the input source 
00475     ///          was reached and no further data is available.
00476     bool LoadNext( bool &endOfStream );
00477 
00478 
00479     /// \brief   Load the next epoch of data of GNSS_RXDATA_NOVATELOEM4 data.
00480     /// \return  true if successful, false if error.
00481     /// \param   endOfStream - indicates if the end of the input source 
00482     ///          was reached and no further data is available.    
00483     bool LoadNext_NOVATELOEM4( bool &endOfStream );
00484 
00485 
00486     /// \brief   Load the next epoch of data of GNSS_RXDATA_RINEX21 data.
00487     /// \return  true if successful, false if error.
00488     /// \param   endOfStream - indicates if the end of the input source 
00489     ///          was reached and no further data is available.    
00490     bool LoadNext_RINEX21( bool &endOfStream );
00491 
00492 
00493     /// \brief   Load the next epoch of data of GNSS_RXDATA_RINEX211 data.
00494     /// \return  true if successful, false if error.
00495     /// \param   endOfStream - indicates if the end of the input source 
00496     ///          was reached and no further data is available.    
00497     bool LoadNext_RINEX211( bool &endOfStream );
00498 
00499 
00500     /**
00501     \brief   Check the header on the RINEX Observation file to confirm it
00502              has the correct version and the file type is Observation.
00503     \author  Glenn D. MacGougan
00504     \date    2007-12-07
00505     \param   filepath - The C string path to the observation file.
00506     \param   isValid - A boolean indicating if the file is valid for use.
00507     \return  true if successful, false if error.
00508     */
00509     bool CheckRINEXObservationHeader( const char *filepath, bool &isValid );
00510 
00511     /**
00512     \brief   If a RINEX GPS Navigation file is associated with this receiver,
00513              load all the ephemeris records into the member array.
00514     \author  Glenn D. MacGougan
00515     \date    2007-12-07
00516     \return  true if successful, false if error.
00517     */
00518     bool LoadRINEXNavigationData(void);
00519 
00520     /**
00521     \brief   If a RINEX GPS Navigation file is associated with this receiver,
00522              Load m_EphAlmArray appropriately based on the current receiver time.
00523     \author  Glenn D. MacGougan
00524     \date    2007-12-07
00525     \return  true if successful, false if error.
00526     */
00527     bool UpdateTheEphemerisArrayWithUsingRINEX();
00528 
00529     /// \brief  Check for cycle slips using the phase rate prediction method.
00530     ///
00531     /// \post   m_ObsArray[i].flags.isNoCycleSlipDetected is set for each observation.
00532     ///
00533     /// \return true if successful, false if error.
00534     bool CheckForCycleSlips_UsingPhaseRatePrediction( 
00535       const double nrThresholdCycles //!< The maximum number of cycles to use as the threshold to detect a slip [cycles].
00536       );
00537 
00538 
00539     /// \brief  A debugging function for printing all of the observation array
00540     /// to a file.
00541     ///
00542     /// \return true if successful, false if error.
00543     bool DebugPrintObservationArray( const char *filepath );
00544 
00545 
00546     bool Debug_WriteSuperMsg80CharsWide(
00547       char* buffer,                    //!< A large character buffer (8KB min).
00548       const unsigned maxBufferLength,  //!< The maximum buffer length [bytes].
00549       const double referenceLatitude,  //!< Reference position latitude [rad].
00550       const double referenceLongitude, //!< Reference position longitude [rad].
00551       const double referenceHeight,    //!< Reference position height [m].
00552       unsigned& nrBytesInBuffer );      //!< The number of bytes set in the buffer.  
00553   
00554   public:
00555 
00556     /// The array of GNSS measurements.
00557     GNSS_structMeasurement m_ObsArray[GNSS_RXDATA_NR_CHANNELS];
00558     
00559     /// The number of usable items in m_ObsArray.
00560     unsigned char m_nrValidObs;
00561 
00562 
00563     /// The previous observation set.
00564     GNSS_structMeasurement m_prev_ObsArray[GNSS_RXDATA_NR_CHANNELS];
00565 
00566     /// The number of usable items in m_prevObsArray.
00567     unsigned char m_prev_nrValidObs;
00568 
00569     
00570     /// The number of GPS L1 observations in m_ObsArray.
00571     unsigned char m_nrGPSL1Obs;
00572 
00573     /// The receiver's position, velocity, and time information.
00574     GNSS_structPVT  m_pvt;
00575 
00576     /// The receiver's previous position, velocity, and time information.
00577     GNSS_structPVT  m_prev_pvt;
00578 
00579     /// The klobuchar ionospheric correction parameters for GPS.
00580     GNSS_structKlobuchar m_klobuchar;
00581 
00582     /// This is an object for storing and handling GPS ephemeris and almanac
00583     /// information for valid GPS system satellites.
00584     GPS_BroadcastEphemerisAndAlmanacArray  m_EphAlmArray;
00585 
00586     /// This is the elevation mask angle [rads]. 
00587     /// The default is 5 degrees.
00588     double m_elevationMask; 
00589 
00590     /// This is the carrier to noise density ratio mask value [dB-Hz].
00591     /// The default is 28.0 dB-Hz.
00592     double m_cnoMask;
00593 
00594     /// This is the minimum allowable locktime [s].
00595     /// The default is 0.0.
00596     double m_locktimeMask;
00597 
00598     /// The maximum usable age for an ephemeris [s].
00599     /// The default is 4 hours (3600*4).
00600     unsigned m_maxAgeEphemeris; 
00601 
00602 
00603     /// A boolean to indicate if the tropospheric correction is to be disabled for all satellites.
00604     bool m_DisableTropoCorrection;
00605 
00606     /// A boolean to indicate if the ionospheric correction is to be disabled for all satellites.
00607     bool m_DisableIonoCorrection;
00608 
00609   protected:
00610 
00611     /// A file pointer to the input.
00612     FILE* m_fid;
00613 
00614     /// A large message buffer.
00615     unsigned char m_message[GNSS_RXDATA_MSG_LENGTH];
00616 
00617     /// The length of the message in the message buffer.
00618     unsigned short m_messageLength;
00619 
00620     /// The receiver data type.
00621     GNSS_enumRxDataType m_rxDataType;
00622 
00623 
00624   protected: // RINEX related parameters
00625   
00626     /// The RINEX Observation Header must be checked once.
00627     bool m_CheckRinexObservationHeader;
00628 
00629     /// Decoded RINEX Observation Header information.
00630     RINEX_structDecodedHeader m_RINEX_obs_header;
00631 
00632     /// A boolean to indicate RINEX ephemeris information is used.
00633     bool m_RINEX_use_eph;
00634 
00635     struct 
00636     {
00637       /// The file path to the RINEX ephemeris data.
00638       std::string filepath;
00639 
00640       /// All of the RINEX ephemeris data is loaded into a single array at start up.
00641       GPS_structEphemeris *eph_array;
00642 
00643       /// The length of the m_RINEX_eph_array.
00644       unsigned max_array_length;
00645 
00646       /// The length of the m_RINEX_eph_array.
00647       unsigned array_length;
00648 
00649       /// An associated ionospheric model.
00650       GNSS_structKlobuchar iono_model;
00651     } m_RINEX_eph;
00652 
00653     /// An index into m_RINEX_eph.eph_array that is used to keep track of
00654     /// operations.
00655     unsigned m_RINEX_eph_index;
00656 
00657     
00658   };
00659 
00660 
00661 
00662 
00663 
00664 } // end namespace GNSS
00665 
00666 #endif // _GNSS_RXDATA_H_
00667