[35] | 1 | // -*- C++ -*-
|
---|
| 2 | //
|
---|
| 3 | // $Id: GPSDecoder.h,v 1.1.1.1 2006/01/11 09:34:31 mervart Exp $
|
---|
| 4 | // 2005/04/11: include 'int iPCode' into class 'GPSDecoder' (BKG)
|
---|
| 5 | #if !defined(__GPSDecoder_h__)
|
---|
| 6 | #define __GPSDecoder_h__
|
---|
| 7 |
|
---|
| 8 | #include <list>
|
---|
| 9 | #include <iostream>
|
---|
| 10 |
|
---|
| 11 | using namespace std;
|
---|
| 12 |
|
---|
| 13 |
|
---|
| 14 | #include "format.h"
|
---|
| 15 |
|
---|
| 16 | //
|
---|
| 17 | // One Code/Phase - Measurement
|
---|
| 18 | //
|
---|
| 19 | struct Observation {
|
---|
| 20 | Observation()
|
---|
| 21 | :SVPRN(0)
|
---|
| 22 | ,GPSWeek(0)
|
---|
| 23 | ,GPSWeeks(0)
|
---|
| 24 | ,sec(0.)
|
---|
| 25 | ,C1(0.)
|
---|
| 26 | ,P2(0.)
|
---|
| 27 | ,L1(0.)
|
---|
| 28 | ,L2(0.)
|
---|
| 29 | ,SNR1(0)
|
---|
| 30 | ,SNR2(0)
|
---|
| 31 | ,pCodeIndicator(0)
|
---|
| 32 | ,cumuLossOfCont(0)
|
---|
| 33 | {StatID[0] = '\0';}
|
---|
| 34 |
|
---|
| 35 | Observation( char _statID
|
---|
| 36 | ,char _svprn
|
---|
| 37 | ,short _GPSWeek
|
---|
| 38 | ,int _GPSWeeks
|
---|
| 39 | ,double _sec
|
---|
| 40 | ,double _C1
|
---|
| 41 | ,double _P2
|
---|
| 42 | ,double _L1
|
---|
| 43 | ,double _L2
|
---|
| 44 | ,short _SNR1
|
---|
| 45 | ,short _SNR2
|
---|
| 46 | ,int _pCodeIndicator
|
---|
| 47 | ,u_int _cumuLossOfCont)
|
---|
| 48 | :SVPRN(_svprn)
|
---|
| 49 | ,GPSWeek(_GPSWeek)
|
---|
| 50 | ,GPSWeeks(_GPSWeeks)
|
---|
| 51 | ,sec(_sec)
|
---|
| 52 | ,C1(_C1)
|
---|
| 53 | ,P2(_P2)
|
---|
| 54 | ,L1(_L1)
|
---|
| 55 | ,L2(_L2)
|
---|
| 56 | ,SNR1(_SNR1)
|
---|
| 57 | ,SNR2(_SNR2)
|
---|
| 58 | ,pCodeIndicator(_pCodeIndicator)
|
---|
| 59 | ,cumuLossOfCont(_cumuLossOfCont)
|
---|
| 60 | {StatID[0] = _statID; StatID[1] = '\0';}
|
---|
| 61 |
|
---|
| 62 | char StatID[5+1]; //< Station ID
|
---|
| 63 | char SVPRN; //< Satellite PRN
|
---|
| 64 | short GPSWeek; //< Week of GPS-Time
|
---|
| 65 | int GPSWeeks; //< Second of Week (GPS-Time>
|
---|
| 66 | double sec;
|
---|
| 67 | double C1; //< CA-code validated raw pseudorange (meters)
|
---|
| 68 | double P2; //< P2-code validated raw pseudorange (meters)
|
---|
| 69 | double L1; //< validated raw carrier phase (meters)
|
---|
| 70 | double L2; //< validated raw carrier phase (meters)
|
---|
| 71 | short SNR1; //< signal-to noise ration (0.1 dB)
|
---|
| 72 | short SNR2; //< signal-to noise ration (0.1 dB)
|
---|
| 73 | int pCodeIndicator; // 0 ... CA Code, 1 ... P Code
|
---|
| 74 | u_int cumuLossOfCont; // 0 to 31
|
---|
| 75 |
|
---|
| 76 | // Operator to write ascii formatted members of Observation to an outstream
|
---|
| 77 | friend ostream& operator<<(ostream& os, const Observation & o) {
|
---|
| 78 | os <<format("%3d%3d",(int) o.StatID,(int) o.SVPRN)
|
---|
| 79 | <<format(" %4d %10d",(int)o.GPSWeek, o.GPSWeeks)
|
---|
| 80 | <<format("\t%15.3f\t%15.3f\t%15.3f\t%15.3f\t%15.3f\t%15.3f"
|
---|
| 81 | ,o.C1, o.P2, o.L1, o.L2, 0.1*o.SNR1, 0.1*o.SNR2)
|
---|
| 82 | <<endl;
|
---|
| 83 | return os;
|
---|
| 84 | }
|
---|
| 85 | } ;
|
---|
| 86 |
|
---|
| 87 | //
|
---|
| 88 | // GPS Orbitinformation
|
---|
| 89 | //
|
---|
| 90 | struct Ephemeris {
|
---|
| 91 | short svprn; //< Satellite PRN
|
---|
| 92 | short wn; //< GPS - week number
|
---|
| 93 | short aodc; //< Age of data issue Clock
|
---|
| 94 | short aode; //< Age of data issue Orbit
|
---|
| 95 | double tow; //< Seconds of GPS week
|
---|
| 96 | double toc; //< Reference time, Clock (sec)
|
---|
| 97 | double toe; //< Ref.time for Orbit:(sec)
|
---|
| 98 | double tgd; //< Group delay (sec)
|
---|
| 99 | double af2; //< Clock parameter: (sec/sec^2)
|
---|
| 100 | double af1; //< Clock parameter: (sec/sec)
|
---|
| 101 | double af0; //< Clock parameter: (sec)
|
---|
| 102 | double crs; //< Sin-harmonic correction term, orbit radius:(meters)
|
---|
| 103 | double deltan; //< Mean anomaly correction:(semi-cirl/sec)
|
---|
| 104 | double m0; //< Mean anomaly @ ref.time:(semi-circle)
|
---|
| 105 | double cuc; //< Cos-harmonic correction term, argument of Latitude:(radians)
|
---|
| 106 | double e; //< Eccentricity
|
---|
| 107 | double cus; //< Sin-harmonic correction term, argument of Latitude:(radians)
|
---|
| 108 | double roota; //< Square root of semi-major axis:(m ^1/2)
|
---|
| 109 | double cic; //< Cos-harmonic correction term, angle of inclination:(radians)
|
---|
| 110 | double omega0; //< Lon. of Asc. node at weekly epoch: (semi-circle)
|
---|
| 111 | double cis; //< Sin-harmonic correction term, angle of Inclination:(radians)
|
---|
| 112 | double i0; //< Inclination angle at Ref.time: (semi-circle)
|
---|
| 113 | double crc; //< Cos-harmonic correction term, orbit radius:(meters)
|
---|
| 114 | double omega; //< Argument of Perigee:(semi-circle)
|
---|
| 115 | double omegadot; //< Rate of right ascension: (semi-circle/sec)
|
---|
| 116 | double idot; //< Rate of inclination angle: (semi-circle/sec)
|
---|
| 117 | short svaccu; //< SV accuracy (0-15)
|
---|
| 118 | short fit; //< Curve fit interval (0-1)
|
---|
| 119 | short cReserved1; //< Not used - yet
|
---|
| 120 | short health; //< 0 if healthy, else unhealthy
|
---|
| 121 | short cReserved2; //< Not used - yet
|
---|
| 122 | short SVEnable; //< Not used - yet
|
---|
| 123 | } ;
|
---|
| 124 |
|
---|
| 125 | const double lambda1 = 0.1902936727984; // [m]
|
---|
| 126 | const double lambda2 = 0.2442102134241; // [m]
|
---|
| 127 | const unsigned glonass_svid = 45;
|
---|
| 128 |
|
---|
| 129 | class GPSDecoder {
|
---|
| 130 | public:
|
---|
| 131 | int iPCode; // pointer for CA or P code on L1
|
---|
| 132 |
|
---|
| 133 | virtual void Decode(char* _ptrBuffer=NULL, int _nBufLen=0) = 0;
|
---|
| 134 | virtual ~GPSDecoder() {}
|
---|
| 135 | typedef list<Observation*> ObsList_t;
|
---|
| 136 | typedef list<Ephemeris*> EphList_t;
|
---|
| 137 |
|
---|
| 138 | ObsList_t m_lObsList;
|
---|
| 139 | EphList_t m_lEphList;
|
---|
| 140 |
|
---|
| 141 | } ;
|
---|
| 142 |
|
---|
| 143 | #endif
|
---|