Changeset 10615 in ntrip
- Timestamp:
- Mar 1, 2025, 11:02:09 PM (29 hours ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/upload/bncrtnetuploadcaster.cpp
r10599 r10615 295 295 // Select buffer part that contains last epoch 296 296 // ------------------------------------------- 297 298 // Find the begin of last epoch 299 int iEpoBeg = _rtnetStreamBuffer.lastIndexOf('*'); 297 QStringList lines; 298 int iEpoBeg = _rtnetStreamBuffer.lastIndexOf('*'); // begin of last epoch 300 299 if (iEpoBeg == -1) { 301 300 _rtnetStreamBuffer.clear(); 302 emit(newMessage(QString("bncRtnetUploadCaster: no Epoch line found: %1").arg(_casterID).toLatin1(), false));303 301 return; 304 302 } 305 306 // Find the begin of the first epoch 307 int iEpo BegEarlier = _rtnetStreamBuffer.indexOf('*');308 if (iEpo BegEarlier != -1 && iEpoBegEarlier < iEpoBeg) {309 _rtnetStreamBuffer = _rtnetStreamBuffer.mid(iEpoBegEarlier);303 _rtnetStreamBuffer = _rtnetStreamBuffer.mid(iEpoBeg); 304 305 int iEpoEnd = _rtnetStreamBuffer.lastIndexOf("EOE"); // end of last epoch 306 if (iEpoEnd == -1) { 307 return; 310 308 } 311 309 else { 312 _rtnetStreamBuffer = _rtnetStreamBuffer.mid(iEpoBeg); 313 } 314 315 // Find End of the last epoch 316 int iEpoEnd = _rtnetStreamBuffer.lastIndexOf("EOE"); 317 if (iEpoEnd == -1) { 318 _rtnetStreamBuffer.clear(); 319 emit(newMessage(QString("bncRtnetUploadCaster: no EOE found: %1").arg(_casterID).toLatin1(), false)); 310 lines = _rtnetStreamBuffer.left(iEpoEnd).split('\n', Qt::SkipEmptyParts); 311 _rtnetStreamBuffer = _rtnetStreamBuffer.mid(iEpoEnd+3); 312 } 313 314 if (lines.size() < 2) { 315 emit(newMessage( 316 "bncRtnetUploadCaster: less than 2 lines to decode " + _casterID.toLatin1(), false)); 320 317 return; 321 318 } 322 319 323 QStringList lines; 324 // If there is there more than 1 epoch line in the buffer 325 while (_rtnetStreamBuffer.count('*') > 1) { 326 emit(newMessage(QString("bncRtnetUploadCaster: more than 1 epoch in buffer: %1").arg(_rtnetStreamBuffer.count('*')).toLatin1(), false)); 327 QString rtnetStreamBuffer = _rtnetStreamBuffer; 328 int nextEpoch = rtnetStreamBuffer.indexOf('*'); 329 int nextEpochEnd = rtnetStreamBuffer.indexOf("EOE"); 330 _rtnetStreamBuffer = _rtnetStreamBuffer.mid(1); 331 if (nextEpoch != -1 && nextEpoch < iEpoEnd) { 332 rtnetStreamBuffer = rtnetStreamBuffer.mid(nextEpoch, nextEpochEnd); 333 lines = rtnetStreamBuffer.split('\n', Qt::SkipEmptyParts); 334 if (lines.size() > 2) { 335 decodeRtnetEpoch(lines); 336 } 337 nextEpochEnd = _rtnetStreamBuffer.indexOf("EOE"); 338 _rtnetStreamBuffer = _rtnetStreamBuffer.mid(nextEpochEnd+3); 339 } 340 else if (nextEpoch != -1 && nextEpoch >= iEpoEnd) { 341 break; 342 } 343 } 344 345 lines = _rtnetStreamBuffer.left(iEpoEnd).split('\n', Qt::SkipEmptyParts); 346 347 _rtnetStreamBuffer = _rtnetStreamBuffer.mid(iEpoEnd + 3); 348 349 if (lines.size() < 2) { 350 emit(newMessage(QString("bncRtnetUploadCaster: less than 2 lines to decode : %1").arg(_casterID).toLatin1(), false)); 351 return; 352 } 320 // Keep the last unfinished line in buffer 321 // --------------------------------------- 322 int iLastEOL = _rtnetStreamBuffer.lastIndexOf('\n'); 323 if (iLastEOL != -1) { 324 _rtnetStreamBuffer = _rtnetStreamBuffer.mid(iLastEOL+1); 325 } 326 353 327 decodeRtnetEpoch(lines); 354 328 } … … 366 340 in >> hlp >> year >> month >> day >> hour >> min >> sec; 367 341 bncTime epoTime; 368 epoTime.set(year, month, day, hour, min, sec); 342 epoTime.set(year, month, day, hour, min, sec);cout << epoTime.timestr().c_str() << endl; 369 343 370 344 emit(newMessage(
Note:
See TracChangeset
for help on using the changeset viewer.