- Timestamp:
- Dec 16, 2007, 3:44:57 PM (17 years ago)
- Location:
- trunk/BNC
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/RTCM/GPSDecoder.h
r464 r621 26 26 #define GPSDECODER_H 27 27 28 #include <list> 28 #include <QPointer> 29 #include <QList> 29 30 30 class Observation {31 class Observation : public QObject{ 31 32 public: 32 33 Observation() { … … 68 69 }; 69 70 71 typedef QPointer<Observation> p_obs; 72 70 73 class GPSDecoder { 71 74 public: 72 75 virtual void Decode(char* buffer, int bufLen) = 0; 73 76 virtual ~GPSDecoder() {} 74 std::list<Observation*> _obsList;77 QList<p_obs> _obsList; 75 78 }; 76 79 -
trunk/BNC/RTCM/RTCM2Decoder.cpp
r464 r621 58 58 59 59 RTCM2Decoder::~RTCM2Decoder() { 60 60 QListIterator<p_obs> it(_obsList); 61 while (it.hasNext()) { 62 delete it.next(); 63 } 64 _obsList.clear(); 61 65 } 62 66 -
trunk/BNC/RTCM3/RTCM3Decoder.cpp
r585 r621 84 84 //////////////////////////////////////////////////////////////////////////// 85 85 RTCM3Decoder::~RTCM3Decoder() { 86 QListIterator<p_obs> it(_obsList); 87 while (it.hasNext()) { 88 delete it.next(); 89 } 90 _obsList.clear(); 86 91 } 87 92 -
trunk/BNC/RTIGS/RTIGSDecoder.cpp
r464 r621 55 55 //////////////////////////////////////////////////////////////////////////// 56 56 RTIGSDecoder::~RTIGSDecoder() { 57 QListIterator<p_obs> it(_obsList); 58 while (it.hasNext()) { 59 delete it.next(); 60 } 61 _obsList.clear(); 57 62 } 58 63 -
trunk/BNC/bnc.pro
r610 r621 2 2 # Switch to debug configuration 3 3 # ----------------------------- 4 ###CONFIG -= release5 ###CONFIG += debug4 CONFIG -= release 5 CONFIG += debug 6 6 7 7 DEFINES += NO_RTCM3_MAIN -
trunk/BNC/bncapp.cpp
r600 r621 73 73 _logFile = 0; 74 74 _logStream = 0; 75 _caster = 0; 75 76 76 77 // Lists of Ephemeris … … 617 618 } 618 619 620 // 621 //////////////////////////////////////////////////////////////////////////// 622 void bncApp::slotQuit() { 623 cout << "bncApp::slotQuit" << endl; 624 delete _caster; 625 quit(); 626 } 627 628 -
trunk/BNC/bncapp.h
r600 r621 40 40 QString bncVersion() const {return _bncVersion;} 41 41 void setPort(int port); 42 void setCaster(bncCaster* caster) {_caster = caster;} 42 43 public slots: 43 44 void slotMessage(const QByteArray msg); 44 45 void slotNewGPSEph(gpsephemeris* gpseph); 45 46 void slotNewGlonassEph(glonassephemeris* glonasseph); 47 void slotQuit(); 48 46 49 private slots: 47 50 void slotNewConnection(); … … 70 73 QTcpServer* _server; 71 74 QList<QTcpSocket*>* _sockets; 75 bncCaster* _caster; 72 76 }; 73 77 #endif -
trunk/BNC/bncgetthread.cpp
r620 r621 377 377 // ------------------ 378 378 while (true) { 379 380 if (_decoder) { 381 QListIterator<p_obs> it(_decoder->_obsList); 382 while (it.hasNext()) { 383 delete it.next(); 384 } 385 _decoder->_obsList.clear(); 386 } 387 379 388 try { 380 389 if (_socket->state() != QAbstractSocket::ConnectedState) { … … 394 403 delete [] data; 395 404 396 for (list<Observation*>::iterator it = _decoder->_obsList.begin(); 397 it != _decoder->_obsList.end(); it++) { 405 406 QListIterator<p_obs> it(_decoder->_obsList); 407 while (it.hasNext()) { 408 p_obs obs = it.next(); 398 409 399 410 // Check observation epoch … … 406 417 const double maxDt = 600.0; 407 418 408 if (week < (*it)->GPSWeek) {419 if (week < obs->GPSWeek) { 409 420 week += 1; 410 421 sec -= secPerWeek; 411 422 } 412 if (week > (*it)->GPSWeek) {423 if (week > obs->GPSWeek) { 413 424 week -= 1; 414 425 sec += secPerWeek; 415 426 } 416 double dt = fabs(sec - (*it)->GPSWeeks);417 if (week != (*it)->GPSWeek || dt > maxDt) {427 double dt = fabs(sec - obs->GPSWeeks); 428 if (week != obs->GPSWeek || dt > maxDt) { 418 429 emit( newMessage("Wrong observation epoch") ); 419 delete (*it);430 delete obs; 420 431 continue; 421 432 } … … 424 435 // ------------ 425 436 if (_rnx) { 426 long iSec = long(floor( (*it)->GPSWeeks+0.5));427 long newTime = (*it)->GPSWeek * 7*24*3600 + iSec;437 long iSec = long(floor(obs->GPSWeeks+0.5)); 438 long newTime = obs->GPSWeek * 7*24*3600 + iSec; 428 439 if (_samplingRate == 0 || iSec % _samplingRate == 0) { 429 _rnx->deepCopy( *it);440 _rnx->deepCopy(obs); 430 441 } 431 442 _rnx->dumpEpoch(newTime); 432 443 } 433 444 434 bool firstObs = ( it == _decoder->_obsList.begin());435 emit newObs(_staID, firstObs, *it);445 bool firstObs = (obs == _decoder->_obsList.first()); 446 emit newObs(_staID, firstObs, obs); 436 447 } 437 448 _decoder->_obsList.clear(); -
trunk/BNC/bncmain.cpp
r606 r621 50 50 using namespace std; 51 51 52 bncCaster* _caster = 0;53 54 52 void catch_signal(int) { 55 delete _caster;56 53 cout << "Program Interrupted by Ctrl-C" << endl; 57 ((bncApp*)qApp)-> quit();54 ((bncApp*)qApp)->slotQuit(); 58 55 } 59 56 … … 109 106 // ---------------------------- 110 107 else { 108 109 bncCaster* caster = new bncCaster(settings.value("outFile").toString(), 110 settings.value("outPort").toInt()); 111 112 app.setCaster(caster); 113 111 114 // Ctrl-C Signal Handling 112 115 // ---------------------- 113 116 signal(SIGINT, catch_signal); 114 117 115 _caster = new bncCaster(settings.value("outFile").toString(), 116 settings.value("outPort").toInt()); 117 118 //// beg test 119 QTimer::singleShot(30000, &app, SLOT(slotQuit())); 120 //// end test 121 118 122 app.setPort(settings.value("outEphPort").toInt()); 119 123 120 app.connect( _caster, SIGNAL(getThreadErrors()), &app, SLOT(quit()));121 app.connect( _caster, SIGNAL(newMessage(const QByteArray&)),124 app.connect(caster, SIGNAL(getThreadErrors()), &app, SLOT(quit())); 125 app.connect(caster, SIGNAL(newMessage(const QByteArray&)), 122 126 &app, SLOT(slotMessage(const QByteArray&))); 123 127 … … 139 143 &app, SLOT(slotMessage(const QByteArray&))); 140 144 141 _caster->addGetThread(getThread);145 caster->addGetThread(getThread); 142 146 143 147 getThread->start(); 144 148 } 145 if ( _caster->numStations() == 0) {149 if (caster->numStations() == 0) { 146 150 return 0; 147 151 }
Note:
See TracChangeset
for help on using the changeset viewer.