Changeset 6455 in ntrip
- Timestamp:
- Dec 27, 2014, 3:58:55 PM (10 years ago)
- Location:
- trunk/BNC/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/RTCM3/RTCM3coDecoder.cpp
r6454 r6455 262 262 void RTCM3coDecoder::sendResults() { 263 263 264 QList<t_orbCorr> orbCorrections;265 QList<t_clkCorr> clkCorrections;266 267 // Loop over all satellites (GPS and Glonass)268 // ------------------------------------------ 264 QList<t_orbCorr>& orbCorrections = _orbCorrections[_lastTime]; 265 QList<t_clkCorr>& clkCorrections = _clkCorrections[_lastTime]; 266 267 // Orbit and clock corrections of all satellites 268 // --------------------------------------------- 269 269 for (unsigned ii = 0; ii < CLOCKORBIT_NUMGPS + _clkOrb.NumberOfSat[CLOCKORBIT_SATGLONASS]; ii++) { 270 270 char sysCh = ' '; … … 304 304 } 305 305 306 // Clock Corrections 307 // ----------------- 306 308 if ( _clkOrb.messageType == COTYPE_GPSCOMBINED || 307 309 _clkOrb.messageType == COTYPE_GLONASSCOMBINED || … … 331 333 } 332 334 333 // Loop over all satellites (GPS and Glonass)334 // ----------- -------------------------------335 // Code Biases 336 // ----------- 335 337 QList<t_satBias> satBiases; 336 338 for (unsigned ii = 0; ii < CLOCKORBIT_NUMGPS + _codeBias.NumberOfSat[CLOCKORBIT_SATGLONASS]; ii++) { … … 354 356 } 355 357 356 if (orbCorrections.size() > 0) { 357 emit newOrbCorrections(orbCorrections); 358 } 359 if (clkCorrections.size() > 0) { 360 emit newClkCorrections(clkCorrections); 361 } 358 // Dump all older epochs 359 // --------------------- 360 QMutableMapIterator<bncTime, QList<t_orbCorr> > itOrb(_orbCorrections); 361 while (itOrb.hasNext()) { 362 itOrb.next(); 363 if (itOrb.key() < _lastTime) { 364 emit newOrbCorrections(itOrb.value()); 365 if (_out) { 366 t_orbCorr::writeEpoch(_out, itOrb.value()); 367 } 368 itOrb.remove(); 369 } 370 } 371 QMutableMapIterator<bncTime, QList<t_clkCorr> > itClk(_clkCorrections); 372 while (itClk.hasNext()) { 373 itClk.next(); 374 if (itClk.key() < _lastTime) { 375 emit newClkCorrections(itClk.value()); 376 if (_out) { 377 t_clkCorr::writeEpoch(_out, itClk.value()); 378 } 379 itClk.remove(); 380 } 381 } 382 362 383 if (_out) { 363 QListIterator<t_orbCorr> itOrb(orbCorrections);364 while (itOrb.hasNext()) {365 const t_orbCorr& orbCorr = itOrb.next();366 *_out << orbCorr.toLine();367 }368 QListIterator<t_clkCorr> itClk(clkCorrections);369 while (itClk.hasNext()) {370 const t_clkCorr& clkCorr = itClk.next();371 *_out << clkCorr.toLine();372 }373 384 _out->flush(); 374 385 } -
trunk/BNC/src/RTCM3/RTCM3coDecoder.h
r6454 r6455 44 44 45 45 signals: 46 void newOrbCorrections(QList<t_orbCorr> orbCorr); 47 void newClkCorrections(QList<t_clkCorr> clkCorr); 48 void newBiases(QList<t_satBias> biases); 46 void newOrbCorrections(QList<t_orbCorr>); 47 void newClkCorrections(QList<t_clkCorr>); 49 48 void newMessage(QByteArray msg, bool showOnScreen); 50 49 void providerIDChanged(QString staID); … … 66 65 bncTime _lastTime; 67 66 QMap<std::string, unsigned short> _IODs; 67 QMap<bncTime, QList<t_orbCorr> > _orbCorrections; 68 QMap<bncTime, QList<t_clkCorr> > _clkCorrections; 68 69 }; 69 70 -
trunk/BNC/src/bnccore.cpp
r6451 r6455 534 534 emit newOrbCorrections(orbCorrections); 535 535 if (_socketsCorr) { 536 QListIterator<t_orbCorr> it(orbCorrections); 537 while (it.hasNext()) { 538 const t_orbCorr& corr = it.next(); 539 QMutableListIterator<QTcpSocket*> is(*_socketsCorr); 540 while (is.hasNext()) { 541 QTcpSocket* sock = is.next(); 542 if (sock->state() == QAbstractSocket::ConnectedState) { 543 if (sock->write(corr.toLine().c_str()) == -1) { 544 delete sock; 545 is.remove(); 546 } 547 } 548 else if (sock->state() != QAbstractSocket::ConnectingState) { 536 ostringstream out; 537 t_orbCorr::writeEpoch(&out, orbCorrections); 538 QMutableListIterator<QTcpSocket*> is(*_socketsCorr); 539 while (is.hasNext()) { 540 QTcpSocket* sock = is.next(); 541 if (sock->state() == QAbstractSocket::ConnectedState) { 542 if (sock->write(out.str().c_str()) == -1) { 549 543 delete sock; 550 544 is.remove(); 551 545 } 546 } 547 else if (sock->state() != QAbstractSocket::ConnectingState) { 548 delete sock; 549 is.remove(); 552 550 } 553 551 } … … 561 559 emit newClkCorrections(clkCorrections); 562 560 if (_socketsCorr) { 563 QListIterator<t_clkCorr> it(clkCorrections); 564 while (it.hasNext()) { 565 const t_clkCorr& corr = it.next(); 566 QMutableListIterator<QTcpSocket*> is(*_socketsCorr); 567 while (is.hasNext()) { 568 QTcpSocket* sock = is.next(); 569 if (sock->state() == QAbstractSocket::ConnectedState) { 570 if (sock->write(corr.toLine().c_str()) == -1) { 571 delete sock; 572 is.remove(); 573 } 574 } 575 else if (sock->state() != QAbstractSocket::ConnectingState) { 561 ostringstream out; 562 t_clkCorr::writeEpoch(&out, clkCorrections); 563 QMutableListIterator<QTcpSocket*> is(*_socketsCorr); 564 while (is.hasNext()) { 565 QTcpSocket* sock = is.next(); 566 if (sock->state() == QAbstractSocket::ConnectedState) { 567 if (sock->write(out.str().c_str()) == -1) { 576 568 delete sock; 577 569 is.remove(); 578 570 } 571 } 572 else if (sock->state() != QAbstractSocket::ConnectingState) { 573 delete sock; 574 is.remove(); 579 575 } 580 576 } -
trunk/BNC/src/rinex/corrfile.cpp
r6187 r6455 50 50 t_corrFile::t_corrFile(QString fileName) { 51 51 expandEnvVar(fileName); 52 _file = new QFile(fileName); 53 _file->open(QIODevice::ReadOnly | QIODevice::Text); 54 _stream = new QTextStream(); 55 _stream->setDevice(_file); 56 _lastOrbCorr = 0; 57 _lastClkCorr = 0; 52 _stream.open(fileName.toAscii().data()); 58 53 } 59 54 … … 61 56 //////////////////////////////////////////////////////////////////////////// 62 57 t_corrFile::~t_corrFile() { 63 delete _stream;64 delete _file;65 58 } 66 59 … … 72 65 _clkCorr.clear(); 73 66 74 while (!stopRead(tt) && _stream->status() == QTextStream::Ok && !_stream->atEnd()) { 75 QString line = _stream->readLine().trimmed(); 76 if (line.isEmpty() || line[0] == '!') { 77 continue; 78 } 79 if (line[0] == 'O') { 80 delete _lastOrbCorr; _lastOrbCorr = new t_orbCorr(line.toAscii().data()); 81 } 82 else if (line[0] == 'C') { 83 delete _lastClkCorr; _lastClkCorr = new t_clkCorr(line.toAscii().data()); 84 } 67 while (!stopRead(tt) && _stream.good()) { 85 68 if (stopRead(tt)) { 86 69 break; … … 101 84 //////////////////////////////////////////////////////////////////////////// 102 85 bool t_corrFile::stopRead(const bncTime& tt) { 103 if (_lastOrbCorr) { 104 if (_lastOrbCorr->_time > tt) { 105 return true; 106 } 107 else { 108 _orbCorr.push_back(*_lastOrbCorr); 109 _corrIODs[QString(_lastOrbCorr->_prn.toString().c_str())] = _lastOrbCorr->_iod; 110 delete _lastOrbCorr; _lastOrbCorr = 0; 111 } 112 } 113 if (_lastClkCorr) { 114 if (_lastClkCorr->_time > tt) { 115 return true; 116 } 117 else { 118 _clkCorr.push_back(*_lastClkCorr); 119 _corrIODs[QString(_lastClkCorr->_prn.toString().c_str())] = _lastClkCorr->_iod; 120 delete _lastClkCorr; _lastClkCorr = 0; 121 } 122 } 123 return false; 86 return true; 124 87 } -
trunk/BNC/src/rinex/corrfile.h
r6183 r6455 26 26 #define CORRFILE_H 27 27 28 #include <fstream> 28 29 #include <QtCore> 29 30 #include "bncconst.h" … … 46 47 private: 47 48 bool stopRead(const bncTime& tt); 48 QFile* _file; 49 QTextStream* _stream; 49 std::fstream _stream; 50 50 QList<t_orbCorr> _orbCorr; 51 51 QList<t_clkCorr> _clkCorr; 52 t_orbCorr* _lastOrbCorr;53 t_clkCorr* _lastClkCorr;54 52 QMap<QString, int> _corrIODs; 55 53 }; -
trunk/BNC/src/satObs.cpp
r6453 r6455 6 6 7 7 using namespace std; 8 9 //10 ////////////////////////////////////////////////////////////////////////////11 t_clkCorr::t_clkCorr(const string& line) {12 reset();13 istringstream in(line);14 char ch; in >> ch; if (ch != 'C') return;15 int gpsw;16 double gpssec;17 in >> gpsw >> gpssec >> _prn >> _iod >> _dClk >> _dotDClk >> _dotDotDClk;18 _time.set(gpsw, gpssec);19 _dClk /= t_CST::c;20 _dotDClk /= t_CST::c;21 _dotDotDClk /= t_CST::c;22 }23 8 24 9 // … … 36 21 // 37 22 //////////////////////////////////////////////////////////////////////////// 38 string t_clkCorr::toLine() const { 39 ostringstream str; 40 str.setf(ios::showpoint | ios::fixed); 41 str << "C " << _time.gpsw() << ' ' << setprecision(2) << _time.gpssec() << ' ' 42 << _prn.toString() << ' ' << setw(3) << _iod << ' ' 43 << setw(10) << setprecision(4) << _dClk * t_CST::c << ' ' 44 << setw(10) << setprecision(4) << _dotDClk * t_CST::c << ' ' 45 << setw(10) << setprecision(4) << _dotDotDClk * t_CST::c << endl; 46 return str.str(); 23 void t_clkCorr::writeEpoch(std::ostream* out, const QList<t_clkCorr>& corrList) { 24 *out << "CLOCK CORRECTIONS: " << corrList.size() << endl; 47 25 } 48 26 49 27 // 50 28 //////////////////////////////////////////////////////////////////////////// 51 t_orbCorr::t_orbCorr(const string& line) { 52 reset(); 53 istringstream in(line); 54 char ch; in >> ch; if (ch != 'O') return; 55 int gpsw; 56 double gpssec; 57 in >> gpsw >> gpssec >> _prn >> _iod 58 >> _xr[0] >> _xr[1] >> _xr[2] 59 >> _dotXr[0] >> _dotXr[1] >> _dotXr[2]; 60 _time.set(gpsw, gpssec); 29 void t_clkCorr::readEpoch(std::istream* in, QList<t_clkCorr>& corrList) { 61 30 } 62 31 … … 74 43 // 75 44 //////////////////////////////////////////////////////////////////////////// 76 string t_orbCorr::toLine() const { 77 ostringstream str; 78 str.setf(ios::showpoint | ios::fixed); 79 str << "O " << _time.gpsw() << ' ' << setprecision(2) << _time.gpssec() << ' ' 80 << _prn.toString() << ' ' << setw(3) << _iod << ' ' 81 << setw(10) << setprecision(4) << _xr[0] << ' ' 82 << setw(10) << setprecision(4) << _xr[1] << ' ' 83 << setw(10) << setprecision(4) << _xr[2] << " " 84 << setw(10) << setprecision(4) << _dotXr[0] << ' ' 85 << setw(10) << setprecision(4) << _dotXr[1] << ' ' 86 << setw(10) << setprecision(4) << _dotXr[2] << endl; 87 return str.str(); 45 void t_orbCorr::writeEpoch(std::ostream* out, const QList<t_orbCorr>& corrList) { 46 *out << "ORB CORRECTIONS: " << corrList.size() << endl; 88 47 } 89 48 49 // 50 //////////////////////////////////////////////////////////////////////////// 51 void t_orbCorr::readEpoch(std::istream* in, QList<t_orbCorr>& corrList) { 52 } -
trunk/BNC/src/satObs.h
r6180 r6455 5 5 #include <vector> 6 6 #include <newmat.h> 7 8 #include <QtCore> 7 9 8 10 #include "bncconst.h" … … 60 62 public: 61 63 t_orbCorr() {reset();} 62 t_orbCorr(const std::string& line); 64 static void writeEpoch(std::ostream* out, const QList<t_orbCorr>& corrList); 65 static void readEpoch(std::istream* in, QList<t_orbCorr>& corrList); 63 66 void reset(); 64 67 t_prn prn() const {return _prn;} 65 68 unsigned short IOD() const {return _iod;} 66 std::string toLine() const;67 69 std::string _staID; 68 70 t_prn _prn; … … 77 79 public: 78 80 t_clkCorr() {reset();} 79 t_clkCorr(const std::string& line); 81 static void writeEpoch(std::ostream* out, const QList<t_clkCorr>& corrList); 82 static void readEpoch(std::istream* in, QList<t_clkCorr>& corrList); 80 83 void reset(); 81 84 t_prn prn() const {return _prn;} 82 85 unsigned short IOD() const {return _iod;} 83 std::string toLine() const;84 86 std::string _staID; 85 87 t_prn _prn;
Note:
See TracChangeset
for help on using the changeset viewer.