Changeset 9868 in ntrip for trunk/BNC/src/upload


Ignore:
Timestamp:
Nov 2, 2022, 12:32:22 PM (2 years ago)
Author:
stuerze
Message:

minor changes

Location:
trunk/BNC/src/upload
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/upload/bncrtnetuploadcaster.cpp

    r9861 r9868  
    270270  // Select buffer part that contains last epoch
    271271  // -------------------------------------------
    272   QStringList lines;
    273   int iEpoBeg = _rtnetStreamBuffer.lastIndexOf('*');   // begin of last epoch
     272
     273  // Find the begin of last epoch
     274  int iEpoBeg = _rtnetStreamBuffer.lastIndexOf('*');
    274275  if (iEpoBeg == -1) {
    275276    _rtnetStreamBuffer.clear();
     
    277278    return;
    278279  }
    279   _rtnetStreamBuffer = _rtnetStreamBuffer.mid(iEpoBeg);
    280 
    281   int iEpoEnd = _rtnetStreamBuffer.lastIndexOf("EOE"); // end   of last epoch
     280
     281  // Find the begin of the first epoch
     282  int iEpoBegEarlier = _rtnetStreamBuffer.indexOf('*');
     283  if (iEpoBegEarlier != -1 && iEpoBegEarlier < iEpoBeg) {
     284    _rtnetStreamBuffer = _rtnetStreamBuffer.mid(iEpoBegEarlier);
     285  }
     286  else {
     287    _rtnetStreamBuffer = _rtnetStreamBuffer.mid(iEpoBeg);
     288  }
     289
     290  // Find End of the last epoch
     291  int iEpoEnd = _rtnetStreamBuffer.lastIndexOf("EOE");
    282292  if (iEpoEnd == -1) {
     293    _rtnetStreamBuffer.clear();
    283294    emit(newMessage("bncRtnetUploadCaster: no EOE found " + _casterID.toLatin1(), false));
    284295    return;
    285296  }
    286   else {
    287     lines = _rtnetStreamBuffer.left(iEpoEnd).split('\n', QString::SkipEmptyParts);
    288     _rtnetStreamBuffer = _rtnetStreamBuffer.mid(iEpoEnd+3);
    289   }
     297
     298  // If there is there more than 1 epoch line in the buffer
     299  while (_rtnetStreamBuffer.count('*') > 1) {
     300    emit(newMessage("bncRtnetUploadCaster: more than 1 epoch in buffer: " + _rtnetStreamBuffer.count('*') , false));
     301    QString rtnetStreamBuffer = _rtnetStreamBuffer.mid(1);
     302    int nextEpoch = rtnetStreamBuffer.indexOf('*');
     303    cout << "=============" << endl;
     304    cout << "nextEpoch: " << nextEpoch << endl;
     305    cout << "iEpoEnd  : " << iEpoEnd   << endl;
     306    if      (nextEpoch != -1 && nextEpoch < iEpoEnd) {
     307      _rtnetStreamBuffer = _rtnetStreamBuffer.mid(nextEpoch);
     308      cout <<  _rtnetStreamBuffer.toStdString().c_str() << endl;
     309    }
     310    else if (nextEpoch != -1 && nextEpoch >= iEpoEnd) {
     311      break;
     312    }
     313    else {
     314      cout <<  _rtnetStreamBuffer.toStdString().c_str() << endl;
     315    }
     316  }
     317
     318  QStringList lines = _rtnetStreamBuffer.left(iEpoEnd).split('\n', QString::SkipEmptyParts);
     319
     320  _rtnetStreamBuffer = _rtnetStreamBuffer.mid(iEpoEnd + 3);
    290321
    291322  if (lines.size() < 2) {
    292       emit(newMessage("bncRtnetUploadCaster: less than 2 lines to decode " + _casterID.toLatin1(), false));
     323    emit(newMessage(
     324          "bncRtnetUploadCaster: less than 2 lines to decode " + _casterID.toLatin1(), false));
    293325    return;
    294326  }
    295327
    296   // Keep the last unfinished line in buffer
    297   // ---------------------------------------
    298   int iLastEOL = _rtnetStreamBuffer.lastIndexOf('\n');
    299   if (iLastEOL != -1) {
    300     _rtnetStreamBuffer = _rtnetStreamBuffer.mid(iLastEOL+1);
    301   }
     328  decodeRtnetEpoch(lines);
     329
     330}
     331
     332//
     333////////////////////////////////////////////////////////////////////////////
     334void bncRtnetUploadCaster::decodeRtnetEpoch(QStringList epochLines) {
    302335
    303336  // Read first line (with epoch time)
    304337  // ---------------------------------
    305   QTextStream in(lines[0].toLatin1());
     338  QTextStream in(epochLines[0].toLatin1());
    306339  QString hlp;
    307340  int year, month, day, hour, min;
     
    398431  phasebias.UpdateInterval = ephUpdInd;
    399432
    400   for (int ii = 1; ii < lines.size(); ii++) {
     433  for (int ii = 1; ii < epochLines.size(); ii++) {
    401434    QString key;  // prn or key VTEC, IND (phase bias indicators)
    402435    double rtnUra = 0.0; // [m]
     
    408441    t_prn prn;
    409442
    410     QTextStream in(lines[ii].toLatin1());
     443    QTextStream in(epochLines[ii].toLatin1());
    411444
    412445    in >> key;
     
    951984  }
    952985
    953   _outBuffer += hlpBufferCo + hlpBufferBias + hlpBufferPhaseBias
    954       + hlpBufferVtec + '\0';
     986  _outBuffer += hlpBufferCo + hlpBufferBias + hlpBufferPhaseBias + hlpBufferVtec + '\0';
    955987}
    956 
    957988//
    958989////////////////////////////////////////////////////////////////////////////
  • trunk/BNC/src/upload/bncrtnetuploadcaster.h

    r9652 r9868  
    4343                        struct SsrCorr::ClockOrbit::SatData* sd,
    4444                        QString& outLine);
    45 
     45  void decodeRtnetEpoch(QStringList epochLines);
    4646  bool corrIsOutOfRange(struct SsrCorr::ClockOrbit::SatData* sd);
    4747
Note: See TracChangeset for help on using the changeset viewer.