Changeset 9823 in ntrip


Ignore:
Timestamp:
Sep 13, 2022, 10:11:46 AM (3 weeks 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

    r9821 r9823  
    264264  QMutexLocker locker(&_mutex);
    265265
    266   // Append to internal buffer
     266
     267
     268
     269  /* Append to internal buffer
    267270  // -------------------------
    268271  _rtnetStreamBuffer.append(QByteArray(buffer, bufLen));
     
    304307
    305308  if (lines.size() < 2) {
     309    emit(newMessage(
     310          "bncRtnetUploadCaster: less than 2 lines to decode " + _casterID.toLatin1(), false));
    306311    return;
    307312  }
    308 
     313*/
     314
     315
     316  // Append to internal buffer
     317  // -------------------------
     318  _rtnetStreamBuffer.append(QByteArray(buffer, bufLen));
     319
     320  // Select buffer part that contains last epoch
     321  // -------------------------------------------
     322  QStringList lines;
     323  int iEpoBeg = _rtnetStreamBuffer.lastIndexOf('*');   // begin of last epoch
     324  if (iEpoBeg == -1) {
     325    _rtnetStreamBuffer.clear();
     326    return;
     327  }
     328  _rtnetStreamBuffer = _rtnetStreamBuffer.mid(iEpoBeg);
     329
     330  int iEpoEnd = _rtnetStreamBuffer.lastIndexOf("EOE"); // end   of last epoch
     331  if (iEpoEnd == -1) {
     332    return;
     333  }
     334  else {
     335    lines = _rtnetStreamBuffer.left(iEpoEnd).split('\n', QString::SkipEmptyParts);
     336    _rtnetStreamBuffer = _rtnetStreamBuffer.mid(iEpoEnd+3);
     337  }
     338
     339  if (lines.size() < 2) {
     340      emit(newMessage(
     341            "bncRtnetUploadCaster: less than 2 lines to decode " + _casterID.toLatin1(), false));
     342    return;
     343  }
     344
     345  // Keep the last unfinished line in buffer
     346  // ---------------------------------------
     347  int iLastEOL = _rtnetStreamBuffer.lastIndexOf('\n');
     348  if (iLastEOL != -1) {
     349    _rtnetStreamBuffer = _rtnetStreamBuffer.mid(iLastEOL+1);
     350  }
    309351  // Read first line (with epoch time)
    310352  // ---------------------------------
Note: See TracChangeset for help on using the changeset viewer.