Changeset 3562 in ntrip
- Timestamp:
- Dec 25, 2011, 3:50:24 PM (13 years ago)
- Location:
- trunk/BNC
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/RTCM/RTCM2Decoder.cpp
r3257 r3562 65 65 66 66 RTCM2Decoder::~RTCM2Decoder() { 67 for (t_listMap::iterator ii = _ephList.begin(); ii != _ephList.end(); ii++) {68 delete ii->second;69 }70 67 } 71 68 … … 222 219 } 223 220 224 225 226 bool RTCM2Decoder::storeEph(const gpsephemeris& gpseph, string& storedPRN, vector<int>& IODs) {227 t_ephGPS eph; eph.set(&gpseph);228 229 return storeEph(eph, storedPRN, IODs);230 }231 232 233 bool RTCM2Decoder::storeEph(const t_ephGPS& gpseph, string& storedPRN, vector<int>& IODs) {234 t_ephGPS* eph = new t_ephGPS(gpseph);235 236 string prn = eph->prn().toAscii().data();237 238 t_listMap::iterator ip = _ephList.find(prn);239 if (ip == _ephList.end() ) {240 ip = _ephList.insert(pair<string, t_ephList*>(prn, new t_ephList)).first;241 }242 t_ephList* ephList = ip->second;243 244 bool stored = ephList->store(eph);245 246 if ( stored ) {247 storedPRN = string(eph->prn().toAscii().data());248 ephList->getIODs(IODs);249 return true;250 }251 252 delete eph;253 254 return false;255 }256 257 258 221 void RTCM2Decoder::translateCorr2Obs(vector<string>& errmsg) { 259 222 … … 298 261 // end test 299 262 300 301 ostringstream oPRN; oPRN.fill('0');302 303 oPRN << (corr->PRN < 200 ? 'G' : 'R')304 << setw(2) << (corr->PRN < 200 ? corr->PRN : corr->PRN - 200); 305 306 string PRN(oPRN.str());307 308 t_listMap::const_iterator ieph = _ephList.find(PRN);263 QString prn; 264 if (corr->PRN < 200) { 265 prn = 'G' + QString("%1").arg(corr->PRN, 2, 10, QChar('0')); 266 } 267 else { 268 prn = 'R' + QString("%1").arg(corr->PRN - 200, 2, 10, QChar('0')); 269 } 270 271 const t_ephPair* ePair = ephPair(prn); 309 272 310 273 double L1 = 0; … … 356 319 357 320 // Select corresponding ephemerides 358 if ( ieph != _ephList.end() ) { 359 eph = ieph->second->getEph(IODcorr); 321 if (ePair) { 322 if (ePair->last && ePair->last->IOD() == IODcorr) { 323 eph = ePair->last; 324 } 325 else if (ePair->prev && ePair->prev->IOD() == IODcorr) { 326 eph = ePair->prev; 327 } 360 328 } 361 329 … … 431 399 copy(missingIOD.begin(), missingIOD.end(), ostream_iterator<string>(missingIODstr, " ")); 432 400 433 errmsg.push_back("missing eph for " + PRN+ " , IODs " + missingIODstr.str());401 errmsg.push_back("missing eph for " + string(prn.toAscii().data()) + " , IODs " + missingIODstr.str()); 434 402 } 435 403 -
trunk/BNC/RTCM/RTCM2Decoder.h
r2492 r3562 35 35 #include "rtcm3torinex.h" 36 36 #include "ephemeris.h" 37 #include "bncephuser.h" 37 38 38 class RTCM2Decoder: public GPSDecoder {39 class RTCM2Decoder: public bncEphUser, public GPSDecoder { 39 40 40 41 public: … … 42 43 virtual ~RTCM2Decoder(); 43 44 virtual t_irc Decode(char* buffer, int bufLen, std::vector<std::string>& errmsg); 44 45 bool storeEph(const gpsephemeris& gpseph, std::string& storedPRN, std::vector<int>& IODs);46 bool storeEph(const t_ephGPS& gpseph, std::string& storedPRN, std::vector<int>& IODs);47 45 48 46 t_irc getStaCrd(double& xx, double& yy, double& zz); … … 57 55 58 56 private: 59 60 class t_ephList {61 public:62 t_ephList() {}63 64 ~t_ephList() {65 for (std::list<t_eph*>::iterator ii = _eph.begin(); ii != _eph.end(); ii++) {66 delete (*ii);67 }68 }69 70 bool store(t_eph* eph) {71 if ( _eph.size() == 0 ) {72 _eph.push_back(eph);73 return true;74 }75 76 std::list<t_eph*>::iterator ii = _eph.begin();77 while (ii != _eph.end()) {78 if ( eph->IOD() == (*ii)->IOD() ) {79 return false;80 }81 if ( ! eph->isNewerThan(*ii) ) {82 break;83 }84 ++ii;85 }86 87 if ( ii == _eph.begin() && _eph.size() == MAXSIZE) {88 return false;89 }90 91 _eph.insert(ii, eph);92 93 while ( _eph.size() > MAXSIZE ) {94 delete _eph.front();95 _eph.pop_front();96 }97 98 return true;99 }100 101 const t_eph* getEph(int IOD) const {102 for (std::list<t_eph*>::const_iterator ii = _eph.begin(); ii != _eph.end(); ii++) {103 if ( (*ii)->IOD() == IOD ) {104 return (*ii);105 }106 }107 return 0;108 }109 110 void getIODs(std::vector<int>& IODs) const {111 IODs.clear();112 for (std::list<t_eph*>::const_iterator ii = _eph.begin(); ii != _eph.end(); ii++) {113 IODs.push_back((*ii)->IOD());114 }115 }116 117 static const unsigned MAXSIZE = 5;118 119 std::list<t_eph*> _eph;120 };121 57 122 58 void translateCorr2Obs(std::vector<std::string>& errmsg); … … 136 72 rtcm2::RTCM2_24 _msg24; 137 73 rtcm2::RTCM2_2021 _msg2021; 138 std::map<std::string, t_ephList*> _ephList;139 140 typedef std::map<std::string, t_ephList*> t_listMap;141 74 }; 142 75 -
trunk/BNC/bnccaster.cpp
r3543 r3562 274 274 this, SLOT(slotNewNMEAstr(QByteArray))); 275 275 276 connect(((bncApp*)qApp), SIGNAL(newEphGPS(gpsephemeris)),277 getThread, SLOT(slotNewEphGPS(gpsephemeris)));278 279 276 _staIDs.push_back(getThread->staID()); 280 277 _threads.push_back(getThread); -
trunk/BNC/bncgetthread.cpp
r3561 r3562 771 771 } 772 772 } 773 774 //775 //////////////////////////////////////////////////////////////////////////////776 void bncGetThread::slotNewEphGPS(gpsephemeris gpseph) {777 QMutexLocker locker(&_mutex);778 779 if (!decoder()) {780 return;781 }782 783 RTCM2Decoder* decoder2 = dynamic_cast<RTCM2Decoder*>(decoder());784 RTCM3Decoder* decoder3 = dynamic_cast<RTCM3Decoder*>(decoder());785 786 if ( decoder2 ) {787 string storedPRN;788 vector<int> IODs;789 790 if ( decoder2->storeEph(gpseph, storedPRN, IODs) ) {791 #ifdef DEBUG_RTCM2_2021792 QString msg = _staID + QString(": stored eph %1 IODs").arg(storedPRN.c_str());793 794 for (unsigned ii = 0; ii < IODs.size(); ii++) {795 msg += QString(" %1").arg(IODs[ii],4);796 }797 798 emit(newMessage(msg.toAscii()));799 #endif800 }801 }802 803 if ( decoder3 ) {804 if ( decoder3->storeEph(gpseph) ) {805 #ifdef DEBUG_RTCM3806 QString msg = _staID + QString(": RTCM3Decoder, stored eph for satellite %1").arg(gpseph.satellite);807 emit(newMessage(msg.toAscii(),true));808 #endif809 }810 }811 }812 -
trunk/BNC/bncgetthread.h
r3561 r3562 89 89 virtual void run(); 90 90 91 public slots:92 void slotNewEphGPS(gpsephemeris gpseph);93 94 91 private slots: 95 92 void slotSerialReadyRead(); … … 124 121 QFile* _serialOutFile; 125 122 t_serialNMEA _serialNMEA; 126 QMutex _mutex;127 123 bncPPPclient* _PPPclient; 128 124 bool _rawOutput;
Note:
See TracChangeset
for help on using the changeset viewer.