Changeset 6141 in ntrip for trunk/BNC/src/pppRun.cpp


Ignore:
Timestamp:
Sep 13, 2014, 5:08:22 PM (10 years ago)
Author:
mervart
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/pppRun.cpp

    r6140 r6141  
    7575          BNC_CORE, SIGNAL(newNMEAstr(QByteArray, QByteArray)));
    7676
    77   for (unsigned iPrn = 0; iPrn <= t_prn::MAXPRN; iPrn++) {
    78     _lastOrbCorrIOD[iPrn]   = -1;
    79     _lastClkCorrValue[iPrn] = 0.0;
    80   }
    81 
    8277  _pppClient = new t_pppClient(_opt);
    8378
     
    10297            this, SLOT(slotNewEphGalileo(galileoephemeris)),conType);
    10398
    104     connect(BNC_CORE, SIGNAL(newCorrections(QStringList)),
    105             this, SLOT(slotNewCorrections(QStringList)),conType);
     99    connect(BNC_CORE, SIGNAL(newOrbCorrections(QList<t_orbCorr>)),
     100            this, SLOT(slotNewOrbCorrections(QList<t_orbCorr>)),conType);
     101
     102    connect(BNC_CORE, SIGNAL(newClkCorrections(QList<t_clkCorr>)),
     103            this, SLOT(slotNewClkCorrections(QList<t_clkCorr>)),conType);
    106104  }
    107105  else {
     
    230228  // Process the oldest epochs
    231229  // ------------------------
     230  cout << "epoData " << _epoData.size() << endl;
     231
    232232  while (_epoData.size() && !waitForCorr(_epoData.front()->_time)) {
    233233
    234234    const vector<t_satObs*>& satObs = _epoData.front()->_satObs;
     235
     236    cout << "satObs " << satObs.size() << endl;
    235237
    236238    t_output output;
     
    287289//
    288290////////////////////////////////////////////////////////////////////////////
    289 void t_pppRun::slotNewCorrections(QStringList corrList) {
    290   QMutexLocker locker(&_mutex);
    291 
    292   // Check the Mountpoint (source of corrections)
    293   // --------------------------------------------
     291void t_pppRun::slotNewOrbCorrections(QList<t_orbCorr> orbCorr) {
     292  if (orbCorr.size() == 0) {
     293    return;
     294  }
     295
    294296  if (_opt->_realTime) {
    295     if (_opt->_corrMount.empty()) {
     297    if (_opt->_corrMount.empty() || _opt->_corrMount != orbCorr[0]._staID) {
    296298      return;
    297299    }
    298     QMutableListIterator<QString> itm(corrList);
    299     while (itm.hasNext()) {
    300       QStringList hlp = itm.next().split(" ");
    301       if (hlp.size() > 0) {
    302         QString mountpoint = hlp[hlp.size()-1];
    303         if (mountpoint != QString(_opt->_corrMount.c_str())) {
    304           itm.remove();     
    305         }
    306       }
    307     }
    308   }
    309 
    310   if (corrList.size() == 0) {
     300  }
     301  vector<t_orbCorr*> corrections;
     302  for (int ii = 0; ii < orbCorr.size(); ii++) {
     303    corrections.push_back(new t_orbCorr(orbCorr[ii]));
     304    _lastClkCorrTime = orbCorr[ii]._time;
     305  }
     306
     307  _pppClient->putOrbCorrections(corrections);
     308}
     309
     310//
     311////////////////////////////////////////////////////////////////////////////
     312void t_pppRun::slotNewClkCorrections(QList<t_clkCorr> clkCorr) {
     313  if (clkCorr.size() == 0) {
    311314    return;
    312315  }
    313316
    314   vector<t_orbCorr*> orbCorr;
    315   vector<t_clkCorr*> clkCorr;
    316   vector<t_satBias*> satBias;
    317 
    318   QListIterator<QString> it(corrList);
    319   while (it.hasNext()) {
    320     QString line = it.next();
    321 
    322     QTextStream in(&line);
    323     int     messageType;
    324     int     updateInterval;
    325     int     GPSweek;
    326     double  GPSweeks;
    327     QString prn;
    328     in >> messageType >> updateInterval >> GPSweek >> GPSweeks >> prn;
    329 
    330     if ( t_corr::relevantMessageType(messageType) ) {
    331       t_corr corr;
    332       corr.readLine(line);
    333       if      (messageType == COTYPE_GPSCOMBINED || messageType == COTYPE_GLONASSCOMBINED ||
    334                messageType == COTYPE_GPSORBIT    || messageType == COTYPE_GLONASSORBIT    ) {
    335         t_orbCorr* cc = new t_orbCorr();
    336         cc->_prn.set(corr.prn.toAscii().data());
    337         cc->_iod       = corr.iod;
    338         cc->_time      = corr.tRao;
    339         cc->_system    = 'R';
    340         cc->_xr[0]     = corr.rao[0];
    341         cc->_xr[1]     = corr.rao[1];
    342         cc->_xr[2]     = corr.rao[2];
    343         cc->_dotXr[0]  = corr.dotRao[0];
    344         cc->_dotXr[0]  = corr.dotRao[1];
    345         cc->_dotXr[0]  = corr.dotRao[2];
    346         orbCorr.push_back(cc);
    347 
    348         _lastOrbCorrIOD[cc->_prn.toInt()] = cc->_iod;
    349       }
    350       else if (messageType == COTYPE_GPSCOMBINED || messageType == COTYPE_GLONASSCOMBINED ||
    351                messageType == COTYPE_GPSCLOCK    || messageType == COTYPE_GLONASSCLOCK    ) {
    352         t_clkCorr* cc = new t_clkCorr();
    353         cc->_prn.set(corr.prn.toAscii().data());
    354         cc->_iod         = corr.iod;
    355         cc->_time        = corr.tClk;
    356         cc->_dClk        = corr.dClk;
    357         cc->_dotDClk     = corr.dotDClk;
    358         cc->_dotDotDClk  = corr.dotDotDClk;
    359         cc->_clkPartial  = 0.0;
    360         if (messageType == COTYPE_GPSCLOCK || messageType == COTYPE_GLONASSCLOCK) {
    361           int lastIOD = _lastOrbCorrIOD[cc->_prn.toInt()];
    362           if (lastIOD != -1) {
    363             cc->_iod = lastIOD;
    364           }
    365           else {
    366             delete cc;
    367             cc = 0;
    368           }
    369         }
    370         if (cc) {
    371           clkCorr.push_back(cc);
    372           _lastClkCorrValue[cc->_prn.toInt()] = cc->_dClk;
    373           if (_lastClkCorrTime.undef() || cc->_time > _lastClkCorrTime) {
    374             _lastClkCorrTime = cc->_time;
    375           }
    376         }
    377       }
    378     }
    379     else if ( messageType == BTYPE_GPS || messageType == BTYPE_GLONASS ) {
    380     }
    381   }
    382 
    383   _pppClient->putOrbCorrections(orbCorr);
    384   _pppClient->putClkCorrections(clkCorr);
    385   _pppClient->putBiases(satBias);   
    386 
    387   for (unsigned ii = 0; ii < orbCorr.size(); ii++) {
    388     delete orbCorr[ii];
    389   }
    390   for (unsigned ii = 0; ii < clkCorr.size(); ii++) {
    391     delete clkCorr[ii];
    392   }
    393   for (unsigned ii = 0; ii < satBias.size(); ii++) {
    394     delete satBias[ii];
    395   }
    396 }
    397 
     317  if (_opt->_realTime) {
     318    if (_opt->_corrMount.empty() || _opt->_corrMount != clkCorr[0]._staID) {
     319      return;
     320    }
     321  }
     322  vector<t_clkCorr*> corrections;
     323  for (int ii = 0; ii < clkCorr.size(); ii++) {
     324    corrections.push_back(new t_clkCorr(clkCorr[ii]));
     325  }
     326
     327  _pppClient->putClkCorrections(corrections);
     328}
    398329
    399330//
Note: See TracChangeset for help on using the changeset viewer.