Changeset 3209 in ntrip


Ignore:
Timestamp:
Mar 30, 2011, 8:39:39 PM (13 years ago)
Author:
mervart
Message:
 
Location:
trunk/BNC
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/bncephuser.h

    r3182 r3209  
    9292  };
    9393
     94  const t_ephPair* ephPair(const QString& prn) {
     95    if (_eph.contains(prn)) {
     96      return _eph[prn];
     97    }
     98    else {
     99      return 0;
     100    }
     101  }
    94102
    95103 public slots:
  • trunk/BNC/upload/bncrtnetdecoder.cpp

    r3207 r3209  
    4141#include <iostream>
    4242#include "bncrtnetdecoder.h"
    43 #include "bncutils.h"
    4443#include "bncsettings.h"
    4544
     
    7978////////////////////////////////////////////////////////////////////////
    8079t_irc bncRtnetDecoder::Decode(char* buffer, int bufLen, vector<string>& errmsg) {
    81   QMutexLocker locker(&_mutex);
    8280  errmsg.clear();
    8381  for (int ic = 0; ic < _casters.size(); ic++) {
    84     _casters[ic]->decodeRtnetStream(buffer, bufLen, _eph);
     82    _casters[ic]->decodeRtnetStream(buffer, bufLen);
    8583  }
    8684  return success;
  • trunk/BNC/upload/bncrtnetdecoder.h

    r3206 r3209  
    2828#include <fstream>
    2929#include <QtCore>
    30 #include "bncephuser.h"
    31 #include "bnctime.h"
    3230#include "bncuploadcaster.h"
    3331#include "RTCM/GPSDecoder.h"
    3432
    35 class bncRtnetDecoder: public GPSDecoder, public bncEphUser {
     33class bncRtnetDecoder: public GPSDecoder {
    3634 public:
    3735  bncRtnetDecoder();
  • trunk/BNC/upload/bncuploadcaster.cpp

    r3208 r3209  
    182182    _t0  = settings.value("trafo_t0").toDouble();
    183183  }
    184  
    185   // Deep copy of ephemerides
    186   // ------------------------
    187   _ephMap = 0;
     184
     185  // Member that receives the ephemeris
     186  // ----------------------------------
     187  _ephUser = new bncEphUser();
    188188}
    189189
     
    204204    wait();
    205205  }
    206   if (_ephMap) {
    207     QMapIterator<QString, t_eph*> it(*_ephMap);
    208     while (it.hasNext()) {
    209       it.next();
    210       t_eph* eph = it.value();
    211       delete eph;
    212     }
    213     delete _ephMap;
    214   }
    215206  delete _outFile;
    216207  delete _rnx;
    217208  delete _sp3;
     209  delete _ephUser;
    218210}
    219211
     
    306298//
    307299////////////////////////////////////////////////////////////////////////////
    308 void bncUploadCaster::decodeRtnetStream(char* buffer, int bufLen,
    309                       const QMap<QString, bncEphUser::t_ephPair*>& ephPairMap) {
     300void bncUploadCaster::decodeRtnetStream(char* buffer, int bufLen) {
    310301                                       
    311302  QMutexLocker locker(&_mutex);
    312 
    313   // Delete old ephemeris
    314   // --------------------
    315   if (_ephMap) {
    316     QMapIterator<QString, t_eph*> it(*_ephMap);
    317     while (it.hasNext()) {
    318       it.next();
    319       t_eph* eph = it.value();
    320       delete eph;
    321     }
    322     delete _ephMap;
    323   }
    324   _ephMap = new QMap<QString, t_eph*>;
    325 
    326   // Make a deep copy of ephemeris
    327   // -----------------------------
    328   QMapIterator<QString, bncEphUser::t_ephPair*> it(ephPairMap);
    329   while (it.hasNext()) {
    330     it.next();
    331     bncEphUser::t_ephPair* pair = it.value();
    332     t_eph* ep = pair->last;
    333     if (pair->prev && ep &&
    334         ep->receptDateTime().secsTo(QDateTime::currentDateTime()) < 60) {
    335       ep = pair->prev;
    336     }
    337     QString prn(ep->prn().c_str());
    338     if      (prn[0] == 'G') {
    339       t_ephGPS* epGPS = static_cast<t_ephGPS*>(ep);
    340       (*_ephMap)[prn] = new t_ephGPS(*epGPS);
    341     }
    342     else if (prn[0] == 'R') {
    343       t_ephGlo* epGlo = static_cast<t_ephGlo*>(ep);
    344       (*_ephMap)[prn] = new t_ephGlo(*epGlo);
    345     }
    346     else if (prn[0] == 'E') {
    347       t_ephGal* epGal = static_cast<t_ephGal*>(ep);
    348       (*_ephMap)[prn] = new t_ephGal(*epGal);
    349     }
    350   }
    351303
    352304  // Append to buffer
     
    418370    }
    419371
    420     if ( _ephMap->contains(prn) ) {
    421       t_eph* ep = (*_ephMap)[prn];
     372    const bncEphUser::t_ephPair* ephPair = _ephUser->ephPair(prn);
     373    if (ephPair) {
     374      t_eph* eph = ephPair->last;
     375      if (ephPair->prev &&
     376           eph->receptDateTime().secsTo(QDateTime::currentDateTime()) < 60) {
     377        eph = ephPair->prev;
     378      }
    422379
    423380      in >> xx(1) >> xx(2) >> xx(3) >> xx(4) >> xx(5)
     
    448405      if (sd) {
    449406        QString outLine;
    450         processSatellite(ep, _epoTime.gpsw(), _epoTime.gpssec(), prn, xx, sd, outLine);
     407        processSatellite(eph, _epoTime.gpsw(), _epoTime.gpssec(), prn,
     408                         xx, sd, outLine);
    451409        if (_outFile) {
    452410          _outFile->write(_epoTime.gpsw(), _epoTime.gpssec(), outLine);
  • trunk/BNC/upload/bncuploadcaster.h

    r3207 r3209  
    2525  void deleteSafely();
    2626  virtual void run();
    27   void decodeRtnetStream(char* buffer, int bufLen,
    28                          const QMap<QString, bncEphUser::t_ephPair*>& ephMap);
     27  void decodeRtnetStream(char* buffer, int bufLen);
    2928
    3029 signals:
     
    4241  void crdTrafo(int GPSWeek, ColumnVector& xyz);
    4342
    44   QMap<QString, t_eph*>* _ephMap;
    45   bool                   _isToBeDeleted;
    46   QMutex                 _mutex; 
    47   QString                _rtnetStreamBuffer;
    48   bncTime                _epoTime;
     43  bncEphUser*    _ephUser;
     44  bool           _isToBeDeleted;
     45  QMutex         _mutex; 
     46  QString        _rtnetStreamBuffer;
     47  bncTime        _epoTime;
    4948  QString        _mountpoint;
    5049  QString        _outHost;
Note: See TracChangeset for help on using the changeset viewer.