Changeset 9841 in ntrip


Ignore:
Timestamp:
Sep 28, 2022, 11:44:57 AM (2 months ago)
Author:
stuerze
Message:

try the old RTNET buffer reading code again

File:
1 edited

Legend:

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

    r9840 r9841  
    265265
    266266
    267   // Append to internal buffer
     267  /* Append to internal buffer
    268268  // -------------------------
    269269  _rtnetStreamBuffer.append(QByteArray(buffer, bufLen));
     
    308308          "bncRtnetUploadCaster: less than 2 lines to decode " + _casterID.toLatin1(), false));
    309309    return;
     310  }
     311*/
     312
     313  // Append to internal buffer
     314  // -------------------------
     315  _rtnetStreamBuffer.append(QByteArray(buffer, bufLen));
     316
     317  // Select buffer part that contains last epoch
     318  // -------------------------------------------
     319  QStringList lines;
     320  int iEpoBeg = _rtnetStreamBuffer.lastIndexOf('*');   // begin of last epoch
     321  if (iEpoBeg == -1) {
     322    _rtnetStreamBuffer.clear();
     323    return;
     324  }
     325  _rtnetStreamBuffer = _rtnetStreamBuffer.mid(iEpoBeg);
     326
     327  int iEpoEnd = _rtnetStreamBuffer.lastIndexOf("EOE"); // end   of last epoch
     328  if (iEpoEnd == -1) {
     329    return;
     330  }
     331  else {
     332    lines = _rtnetStreamBuffer.left(iEpoEnd).split('\n', QString::SkipEmptyParts);
     333    _rtnetStreamBuffer = _rtnetStreamBuffer.mid(iEpoEnd+3);
     334  }
     335
     336  if (lines.size() < 2) {
     337    emit(newMessage(
     338          "bncRtnetUploadCaster: less than 2 lines to decode " + _casterID.toLatin1(), false));
     339    return;
     340  }
     341
     342  // Keep the last unfinished line in buffer
     343  // ---------------------------------------
     344  int iLastEOL = _rtnetStreamBuffer.lastIndexOf('\n');
     345  if (iLastEOL != -1) {
     346    _rtnetStreamBuffer = _rtnetStreamBuffer.mid(iLastEOL+1);
    310347  }
    311348
Note: See TracChangeset for help on using the changeset viewer.