- Timestamp:
- Aug 27, 2008, 12:29:55 PM (16 years ago)
- Location:
- trunk/BNS
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNS/bns.cpp
r1065 r1066 73 73 // Socket and file for outputting the results 74 74 // ------------------------------------------- 75 _caster = new t_bnscaster(settings.value("mountpoint").toString());76 connect(_caster , SIGNAL(error(const QByteArray)),75 _caster.push_back(new t_bnscaster(settings.value("mountpoint").toString())); 76 connect(_caster.back(), SIGNAL(error(const QByteArray)), 77 77 this, SLOT(slotError(const QByteArray))); 78 connect(_caster , SIGNAL(newMessage(const QByteArray)),78 connect(_caster.back(), SIGNAL(newMessage(const QByteArray)), 79 79 this, SLOT(slotMessage(const QByteArray))); 80 80 … … 131 131 _sp3 = new bnsSP3(prep, ext, path, intr, sampl); 132 132 } 133 134 // Reference frame135 // ---------------136 _crdTrafo = false;137 if (settings.value("refSys").toString() == "ETRS89") {138 _crdTrafo = true;139 }140 133 } 141 134 … … 146 139 delete _clkServer; 147 140 delete _clkSocket; 148 delete _caster; 141 for (int ic = 0; ic < _caster.size(); ic++) { 142 delete _caster.at(ic); 143 } 149 144 delete _logStream; 150 145 delete _logFile; … … 250 245 if (_clkSocket && _clkSocket->state() == QAbstractSocket::ConnectedState) { 251 246 if ( _clkSocket->canReadLine()) { 252 _caster->open();253 247 readEpoch(); 254 248 } … … 287 281 QStringList prns; 288 282 289 /// for (int oldEph = 0; oldEph <= 1; oldEph++) { 290 for (int oldEph = 0; oldEph <= 0; oldEph++) { 291 292 struct ClockOrbit co; 293 memset(&co, 0, sizeof(co)); 294 co.GPSEpochTime = (int)GPSweeks; 295 co.GLONASSEpochTime = (int)fmod(GPSweeks, 86400.0); 296 co.ClockDataSupplied = 1; 297 co.OrbitDataSupplied = 1; 298 co.SatRefPoint = POINT_CENTER; 299 co.SatRefDatum = DATUM_ITRF; 300 301 for (int ii = 1; ii <= numSat; ii++) { 302 303 QString prn; 304 ColumnVector xx(5); 305 t_eph* ep = 0; 306 307 if (oldEph == 0) { 308 line = _clkSocket->readLine(); 309 QTextStream in(line); 310 in >> prn; 311 prns << prn; 312 if ( _ephList.contains(prn) ) { 313 in >> xx(1) >> xx(2) >> xx(3) >> xx(4) >> xx(5); xx(4) *= 1e-6; 314 315 //// beg test (zero clock correction for Gerhard Wuebbena) 316 //// xx(4) -= xx(5) / 299792458.0; 317 //// end test 318 319 t_ephPair* pair = _ephList[prn]; 320 pair->xx = xx; 321 ep = pair->eph; 283 for (int ic = 0; ic < _caster.size(); ic++) { 284 _caster.at(ic)->open(); 285 286 for (int oldEph = 0; oldEph <= 0; oldEph++) { // TODO: handle old ephemeris 287 288 struct ClockOrbit co; 289 memset(&co, 0, sizeof(co)); 290 co.GPSEpochTime = (int)GPSweeks; 291 co.GLONASSEpochTime = (int)fmod(GPSweeks, 86400.0); 292 co.ClockDataSupplied = 1; 293 co.OrbitDataSupplied = 1; 294 co.SatRefPoint = POINT_CENTER; 295 co.SatRefDatum = DATUM_ITRF; 296 297 for (int ii = 1; ii <= numSat; ii++) { 298 299 QString prn; 300 ColumnVector xx(5); 301 t_eph* ep = 0; 302 303 if (oldEph == 0) { 304 line = _clkSocket->readLine(); 305 QTextStream in(line); 306 in >> prn; 307 prns << prn; 308 if ( _ephList.contains(prn) ) { 309 in >> xx(1) >> xx(2) >> xx(3) >> xx(4) >> xx(5); xx(4) *= 1e-6; 310 311 //// beg test (zero clock correction for Gerhard Wuebbena) 312 //// xx(4) -= xx(5) / 299792458.0; 313 //// end test 314 315 t_ephPair* pair = _ephList[prn]; 316 pair->xx = xx; 317 ep = pair->eph; 318 } 319 } 320 else { 321 prn = prns[ii-1]; 322 if ( _ephList.contains(prn) ) { 323 t_ephPair* pair = _ephList[prn]; 324 prn = pair->eph->prn(); 325 xx = pair->xx; 326 ep = pair->oldEph; 327 } 328 } 329 330 if (ep != 0) { 331 struct ClockOrbit::SatData* sd = 0; 332 if (prn[0] == 'G') { 333 sd = co.Sat + co.NumberOfGPSSat; 334 ++co.NumberOfGPSSat; 335 } 336 else if (prn[0] == 'R') { 337 sd = co.Sat + CLOCKORBIT_NUMGPS + co.NumberOfGLONASSSat; 338 ++co.NumberOfGLONASSSat; 339 } 340 if (sd) { 341 QString outLine; 342 processSatellite(oldEph, _caster.at(ic)->crdTrafo(), ep, GPSweek, 343 GPSweeks, prn, xx, sd, outLine); 344 _caster.at(ic)->printAscii(line); 345 } 322 346 } 323 347 } 324 else { 325 prn = prns[ii-1]; 326 if ( _ephList.contains(prn) ) { 327 t_ephPair* pair = _ephList[prn]; 328 prn = pair->eph->prn(); 329 xx = pair->xx; 330 ep = pair->oldEph; 331 } 332 } 333 334 if (ep != 0) { 335 struct ClockOrbit::SatData* sd = 0; 336 if (prn[0] == 'G') { 337 sd = co.Sat + co.NumberOfGPSSat; 338 ++co.NumberOfGPSSat; 339 } 340 else if (prn[0] == 'R') { 341 sd = co.Sat + CLOCKORBIT_NUMGPS + co.NumberOfGLONASSSat; 342 ++co.NumberOfGLONASSSat; 343 } 344 if (sd) { 345 QString outLine; 346 processSatellite(oldEph, ep, GPSweek, GPSweeks, prn, xx, 347 sd, outLine); 348 _caster->printAscii(line); 348 349 if ( _caster.at(ic)->used() && 350 (co.NumberOfGPSSat > 0 || co.NumberOfGLONASSSat > 0) ) { 351 char obuffer[CLOCKORBIT_BUFFERSIZE]; 352 int len = MakeClockOrbit(&co, COTYPE_AUTO, 0, obuffer, sizeof(obuffer)); 353 if (len > 0) { 354 emit(newOutBytes(len)); 355 _caster.at(ic)->write(obuffer, len); 349 356 } 350 357 } 351 358 } 352 353 if ( _caster->used() &&354 (co.NumberOfGPSSat > 0 || co.NumberOfGLONASSSat > 0) ) {355 char obuffer[CLOCKORBIT_BUFFERSIZE];356 int len = MakeClockOrbit(&co, COTYPE_AUTO, 0, obuffer, sizeof(obuffer));357 if (len > 0) {358 emit(newOutBytes(len));359 _caster->write(obuffer, len);360 }361 }362 359 } 363 360 } … … 366 363 // 367 364 //////////////////////////////////////////////////////////////////////////// 368 void t_bns::processSatellite(int oldEph, t_eph* ep, int GPSweek, double GPSweeks, 369 const QString& prn, const ColumnVector& xx, 365 void t_bns::processSatellite(int oldEph, bool trafo, t_eph* ep, int GPSweek, 366 double GPSweeks, const QString& prn, 367 const ColumnVector& xx, 370 368 struct ClockOrbit::SatData* sd, 371 369 QString& outLine) { … … 377 375 378 376 ColumnVector xyz = xx.Rows(1,3); 379 if ( _crdTrafo) {377 if (trafo) { 380 378 crdTrafo(GPSweek, xyz); 381 379 } -
trunk/BNS/bns.h
r1065 r1066 59 59 void openCaster(); 60 60 void readEpoch(); 61 void processSatellite(int oldEph, t_eph* ep, int GPSweek, double GPSweeks, 62 const QString& prn, const ColumnVector& xx, 63 struct ClockOrbit::SatData* sd, QString& outLine); 61 void processSatellite(int oldEph, bool trafo, t_eph* ep, int GPSweek, 62 double GPSweeks, const QString& prn, 63 const ColumnVector& xx, struct ClockOrbit::SatData* sd, 64 QString& outLine); 64 65 void crdTrafo(int GPSWeek, ColumnVector& xyz); 65 66 66 67 QTcpServer* _clkServer; 67 68 QTcpSocket* _clkSocket; 68 t_bnscaster*_caster;69 QList<t_bnscaster*> _caster; 69 70 QFile* _logFile; 70 71 QTextStream* _logStream; … … 74 75 bnsRinex* _rnx; 75 76 bnsSP3* _sp3; 76 bool _crdTrafo;77 77 }; 78 78 #endif -
trunk/BNS/bnscaster.cpp
r1065 r1066 47 47 _outStream = new QTextStream(_outFile); 48 48 } 49 } 50 51 // Reference frame 52 // --------------- 53 _crdTrafo = false; 54 if (settings.value("refSys").toString() == "ETRS89") { 55 _crdTrafo = true; 49 56 } 50 57 } -
trunk/BNS/bnscaster.h
r1065 r1066 12 12 void write(char* buffer, unsigned len); 13 13 void printAscii(const QString& line); 14 bool used() {return _outSocket || _outFile;} 14 bool used() const {return _outSocket || _outFile;} 15 bool crdTrafo() const {return _crdTrafo;} 15 16 16 17 signals: … … 25 26 QFile* _outFile; 26 27 QTextStream* _outStream; 28 bool _crdTrafo; 27 29 }; 28 30
Note:
See TracChangeset
for help on using the changeset viewer.