Changeset 5791 in ntrip


Ignore:
Timestamp:
Aug 4, 2014, 4:22:50 PM (10 years ago)
Author:
mervart
Message:
 
Location:
trunk/BNC/src/PPP
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/PPP/pppThread.cpp

    r5790 r5791  
    162162  QMutexLocker locker(&_mutex);
    163163
     164  cout << endl << "slotNewObs " << staID.data() << ' ' << obsList.size() << endl;
     165
    164166  if (string(staID.data()) != _opt->_roverName) {
    165167    return;
    166168  }
    167169
    168   cout << endl << "slotNewObs " << obsList.size() << endl;
    169 
    170   vector<t_pppSatObs*> pppSatObs;
     170  // Loop over all obsevations (possible different epochs)
     171  // -----------------------------------------------------
    171172  QListIterator<t_obs> it(obsList);
    172173  while (it.hasNext()) {
     
    177178    newObs->_time.set(oldObs.GPSWeek, oldObs.GPSWeeks);
    178179
    179     cout << newObs->_prn.toString() << ' ' << string(newObs->_time) << endl;
    180 
    181     map<string, t_pppObs*> pppObsMap;
    182     for (unsigned iEntry = 0; iEntry < GNSSENTRY_NUMBER; iEntry++) {
    183       string hlp(oldObs.rnxStr(iEntry).toAscii().data());
    184       if (hlp.length() == 3) {
    185         char   obsType    = hlp[0];
    186         string rnxType2ch = hlp.substr(1);
    187         if (obsType == 'C' || obsType == 'L') {
    188           t_pppObs* pppObs = 0;
    189           if (pppObsMap.find(rnxType2ch) == pppObsMap.end()) {
    190             pppObs                = new t_pppObs();
    191             pppObsMap[rnxType2ch] = pppObs;
    192             pppObs->_rnxType2ch   = rnxType2ch;
    193             newObs->_obs.push_back(pppObs);
    194           }
    195           else {
    196             pppObs = pppObsMap[rnxType2ch];
    197           }
    198           if      (obsType == 'C') {
    199             pppObs->_code      = oldObs._measdata[iEntry];
    200             pppObs->_codeValid = true;
    201           }
    202           else if (obsType == 'L') {
    203             pppObs->_phase      = oldObs._measdata[iEntry];
    204             pppObs->_phaseValid = true;
     180    // Find the corresponding data epoch or create a new one
     181    // -----------------------------------------------------
     182    t_pppEpoData* epoData = 0;
     183    deque<t_pppEpoData*>::const_iterator it;
     184    for (it = _pppEpochs.begin(); it != _pppEpochs.end(); it++) {
     185      if (newObs->_time == (*it)->_time) {
     186        epoData = *it;
     187        break;
     188      }
     189    }
     190    if (epoData == 0) {
     191      if (newObs->_time > _pppEpochs.back()->_time) {
     192        epoData = new t_pppEpoData;
     193        epoData->_time = newObs->_time;
     194        _pppEpochs.push_back(epoData);
     195      }
     196    }
     197
     198    // Fill the new observation and add it to the corresponding epoch
     199    // --------------------------------------------------------------
     200    if (epoData != 0) {
     201      epoData->_pppSatObs.push_back(newObs);
     202      map<string, t_pppObs*> pppObsMap;
     203      for (unsigned iEntry = 0; iEntry < GNSSENTRY_NUMBER; iEntry++) {
     204        string hlp(oldObs.rnxStr(iEntry).toAscii().data());
     205        if (hlp.length() == 3) {
     206          char   obsType    = hlp[0];
     207          string rnxType2ch = hlp.substr(1);
     208          if (obsType == 'C' || obsType == 'L') {
     209            t_pppObs* pppObs = 0;
     210            if (pppObsMap.find(rnxType2ch) == pppObsMap.end()) {
     211              pppObs                = new t_pppObs();
     212              pppObsMap[rnxType2ch] = pppObs;
     213              pppObs->_rnxType2ch   = rnxType2ch;
     214              newObs->_obs.push_back(pppObs);
     215            }
     216            else {
     217              pppObs = pppObsMap[rnxType2ch];
     218            }
     219            if      (obsType == 'C') {
     220              pppObs->_code      = oldObs._measdata[iEntry];
     221              pppObs->_codeValid = true;
     222            }
     223            else if (obsType == 'L') {
     224              pppObs->_phase      = oldObs._measdata[iEntry];
     225              pppObs->_phaseValid = true;
     226            }
    205227          }
    206228        }
    207229      }
    208230    }
    209 
    210     pppSatObs.push_back(newObs);
    211   }
    212 
    213   t_output output;
    214   _pppClient->processEpoch(pppSatObs, &output);
    215 
    216   for (unsigned ii = 0; ii < pppSatObs.size(); ii++) {
    217     delete pppSatObs[ii];
    218   }
    219   pppSatObs.clear();
    220 
    221   emit newMessage(QByteArray(output._log.c_str()), true);
    222 }
     231  }
     232
     233  // Process the oldest epoch
     234  // ------------------------
     235  if (_pppEpochs.size() > 1) {
     236
     237    const vector<t_pppSatObs*>& pppSatObs = _pppEpochs.front()->_pppSatObs;
     238
     239    t_output output;
     240    _pppClient->processEpoch(pppSatObs, &output);
     241
     242    delete _pppEpochs.front(); _pppEpochs.pop_front();
    223243   
     244    emit newMessage(QByteArray(output._log.c_str()), true);
     245  }
     246}
     247   
  • trunk/BNC/src/PPP/pppThread.h

    r5775 r5791  
    22#define PPPTHREAD_H
    33
     4#include <deque>
    45#include <vector>
    56#include <QtCore>
     
    1011
    1112namespace BNC {
     13
     14class t_pppEpoData {
     15 public:
     16  t_pppEpoData() {}
     17  ~t_pppEpoData() {
     18    for (unsigned ii = 0; ii < _pppSatObs.size(); ii++) {
     19      delete _pppSatObs[ii];
     20    }
     21  }
     22  bncTime                   _time;
     23  std::vector<t_pppSatObs*> _pppSatObs;
     24};
    1225
    1326class t_pppRun : public QObject {
     
    2841
    2942 private:
    30   QMutex           _mutex;
    31   const t_options* _opt;
    32   t_pppClient*     _pppClient;
     43  QMutex                    _mutex;
     44  const t_options*          _opt;
     45  t_pppClient*              _pppClient;
     46  std::deque<t_pppEpoData*> _pppEpochs;
    3347};
    3448
Note: See TracChangeset for help on using the changeset viewer.