- Timestamp:
- Oct 16, 2007, 4:30:58 PM (17 years ago)
- Location:
- trunk/BNC
- Files:
-
- 6 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 -
trunk/BNC/RTIGS/rtstruct.h
r305 r511 20 20 /* Purpose : structure definitions for the wide area prototype */ 21 21 22 /* RCS: $Header: /usr/local/cvsroot/BNC/RTIGS/rtstruct.h,v 1. 1 2006/08/20 13:36:49mervart Exp $ */22 /* RCS: $Header: /usr/local/cvsroot/BNC/RTIGS/rtstruct.h,v 1.3 2006/11/13 11:42:14 mervart Exp $ */ 23 23 24 24 /* Externals : */ … … 80 80 81 81 #define MAX_STA (24) /* maximum stations */ 82 #ifndef PI 82 83 #define PI (3.141592653589793) /* value of PI */ 84 #endif 83 85 #define DTR (0.017453292519943) /* deg to rad conversion con. */ 84 86 #define C (299792458.00) /* speed of light in vaccuum */ -
trunk/BNC/bncapp.cpp
r476 r511 100 100 } 101 101 } 102 103 // 104 //////////////////////////////////////////////////////////////////////////// 105 void bncApp::slotNewGPSEph(gpsephemeris* gpseph) { 106 } 107 108 // 109 //////////////////////////////////////////////////////////////////////////// 110 void bncApp::slotNewGlonassEph(glonassephemeris* glonasseph) { 111 } 112 -
trunk/BNC/bncapp.h
r464 r511 31 31 32 32 #include "bnccaster.h" 33 #include "RTCM3/RTCM3Decoder.h" 33 34 34 35 class bncApp : public QApplication { … … 40 41 public slots: 41 42 void slotMessage(const QByteArray msg); 43 void slotNewGPSEph(gpsephemeris* gpseph); 44 void slotNewGlonassEph(glonassephemeris* glonasseph); 42 45 private: 43 46 QFile* _logFile; -
trunk/BNC/bncgetthread.cpp
r508 r511 333 333 else if (_format.indexOf("RTCM_3") != -1) { 334 334 emit(newMessage("Get Data: " + _staID + " in RTCM 3.0 format")); 335 _decoder = new RTCM3Decoder( _staID);335 _decoder = new RTCM3Decoder(); 336 336 } 337 337 else if (_format.indexOf("RTIGS") != -1) {
Note:
See TracChangeset
for help on using the changeset viewer.