Changeset 511 in ntrip for trunk/BNC/RTCM3
- Timestamp:
- Oct 16, 2007, 4:30:58 PM (17 years ago)
- Location:
- trunk/BNC/RTCM3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/RTCM3/RTCM3Decoder.cpp
r509 r511 44 44 #include "RTCM3Decoder.h" 45 45 #include "bncconst.h" 46 #include "bncapp.h" 46 47 47 48 using namespace std; … … 50 51 # define isinf(x) 0 51 52 #endif 53 54 // 55 //////////////////////////////////////////////////////////////////////////// 56 ephSender::ephSender() { 57 connect(this, SIGNAL(newGPSEph(gpsephemeris*)), 58 (bncApp*) qApp, SLOT(slotNewGPSEph(gpsephemeris*))); 59 connect(this, SIGNAL(newGlonassEph(glonassephemeris*)), 60 (bncApp*) qApp, SLOT(slotNewGlonassEph(glonassephemeris*))); 61 } 52 62 53 63 // Error Handling … … 63 73 // Constructor 64 74 //////////////////////////////////////////////////////////////////////////// 65 RTCM3Decoder::RTCM3Decoder( const QByteArray& staID) : GPSDecoder() {75 RTCM3Decoder::RTCM3Decoder() : GPSDecoder() { 66 76 67 77 const int LEAPSECONDS = 14; /* only needed for approx. time */ … … 73 83 _Parser.GPSWeek = tim/(7*24*60*60); 74 84 _Parser.GPSTOW = tim%(7*24*60*60); 75 76 // _Parser2 is used for direct file output77 // ---------------------------------------78 memset(&_Parser2, 0, sizeof(_Parser2));79 _Parser2.GPSWeek = tim/(7*24*60*60);80 _Parser2.GPSTOW = tim%(7*24*60*60);81 82 _Parser2.headerfile = 0;83 _Parser2.glonassephemeris = 0;84 _Parser2.gpsephemeris = strdup((staID + ".EPH").data());85 _Parser2.rinex3 = 1;86 85 } 87 86 … … 89 88 //////////////////////////////////////////////////////////////////////////// 90 89 RTCM3Decoder::~RTCM3Decoder() { 91 if (_Parser2.glonassfile) {92 fclose(_Parser2.glonassfile);93 }94 if (_Parser2.gpsfile) {95 fclose(_Parser2.gpsfile);96 }97 90 } 98 91 … … 101 94 void RTCM3Decoder::Decode(char* buffer, int bufLen) { 102 95 103 // Direct file output104 // ------------------105 for (int ii = 0; ii < bufLen; ii++) {106 HandleByte(&_Parser2, (unsigned int) buffer[ii]);107 if (_Parser2.glonassfile) {108 fflush(_Parser2.glonassfile);109 }110 if (_Parser2.gpsfile) {111 fflush(_Parser2.gpsfile);112 }113 }114 115 // Fill the obs structure116 // ----------------------117 96 for (int ii = 0; ii < bufLen; ii++) { 118 97 … … 122 101 while(int rr = RTCM3Parser(&_Parser)) { 123 102 124 if (!_Parser.init) { 125 HandleHeader(&_Parser); 126 _Parser.init = 1; 127 } 103 // GNSS Observations 104 // ----------------- 105 if (rr == 1 || rr == 2) { 128 106 129 if (rr == 2) { 130 std::cerr << "No valid RINEX! All values are modulo 299792.458!\n"; 131 } 132 133 for (int ii = 0; ii < _Parser.Data.numsats; ii++) { 134 Observation* obs = new Observation(); 135 if (_Parser.Data.satellites[ii] <= PRN_GPS_END) { 136 obs->satSys = 'G'; 137 obs->satNum = _Parser.Data.satellites[ii]; 138 } 139 else { 140 obs->satSys = 'R'; 141 obs->satNum = _Parser.Data.satellites[ii] - PRN_GLONASS_START + 1; 142 } 143 obs->GPSWeek = _Parser.Data.week; 144 obs->GPSWeeks = _Parser.Data.timeofweek / 1000.0; 145 146 for (int jj = 0; jj < _Parser.numdatatypesGPS; jj++) { 147 int v = 0; 148 int df = _Parser.dataflag[jj]; 149 int pos = _Parser.datapos[jj]; 150 if ( (_Parser.Data.dataflags[ii] & df) 151 && !isnan(_Parser.Data.measdata[ii][pos]) 152 && !isinf(_Parser.Data.measdata[ii][pos])) { 153 v = 1; 154 } 155 else { 156 df = _Parser.dataflagGPS[jj]; 157 pos = _Parser.dataposGPS[jj]; 107 if (!_Parser.init) { 108 HandleHeader(&_Parser); 109 _Parser.init = 1; 110 } 111 112 if (rr == 2) { 113 std::cerr << "No valid RINEX! All values are modulo 299792.458!\n"; 114 } 115 116 for (int ii = 0; ii < _Parser.Data.numsats; ii++) { 117 Observation* obs = new Observation(); 118 if (_Parser.Data.satellites[ii] <= PRN_GPS_END) { 119 obs->satSys = 'G'; 120 obs->satNum = _Parser.Data.satellites[ii]; 121 } 122 else { 123 obs->satSys = 'R'; 124 obs->satNum = _Parser.Data.satellites[ii] - PRN_GLONASS_START + 1; 125 } 126 obs->GPSWeek = _Parser.Data.week; 127 obs->GPSWeeks = _Parser.Data.timeofweek / 1000.0; 128 129 for (int jj = 0; jj < _Parser.numdatatypesGPS; jj++) { 130 int v = 0; 131 int df = _Parser.dataflag[jj]; 132 int pos = _Parser.datapos[jj]; 158 133 if ( (_Parser.Data.dataflags[ii] & df) 159 134 && !isnan(_Parser.Data.measdata[ii][pos]) 160 135 && !isinf(_Parser.Data.measdata[ii][pos])) { 161 v = 1; 136 v = 1; 137 } 138 else { 139 df = _Parser.dataflagGPS[jj]; 140 pos = _Parser.dataposGPS[jj]; 141 if ( (_Parser.Data.dataflags[ii] & df) 142 && !isnan(_Parser.Data.measdata[ii][pos]) 143 && !isinf(_Parser.Data.measdata[ii][pos])) { 144 v = 1; 145 } 146 } 147 if(!v) 148 { continue; } 149 else 150 { 151 if (_Parser.dataflag[jj] & GNSSDF_C1DATA) { 152 obs->C1 = _Parser.Data.measdata[ii][_Parser.datapos[jj]]; 153 } 154 else if (_Parser.dataflag[jj] & GNSSDF_C2DATA) { 155 obs->C2 = _Parser.Data.measdata[ii][_Parser.datapos[jj]]; 156 } 157 else if (_Parser.dataflag[jj] & GNSSDF_P1DATA) { 158 obs->P1 = _Parser.Data.measdata[ii][_Parser.datapos[jj]]; 159 } 160 else if (_Parser.dataflag[jj] & GNSSDF_P2DATA) { 161 obs->P2 = _Parser.Data.measdata[ii][_Parser.datapos[jj]]; 162 } 163 else if (df & (GNSSDF_L1CDATA|GNSSDF_L1PDATA)) { 164 obs->L1 = _Parser.Data.measdata[ii][pos]; 165 obs->SNR1 = _Parser.Data.snrL1[ii]; 166 } 167 else if (df & (GNSSDF_L2CDATA|GNSSDF_L2PDATA)) { 168 obs->L2 = _Parser.Data.measdata[ii][pos]; 169 obs->SNR2 = _Parser.Data.snrL2[ii]; 170 } 171 else if (df & (GNSSDF_S1CDATA|GNSSDF_S1PDATA)) { 172 obs->S1 = _Parser.Data.measdata[ii][pos]; 173 } 174 else if (df & (GNSSDF_S2CDATA|GNSSDF_S2PDATA)) { 175 obs->S2 = _Parser.Data.measdata[ii][pos]; 162 176 } 163 177 } 164 if(!v)165 { continue; }166 else167 {168 if (_Parser.dataflag[jj] & GNSSDF_C1DATA) {169 obs->C1 = _Parser.Data.measdata[ii][_Parser.datapos[jj]];170 178 } 171 else if (_Parser.dataflag[jj] & GNSSDF_C2DATA) { 172 obs->C2 = _Parser.Data.measdata[ii][_Parser.datapos[jj]]; 173 } 174 else if (_Parser.dataflag[jj] & GNSSDF_P1DATA) { 175 obs->P1 = _Parser.Data.measdata[ii][_Parser.datapos[jj]]; 176 } 177 else if (_Parser.dataflag[jj] & GNSSDF_P2DATA) { 178 obs->P2 = _Parser.Data.measdata[ii][_Parser.datapos[jj]]; 179 } 180 else if (df & (GNSSDF_L1CDATA|GNSSDF_L1PDATA)) { 181 obs->L1 = _Parser.Data.measdata[ii][pos]; 182 obs->SNR1 = _Parser.Data.snrL1[ii]; 183 } 184 else if (df & (GNSSDF_L2CDATA|GNSSDF_L2PDATA)) { 185 obs->L2 = _Parser.Data.measdata[ii][pos]; 186 obs->SNR2 = _Parser.Data.snrL2[ii]; 187 } 188 else if (df & (GNSSDF_S1CDATA|GNSSDF_S1PDATA)) { 189 obs->S1 = _Parser.Data.measdata[ii][pos]; 190 } 191 else if (df & (GNSSDF_S2CDATA|GNSSDF_S2PDATA)) { 192 obs->S2 = _Parser.Data.measdata[ii][pos]; 193 } 179 _obsList.push_back(obs); 194 180 } 195 } 196 _obsList.push_back(obs); 181 } 182 183 // GPS Ephemeris 184 // ------------- 185 else if (rr == 1019) { 186 gpsephemeris* ep = new gpsephemeris(_Parser.ephemerisGPS); 187 emit _ephSender.newGPSEph(ep); 188 } 189 190 // GLONASS Ephemeris 191 // ----------------- 192 else if (rr == 1020) { 193 glonassephemeris* ep = new glonassephemeris(_Parser.ephemerisGLONASS); 194 emit _ephSender.newGlonassEph(ep); 197 195 } 198 196 } -
trunk/BNC/RTCM3/RTCM3Decoder.h
r508 r511 33 33 } 34 34 35 class ephSender : public QObject { 36 Q_OBJECT 37 public: 38 ephSender(); 39 friend class RTCM3Decoder; 40 signals: 41 void newGPSEph(gpsephemeris* gpseph); 42 void newGlonassEph(glonassephemeris* glonasseph); 43 } ; 44 35 45 class RTCM3Decoder : public GPSDecoder { 36 46 public: 37 RTCM3Decoder( const QByteArray& staID);47 RTCM3Decoder(); 38 48 ~RTCM3Decoder(); 39 49 void Decode(char* buffer = 0, int bufLen = 0); 40 50 private: 41 51 struct RTCM3ParserData _Parser; 42 struct RTCM3ParserData _Parser2;52 ephSender _ephSender; 43 53 } ; 44 54
Note:
See TracChangeset
for help on using the changeset viewer.