Changeset 940 in ntrip for trunk/BNC/bncgetthread.cpp
- Timestamp:
- Jun 9, 2008, 3:25:44 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/bncgetthread.cpp
r880 r940 455 455 _socket->read(data, nBytes); 456 456 457 if (_inspSegm<1) { 458 _decoder->Decode(data, nBytes); 459 } 460 else { 461 462 // Decode data 463 // ----------- 464 if (!_decodePause.isValid() || 465 _decodePause.secsTo(QDateTime::currentDateTime()) >= currPause ) { 466 467 if (decode) { 468 if ( _decoder->Decode(data, nBytes) == success ) { 469 numSucc += 1; 470 } 471 if ( _decodeTime.secsTo(QDateTime::currentDateTime()) > _inspSegm ) { 472 decode = false; 457 if (_inspSegm<1) { 458 _decoder->Decode(data, nBytes); 459 } 460 else { 461 462 // Decode data 463 // ----------- 464 if (!_decodePause.isValid() || 465 _decodePause.secsTo(QDateTime::currentDateTime()) >= currPause ) { 466 467 if (decode) { 468 if ( _decoder->Decode(data, nBytes) == success ) { 469 numSucc += 1; 470 } 471 if ( _decodeTime.secsTo(QDateTime::currentDateTime()) > _inspSegm ) { 472 decode = false; 473 } 473 474 } 474 } 475 476 // Check - once per inspect segment 477 // -------------------------------- 478 if (!decode) { 479 _decodeTime = QDateTime::currentDateTime(); 480 if (numSucc>0) { 481 secSucc += _inspSegm; 482 _decodeSucc = QDateTime::currentDateTime(); 483 if (secSucc > _adviseReco * 60) { 484 secSucc = _adviseReco * 60 + 1; 485 } 486 numSucc = 0; 487 currPause = initPause; 488 _decodePause.setDate(QDate()); 489 _decodePause.setTime(QTime()); 490 } 491 else { 492 secFail += _inspSegm; 493 secSucc = 0; 494 if (secFail > _adviseFail * 60) { 495 secFail = _adviseFail * 60 + 1; 496 } 497 if (!_decodePause.isValid() || !_makePause) { 498 _decodePause = QDateTime::currentDateTime(); 475 476 // Check - once per inspect segment 477 // -------------------------------- 478 if (!decode) { 479 _decodeTime = QDateTime::currentDateTime(); 480 if (numSucc>0) { 481 secSucc += _inspSegm; 482 _decodeSucc = QDateTime::currentDateTime(); 483 if (secSucc > _adviseReco * 60) { 484 secSucc = _adviseReco * 60 + 1; 485 } 486 numSucc = 0; 487 currPause = initPause; 488 _decodePause.setDate(QDate()); 489 _decodePause.setTime(QTime()); 499 490 } 500 491 else { 501 _decodePause.setDate(QDate()); 502 _decodePause.setTime(QTime()); 503 secFail = secFail + currPause - _inspSegm; 504 currPause = currPause * 2; 505 if (currPause > 960) { 506 currPause = 960; 492 secFail += _inspSegm; 493 secSucc = 0; 494 if (secFail > _adviseFail * 60) { 495 secFail = _adviseFail * 60 + 1; 496 } 497 if (!_decodePause.isValid() || !_makePause) { 498 _decodePause = QDateTime::currentDateTime(); 499 } 500 else { 501 _decodePause.setDate(QDate()); 502 _decodePause.setTime(QTime()); 503 secFail = secFail + currPause - _inspSegm; 504 currPause = currPause * 2; 505 if (currPause > 960) { 506 currPause = 960; 507 } 507 508 } 508 509 } 510 511 // End corrupt threshold 512 // --------------------- 513 if ( begCorrupt && !endCorrupt && secSucc > _adviseReco * 60 ) { 514 _endDateCor = QDateTime::currentDateTime().addSecs(- _adviseReco * 60).toUTC().date().toString("yy-MM-dd"); 515 _endTimeCor = QDateTime::currentDateTime().addSecs(- _adviseReco * 60).toUTC().time().toString("hh:mm:ss"); 516 emit(newMessage((_staID + ": Recovery threshold exceeded, corruption ended " + _endDateCor + " " + _endTimeCor).toAscii())); 517 callScript(("End_Corrupted " + _endDateCor + " " + _endTimeCor + " Begin was " + _begDateCor + " " + _begTimeCor).toAscii()); 518 endCorrupt = true; 519 begCorrupt = false; 520 secFail = 0; 521 } 522 else { 523 524 // Begin corrupt threshold 525 // ----------------------- 526 if ( !begCorrupt && secFail > _adviseFail * 60 ) { 527 _begDateCor = _decodeSucc.toUTC().date().toString("yy-MM-dd"); 528 _begTimeCor = _decodeSucc.toUTC().time().toString("hh:mm:ss"); 529 emit(newMessage((_staID + ": Failure threshold exceeded, corrupted since " + _begDateCor + " " + _begTimeCor).toAscii())); 530 callScript(("Begin_Corrupted " + _begDateCor + " " + _begTimeCor).toAscii()); 531 begCorrupt = true; 532 endCorrupt = false; 533 secSucc = 0; 534 numSucc = 0; 535 } 536 } 537 decode = true; 509 538 } 510 511 // End corrupt threshold 512 // --------------------- 513 if ( begCorrupt && !endCorrupt && secSucc > _adviseReco * 60 ) { 514 _endDateCor = QDateTime::currentDateTime().addSecs(- _adviseReco * 60).toUTC().date().toString("yy-MM-dd"); 515 _endTimeCor = QDateTime::currentDateTime().addSecs(- _adviseReco * 60).toUTC().time().toString("hh:mm:ss"); 516 emit(newMessage((_staID + ": Recovery threshold exceeded, corruption ended " + _endDateCor + " " + _endTimeCor).toAscii())); 517 callScript(("End_Corrupted " + _endDateCor + " " + _endTimeCor + " Begin was " + _begDateCor + " " + _begTimeCor).toAscii()); 518 endCorrupt = true; 519 begCorrupt = false; 520 secFail = 0; 521 } 522 else { 523 524 // Begin corrupt threshold 525 // ----------------------- 526 if ( !begCorrupt && secFail > _adviseFail * 60 ) { 527 _begDateCor = _decodeSucc.toUTC().date().toString("yy-MM-dd"); 528 _begTimeCor = _decodeSucc.toUTC().time().toString("hh:mm:ss"); 529 emit(newMessage((_staID + ": Failure threshold exceeded, corrupted since " + _begDateCor + " " + _begTimeCor).toAscii())); 530 callScript(("Begin_Corrupted " + _begDateCor + " " + _begTimeCor).toAscii()); 531 begCorrupt = true; 532 endCorrupt = false; 533 secSucc = 0; 534 numSucc = 0; 535 } 536 } 537 decode = true; 538 } 539 } 540 } 541 542 // End outage threshold 543 // -------------------- 544 if ( _decodeStart.isValid() && _decodeStart.secsTo(QDateTime::currentDateTime()) > _adviseReco * 60 ) { 545 _decodeStart.setDate(QDate()); 546 _decodeStart.setTime(QTime()); 547 if (_inspSegm>0) { 548 _endDateOut = QDateTime::currentDateTime().addSecs(- _adviseReco * 60).toUTC().date().toString("yy-MM-dd"); 549 _endTimeOut = QDateTime::currentDateTime().addSecs(- _adviseReco * 60).toUTC().time().toString("hh:mm:ss"); 550 emit(newMessage((_staID + ": Recovery threshold exceeded, outage ended " + _endDateOut + " " + _endTimeOut).toAscii())); 551 callScript(("End_Outage " + _endDateOut + " " + _endTimeOut + " Begin was " + _begDateOut + " " + _begTimeOut).toAscii()); 552 } 553 } 539 } 540 } 541 542 // End outage threshold 543 // -------------------- 544 if ( _decodeStart.isValid() && _decodeStart.secsTo(QDateTime::currentDateTime()) > _adviseReco * 60 ) { 545 _decodeStart.setDate(QDate()); 546 _decodeStart.setTime(QTime()); 547 if (_inspSegm>0) { 548 _endDateOut = QDateTime::currentDateTime().addSecs(- _adviseReco * 60).toUTC().date().toString("yy-MM-dd"); 549 _endTimeOut = QDateTime::currentDateTime().addSecs(- _adviseReco * 60).toUTC().time().toString("hh:mm:ss"); 550 emit(newMessage((_staID + ": Recovery threshold exceeded, outage ended " + _endDateOut + " " + _endTimeOut).toAscii())); 551 callScript(("End_Outage " + _endDateOut + " " + _endTimeOut + " Begin was " + _begDateOut + " " + _begTimeOut).toAscii()); 552 } 553 } 554 554 555 555 delete [] data;
Note:
See TracChangeset
for help on using the changeset viewer.