Changeset 9843 in ntrip


Ignore:
Timestamp:
Oct 4, 2022, 11:30:02 AM (2 months ago)
Author:
stuerze
Message:

restore RTNET buffer reading code

File:
1 edited

Legend:

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

    r9842 r9843  
    264264  QMutexLocker locker(&_mutex);
    265265
    266 
    267266  // Append to internal buffer
    268267  // -------------------------
     
    275274  if (iEpoBeg == -1) {
    276275    _rtnetStreamBuffer.clear();
     276    emit(newMessage(
     277          "bncRtnetUploadCaster: no Epoch line found " + _casterID.toLatin1(), false));
    277278    return;
    278279  }
     280  _rtnetStreamBuffer = _rtnetStreamBuffer.mid(iEpoBeg);
     281
     282  int iEpoEnd = _rtnetStreamBuffer.lastIndexOf("EOE"); // end   of last epoch
     283  if (iEpoEnd == -1) {
     284    emit(newMessage(
     285          "bncRtnetUploadCaster: no EOE found " + _casterID.toLatin1(), false));
     286    return;
     287  }
     288  else {
     289    lines = _rtnetStreamBuffer.left(iEpoEnd).split('\n', QString::SkipEmptyParts);
     290    _rtnetStreamBuffer = _rtnetStreamBuffer.mid(iEpoEnd+3);
     291  }
     292
     293  if (lines.size() < 2) {
     294      emit(newMessage(
     295            "bncRtnetUploadCaster: less than 2 lines to decode " + _casterID.toLatin1(), false));
     296    return;
     297  }
     298
     299  // Keep the last unfinished line in buffer
     300  // ---------------------------------------
     301  int iLastEOL = _rtnetStreamBuffer.lastIndexOf('\n');
     302  if (iLastEOL != -1) {
     303    _rtnetStreamBuffer = _rtnetStreamBuffer.mid(iLastEOL+1);
     304    emit(newMessage(
     305          "bncRtnetUploadCaster: keep the last unfinished line in buffer " + _casterID.toLatin1(), false));
     306  }
     307
     308
     309  /* Append to internal buffer
     310  // -------------------------
     311  _rtnetStreamBuffer.append(QByteArray(buffer, bufLen));
     312
     313  // Select buffer part that contains last epoch
     314  // -------------------------------------------
     315  QStringList lines;
     316  int iEpoBeg = _rtnetStreamBuffer.lastIndexOf('*');   // begin of last epoch
     317  if (iEpoBeg == -1) {
     318    _rtnetStreamBuffer.clear();
     319    emit(newMessage(
     320          "bncRtnetUploadCaster: no Epoch line found " + _casterID.toLatin1(), false));
     321    return;
     322  }
     323
    279324  int iEpoBegEarlier = _rtnetStreamBuffer.indexOf('*');
    280325  if (iEpoBegEarlier != -1 && iEpoBegEarlier < iEpoBeg) { // are there two epoch lines in buffer?
     
    284329    _rtnetStreamBuffer = _rtnetStreamBuffer.mid(iEpoBeg);
    285330  }
     331
    286332  int iEpoEnd = _rtnetStreamBuffer.lastIndexOf("EOE"); // end of last epoch
    287333  if (iEpoEnd == -1) {
     334    _rtnetStreamBuffer.clear();
     335    emit(newMessage(
     336          "bncRtnetUploadCaster: no EOE found " + _casterID.toLatin1(), false));
    288337    return;
    289338  }
     
    309358    return;
    310359  }
    311 
     360*/
    312361  // Read first line (with epoch time)
    313362  // ---------------------------------
Note: See TracChangeset for help on using the changeset viewer.