Changeset 3001 in ntrip


Ignore:
Timestamp:
Feb 22, 2011, 11:20:04 AM (13 years ago)
Author:
mervart
Message:
 
Location:
trunk/BNC/RTCM3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/RTCM3/RTCM3Decoder.cpp

    r2770 r3001  
    8181          (bncApp*) qApp, SLOT(slotNewGalileoEph(galileoephemeris*)));
    8282
    83   // Sub-Decoder for Clock and Orbit Corrections
    84   // -------------------------------------------
    85   _coDecoder = new RTCM3coDecoder(staID);
    86 
    8783  // Mode can be either observations or corrections
    8884  // ----------------------------------------------
     
    9894////////////////////////////////////////////////////////////////////////////
    9995RTCM3Decoder::~RTCM3Decoder() {
    100   delete _coDecoder;
     96  QMapIterator<QByteArray, RTCM3coDecoder*> it(_coDecoders);
     97  while (it.hasNext()) {
     98    delete it.next();
     99  }
    101100}
    102101
     
    109108  bool decoded = false;
    110109
    111   // If read from file, we set the mode according to staID
    112   // -----------------------------------------------------
    113   if (!_staID_corrections.isEmpty() && _rawFile) {
    114     if (_rawFile->staID() == _staID_corrections) {
    115       _mode = corrections;
    116     }
    117     else {
    118       _mode = observations;
    119     }
    120   }
     110  // If read from file, mode is always uknown
     111  // ----------------------------------------
     112  if (_rawFile) {
     113    _mode  = unknown;
     114    _staID = _rawFile->staID();
     115  }
     116
     117  // Find the corresponding coDecoder, initialize a new one if necessary
     118  // -------------------------------------------------------------------
     119  if (!_coDecoders.contains(_staID.toAscii())) {
     120    _coDecoders[_staID.toAscii()] = new RTCM3coDecoder(_staID);
     121  }
     122  RTCM3coDecoder* coDecoder = _coDecoders[_staID.toAscii()];
    121123
    122124  // Try to decode Clock and Orbit Corrections
    123125  // -----------------------------------------
    124126  if (_mode == unknown || _mode == corrections) {
    125     if ( _coDecoder->Decode(buffer, bufLen, errmsg) == success ) {
     127    if ( coDecoder->Decode(buffer, bufLen, errmsg) == success ) {
    126128      decoded = true;
    127       if (_mode == unknown) {
    128         if (_rawFile) {
    129           _staID_corrections = _rawFile->staID();
    130         }
    131         else {
    132           _mode = corrections;
    133         }
     129      if  (!_rawFile && _mode == unknown) {
     130        _mode = corrections;
    134131      }
    135132    }
    136133  }
    137134
    138   // Find the corresponding parser
    139   // -----------------------------
    140   QByteArray staID("default");
    141   if (_rawFile) {
    142     staID = _rawFile->staID();
    143   }
    144 
    145   bool newParser = !_parsers.contains(staID);
    146 
    147   RTCM3ParserData& parser = _parsers[staID];
    148 
    149   // Get Glonass Slot Numbers from Global Array
    150   // ------------------------------------------
    151   bncApp* app = (bncApp*) qApp;
    152   app->getGlonassSlotNums(parser.GLOFreq);
    153 
    154   // Initialize a new parser
    155   // -----------------------
    156   if (newParser) {
     135  // Find the corresponding parser, initialize a new parser if necessary
     136  // -------------------------------------------------------------------
     137  bool newParser = !_parsers.contains(_staID.toAscii());
     138  RTCM3ParserData& parser = _parsers[_staID.toAscii()];
     139  if (newParser) { 
    157140    memset(&parser, 0, sizeof(parser));
    158141    parser.rinex3 = 0;
     
    161144    parser.GPSTOW = int(secGPS);
    162145  }
     146
     147  // Get Glonass Slot Numbers from Global Array
     148  // ------------------------------------------
     149  bncApp* app = (bncApp*) qApp;
     150  app->getGlonassSlotNums(parser.GLOFreq);
    163151
    164152  // Remaining part decodes the Observations
     
    338326                unsigned df = (1 << iEntry);
    339327
    340                 //// beg test
    341                 ////  cout << prn.toAscii().data() << " "
    342                 ////       << iEntry << " " << df;
    343                 ////  if (df & gnssData.dataflags[iSat]) {
    344                 ////    cout << " present";
    345                 ////  }
    346                 ////  cout << endl;
    347                 //// end test
    348 
    349328                if (df & gnssData.dataflags[iSat]) {
    350329
     
    478457  return false;
    479458}
     459
     460// Time of Corrections
     461//////////////////////////////////////////////////////////////////////////////
     462int RTCM3Decoder::corrGPSEpochTime() const {
     463  if (_mode == corrections && _coDecoders.size() > 0) {
     464    return _coDecoders.begin().value()->corrGPSEpochTime();
     465  }
     466  else {
     467    return -1;
     468  }
     469}
  • trunk/BNC/RTCM3/RTCM3Decoder.h

    r2770 r3001  
    4545  virtual ~RTCM3Decoder();
    4646  virtual t_irc Decode(char* buffer, int bufLen, std::vector<std::string>& errmsg);
    47   virtual int corrGPSEpochTime() const {
    48     return (_mode == corrections ? _coDecoder->corrGPSEpochTime() : -1);
    49   }
     47  virtual int corrGPSEpochTime() const;
    5048
    5149  bool  storeEph(const gpsephemeris& gpseph);
     
    6462  QString                _checkMountPoint;
    6563  QMap<QByteArray, RTCM3ParserData> _parsers;
    66   RTCM3coDecoder*        _coDecoder;
     64  QMap<QByteArray, RTCM3coDecoder*> _coDecoders;
    6765  t_mode                 _mode;
    6866
     
    7068  double                 _antXYZ[3];
    7169  bncRawFile*            _rawFile;
    72   QString                _staID_corrections;
    7370
    7471  QMap<QString, int>  _slip_cnt_L1;
Note: See TracChangeset for help on using the changeset viewer.