Changeset 6443 in ntrip for trunk/BNC/src
- Timestamp:
- Dec 26, 2014, 12:47:27 PM (10 years ago)
- Location:
- trunk/BNC/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/RTCM/RTCM2Decoder.cpp
r6442 r6443 55 55 // 56 56 57 RTCM2Decoder::RTCM2Decoder(const std::string& ID) : bncEphUser(true) {57 RTCM2Decoder::RTCM2Decoder(const std::string& ID) : _ephUser(true) { 58 58 _ID = ID; 59 59 } … … 352 352 353 353 // Select corresponding ephemerides 354 if (ephLast(prn) && ephLast(prn)->IOD() == IODcorr) { 355 eph = ephLast(prn); 356 } 357 else if (ephPrev(prn) && ephPrev(prn)->IOD() == IODcorr) { 358 eph = ephPrev(prn); 354 const t_eph* ephLast = _ephUser.ephLast(prn); 355 const t_eph* ephPrev = _ephUser.ephPrev(prn); 356 if (ephLast && ephLast->IOD() == IODcorr) { 357 eph = ephLast; 358 } 359 else if (ephPrev && ephPrev->IOD() == IODcorr) { 360 eph = ephPrev; 359 361 } 360 362 -
trunk/BNC/src/RTCM/RTCM2Decoder.h
r6139 r6443 36 36 #include "bncephuser.h" 37 37 38 class RTCM2Decoder: public bncEphUser, publicGPSDecoder {38 class RTCM2Decoder: public GPSDecoder { 39 39 40 40 public: … … 57 57 void translateCorr2Obs(std::vector<std::string>& errmsg); 58 58 59 std::string _ID;60 61 std::string 62 rtcm2::RTCM2packet 59 QMutex _mutex; 60 std::string _ID; 61 std::string _buffer; 62 rtcm2::RTCM2packet _PP; 63 63 64 64 // for messages 18, 19 decoding 65 rtcm2::RTCM2_Obs 65 rtcm2::RTCM2_Obs _ObsBlock; 66 66 67 67 // for messages 20, 21 decoding 68 rtcm2::RTCM2_03 _msg03; 69 rtcm2::RTCM2_22 _msg22; 70 rtcm2::RTCM2_23 _msg23; 71 rtcm2::RTCM2_24 _msg24; 72 rtcm2::RTCM2_2021 _msg2021; 68 rtcm2::RTCM2_03 _msg03; 69 rtcm2::RTCM2_22 _msg22; 70 rtcm2::RTCM2_23 _msg23; 71 rtcm2::RTCM2_24 _msg24; 72 rtcm2::RTCM2_2021 _msg2021; 73 bncEphUser _ephUser; 73 74 }; 74 75 -
trunk/BNC/src/bncephuser.cpp
r6441 r6443 67 67 //////////////////////////////////////////////////////////////////////////// 68 68 bncEphUser::~bncEphUser() { 69 QMapIterator<QString, t_ephPair*> it(_eph);69 QMapIterator<QString, deque<t_eph*> > it(_eph); 70 70 while (it.hasNext()) { 71 71 it.next(); 72 delete it.value(); 72 const deque<t_eph*>& qq = it.value(); 73 for (unsigned ii = 0; ii < qq.size(); ii++) { 74 delete qq[ii]; 75 } 73 76 } 74 77 } … … 137 140 QString prn(newEph->prn().toString().c_str()); 138 141 139 if (_eph.contains(prn)) { 140 if (newEph->isNewerThan(_eph.value(prn)->last)) { 141 delete _eph.value(prn)->prev; 142 _eph.value(prn)->prev = _eph.value(prn)->last; 143 _eph.value(prn)->last = newEph; 144 ephBufferChanged(); 145 return success; 142 const t_eph* ephOld = ephLast(prn); 143 144 if (ephOld == 0 || newEph->isNewerThan(ephOld)) { 145 deque<t_eph*>& qq = _eph[prn]; 146 qq.push_back(newEph); 147 if (qq.size() > _maxQueueSize) { 148 delete qq.front(); 149 qq.pop_front(); 146 150 } 147 }148 else {149 _eph.insert(prn, new t_ephPair(newEph));150 151 ephBufferChanged(); 151 152 return success; 152 153 } 153 154 return failure; 154 else { 155 return failure; 156 } 155 157 } 156 158 -
trunk/BNC/src/bncephuser.h
r6442 r6443 26 26 #define BNCEPHUSER_H 27 27 28 #include <deque> 28 29 #include <QtCore> 29 30 #include <newmat.h> … … 32 33 #include "bnctime.h" 33 34 #include "ephemeris.h" 34 35 extern "C" {36 # include "clock_orbit_rtcm.h"37 }38 35 39 36 class bncEphUser : public QObject { … … 54 51 const t_eph* ephLast(const QString& prn) { 55 52 if (_eph.contains(prn)) { 56 return _eph[prn] ->last;53 return _eph[prn].back(); 57 54 } 58 55 return 0; … … 61 58 const t_eph* ephPrev(const QString& prn) { 62 59 if (_eph.contains(prn)) { 63 return _eph[prn]->prev; 60 unsigned nn = _eph[prn].size(); 61 if (nn > 1) { 62 return _eph[prn].at(nn-2); 63 } 64 64 } 65 65 return 0; 66 66 } 67 67 68 const QList<QString> prnList() {return _eph.keys();} 69 68 70 protected: 69 71 virtual void ephBufferChanged() {} 70 72 71 class t_ephPair { 72 public: 73 t_ephPair(t_eph* lastEph) { 74 last = lastEph; 75 prev = 0; 76 } 77 ~t_ephPair() { 78 delete last; 79 delete prev; 80 } 81 t_eph* last; 82 t_eph* prev; 83 }; 84 85 QMutex _mutex; 86 QMap<QString, t_ephPair*> _eph; 73 private: 74 QMutex _mutex; 75 static const unsigned _maxQueueSize = 5; 76 QMap<QString, std::deque<t_eph*> > _eph; 87 77 }; 88 78 -
trunk/BNC/src/combination/bnccomb.cpp
r6330 r6443 127 127 // Constructor 128 128 //////////////////////////////////////////////////////////////////////////// 129 bncComb::bncComb() : bncEphUser(true) {129 bncComb::bncComb() : _ephUser(true) { 130 130 131 131 bncSettings settings; … … 382 382 // Check the Ephemeris 383 383 //-------------------- 384 if (_eph.find(prn) == _eph.end()) { 384 const t_eph* ephLast = _ephUser.ephLast(prn); 385 const t_eph* ephPrev = _ephUser.ephPrev(prn); 386 if (ephLast == 0) { 385 387 emit newMessage("bncComb: eph not found " + prn.toAscii(), true); 386 388 delete newCorr; … … 388 390 } 389 391 else { 390 t_eph* lastEph = _eph[prn]->last; 391 t_eph* prevEph = _eph[prn]->prev; 392 if (lastEph && lastEph->IOD() == newCorr->_iod) { 393 newCorr->_eph = lastEph; 394 } 395 else if (lastEph && prevEph && prevEph->IOD() == newCorr->_iod) { 396 newCorr->_eph = prevEph; 397 switchToLastEph(lastEph, newCorr); 392 if (ephLast->IOD() == newCorr->_iod) { 393 newCorr->_eph = ephLast; 394 } 395 else if (ephPrev && ephPrev->IOD() == newCorr->_iod) { 396 newCorr->_eph = ephPrev; 397 switchToLastEph(ephLast, newCorr); 398 398 } 399 399 else { … … 1051 1051 cmbCorr* corr = im.next(); 1052 1052 QString prn = corr->_prn; 1053 if (_eph.find(prn) == _eph.end()) { 1053 1054 const t_eph* ephLast = _ephUser.ephLast(prn); 1055 const t_eph* ephPrev = _ephUser.ephPrev(prn); 1056 1057 if (ephLast == 0) { 1054 1058 out << "checkOrbit: missing eph (not found) " << corr->_prn << endl; 1055 1059 delete corr; … … 1062 1066 } 1063 1067 else { 1064 if ( corr->_eph == _eph[prn]->last || corr->_eph == _eph[prn]->prev ) {1065 switchToLastEph( _eph[prn]->last, corr);1068 if ( corr->_eph == ephLast || corr->_eph == ephPrev ) { 1069 switchToLastEph(ephLast, corr); 1066 1070 } 1067 1071 else { -
trunk/BNC/src/combination/bnccomb.h
r6160 r6443 12 12 class bncAntex; 13 13 14 class bncComb : public bncEphUser{14 class bncComb : public QObject { 15 15 Q_OBJECT 16 16 public: … … 108 108 QVector<cmbCorr*>& corrs() {return _buffer[_resTime].corrs;} 109 109 110 QMutex _mutex; 110 111 QList<cmbAC*> _ACs; 111 112 bncTime _resTime; … … 123 124 int _cmbSampl; 124 125 QMap<QString, QMap<t_prn, t_orbCorr> > _orbCorrections; 126 bncEphUser _ephUser; 125 127 }; 126 128 -
trunk/BNC/src/upload/bncephuploadcaster.cpp
r6441 r6443 61 61 if (_ephUploadCaster) { 62 62 QByteArray outBuffer; 63 QMapIterator<QString, t_ephPair*> it(_eph); 63 64 QListIterator<QString> it(prnList()); 64 65 while (it.hasNext()) { 65 it.next();66 const t_eph* eph = ephLast(it.next()); 66 67 67 t_eph* eph = it.value()->last; 68 const t_ephGPS* ephGPS = dynamic_cast<const t_ephGPS*>(eph); 69 const t_ephGlo* ephGlo = dynamic_cast<const t_ephGlo*>(eph); 70 const t_ephGal* ephGal = dynamic_cast<const t_ephGal*>(eph); 71 const t_ephSBAS* ephSBAS = dynamic_cast<const t_ephSBAS*>(eph); 72 const t_ephCompass* ephCompass = dynamic_cast<const t_ephCompass*>(eph); 73 68 74 unsigned char Array[80]; 69 75 int size = 0; 70 t_ephGPS* ephGPS = dynamic_cast<t_ephGPS*>(eph); 71 t_ephGlo* ephGlo = dynamic_cast<t_ephGlo*>(eph); 72 t_ephGal* ephGal = dynamic_cast<t_ephGal*>(eph); 73 t_ephSBAS* ephSBAS = dynamic_cast<t_ephSBAS*>(eph); 74 t_ephCompass* ephCompass = dynamic_cast<t_ephCompass*>(eph); 76 75 77 if (ephGPS) { 76 78 size = t_ephEncoder::RTCM3(*ephGPS, Array);
Note:
See TracChangeset
for help on using the changeset viewer.