Changeset 5525 in ntrip


Ignore:
Timestamp:
Nov 6, 2013, 2:05:14 PM (11 years ago)
Author:
mervart
Message:
 
Location:
trunk/BNC/src/RTRover
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/RTRover/bncrtrover.cpp

    r5493 r5525  
    396396//
    397397////////////////////////////////////////////////////////////////////////////
    398 void t_bncRtrover::slotNewObs(QByteArray staID, bool /* firstObs */, t_obs obsIn) {
     398void t_bncRtrover::slotNewObs(QByteArray staID, QList<t_obs> obsList) {
    399399  QMutexLocker locker(&_mutex);
    400400
     
    403403  }
    404404
    405   bncTime obsTime(obsIn.GPSWeek, obsIn.GPSWeeks);
    406 
    407   // Find corresponding epoch or create a new one
    408   // --------------------------------------------
    409   t_epoData* epoData = 0;
    410   for (unsigned ii = 0; ii < _epochs.size(); ii++) {
    411     if (_epochs[ii]->_time == obsTime) {
    412       epoData = _epochs[ii];
    413       break;
    414     }
    415   }
    416   if (epoData == 0) {
    417     if (_epochs.size() == 0 || _epochs.back()->_time < obsTime) {
    418       epoData = new t_epoData();
    419       epoData->_time = obsTime;
    420       _epochs.push_back(epoData);
    421     }
    422     else {
     405  QListIterator<t_obs> it(obsList);
     406  while (it.hasNext()) {
     407
     408    const t_obs& obsIn = it.next();
     409
     410    bncTime obsTime(obsIn.GPSWeek, obsIn.GPSWeeks);
     411   
     412    // Find corresponding epoch or create a new one
     413    // --------------------------------------------
     414    t_epoData* epoData = 0;
     415    for (unsigned ii = 0; ii < _epochs.size(); ii++) {
     416      if (_epochs[ii]->_time == obsTime) {
     417        epoData = _epochs[ii];
     418        break;
     419      }
     420    }
     421    if (epoData == 0) {
     422      if (_epochs.size() == 0 || _epochs.back()->_time < obsTime) {
     423        epoData = new t_epoData();
     424        epoData->_time = obsTime;
     425        _epochs.push_back(epoData);
     426      }
     427      else {
     428        return;
     429      }
     430    }
     431   
     432    // Store observation into epoch class
     433    // ----------------------------------
     434    if      (staID == _roverMount) {
     435      epoData->_obsRover.push_back(obsIn);
     436    }
     437    else if (staID == _baseMount) {
     438      epoData->_obsBase.push_back(obsIn);
     439    }
     440   
     441    // Wait for observations
     442    // ---------------------
     443    const double WAITTIME = 5.0;
     444    double dt = 0.0;
     445    if (_epochs.size() > 1) {
     446      dt = _epochs.back()->_time - _epochs.front()->_time;
     447    }
     448    if (dt < WAITTIME) {
    423449      return;
    424     }
    425   }
    426 
    427   // Store observation into epoch class
    428   // ----------------------------------
    429   if      (staID == _roverMount) {
    430     epoData->_obsRover.push_back(obsIn);
    431   }
    432   else if (staID == _baseMount) {
    433     epoData->_obsBase.push_back(obsIn);
    434   }
    435 
    436   // Wait for observations
    437   // ---------------------
    438   const double WAITTIME = 5.0;
    439   double dt = 0.0;
    440   if (_epochs.size() > 1) {
    441     dt = _epochs.back()->_time - _epochs.front()->_time;
    442   }
    443   if (dt < WAITTIME) {
    444     return;
    445   }
    446 
    447   // Copy observations into rtrover_satObs structures
    448   // ------------------------------------------------
    449   t_epoData* frontEpoData = _epochs.front();
    450   _epochs.erase(_epochs.begin());
    451 
    452   int numSatRover = frontEpoData->_obsRover.size();
    453   rtrover_satObs satObsRover[numSatRover];
    454   for (int ii = 0; ii < numSatRover; ii++) {
    455     const t_obs& obsBnc = frontEpoData->_obsRover[ii];
    456     rtrover_satObs& satObs = satObsRover[ii];
    457     copyObs(obsBnc, satObs);
    458   }
    459 
    460   int numSatBase = frontEpoData->_obsBase.size();
    461   rtrover_satObs satObsBase[numSatBase];
    462   for (int ii = 0; ii < numSatBase; ii++) {
    463     const t_obs& obsBnc = frontEpoData->_obsBase[ii];
    464     rtrover_satObs& satObs = satObsBase[ii];
    465     copyObs(obsBnc, satObs);
    466   }
    467 
    468   delete frontEpoData;
    469 
    470   // Process single epoch
    471   // --------------------
    472   rtrover_output output;
    473   rtrover_processEpoch(numSatRover, satObsRover, numSatBase, satObsBase, &output);
    474 
    475   // Write output
    476   // ---------------------
    477   _outputFile.write(output._log);
    478   _outputFile.flush();
    479 
    480   // Free memory
    481   // -----------
    482   rtrover_freeOutput(&output);
    483   for (int ii = 0; ii < numSatRover; ii++) {
    484     rtrover_satObs& satObs = satObsRover[ii];
    485     delete [] satObs._obs;
    486   }
    487   for (int ii = 0; ii < numSatBase; ii++) {
    488     rtrover_satObs& satObs = satObsBase[ii];
    489     delete [] satObs._obs;
    490   }
    491 }
     450    }
     451   
     452    // Copy observations into rtrover_satObs structures
     453    // ------------------------------------------------
     454    t_epoData* frontEpoData = _epochs.front();
     455    _epochs.erase(_epochs.begin());
     456   
     457    int numSatRover = frontEpoData->_obsRover.size();
     458    rtrover_satObs satObsRover[numSatRover];
     459    for (int ii = 0; ii < numSatRover; ii++) {
     460      const t_obs& obsBnc = frontEpoData->_obsRover[ii];
     461      rtrover_satObs& satObs = satObsRover[ii];
     462      copyObs(obsBnc, satObs);
     463    }
     464   
     465    int numSatBase = frontEpoData->_obsBase.size();
     466    rtrover_satObs satObsBase[numSatBase];
     467    for (int ii = 0; ii < numSatBase; ii++) {
     468      const t_obs& obsBnc = frontEpoData->_obsBase[ii];
     469      rtrover_satObs& satObs = satObsBase[ii];
     470      copyObs(obsBnc, satObs);
     471    }
     472   
     473    delete frontEpoData;
     474   
     475    // Process single epoch
     476    // --------------------
     477    rtrover_output output;
     478    rtrover_processEpoch(numSatRover, satObsRover, numSatBase, satObsBase, &output);
     479   
     480    // Write output
     481    // ---------------------
     482    _outputFile.write(output._log);
     483    _outputFile.flush();
     484   
     485    // Free memory
     486    // -----------
     487    rtrover_freeOutput(&output);
     488    for (int ii = 0; ii < numSatRover; ii++) {
     489      rtrover_satObs& satObs = satObsRover[ii];
     490      delete [] satObs._obs;
     491    }
     492    for (int ii = 0; ii < numSatBase; ii++) {
     493      rtrover_satObs& satObs = satObsBase[ii];
     494      delete [] satObs._obs;
     495    }
     496  }
     497}
  • trunk/BNC/src/RTRover/bncrtrover.h

    r4800 r5525  
    2020  void slotNewEphGalileo(galileoephemeris galeph);
    2121  void slotNewCorrections(QList<QString> corrList);
    22   void slotNewObs(QByteArray staID, bool firstObs, t_obs obs);
     22  void slotNewObs(QByteArray staID, QList<t_obs> obsList);
    2323
    2424 private:
Note: See TracChangeset for help on using the changeset viewer.