Index: trunk/BNC/RTCM3/RTCM3Decoder.cpp
===================================================================
--- trunk/BNC/RTCM3/RTCM3Decoder.cpp	(revision 657)
+++ trunk/BNC/RTCM3/RTCM3Decoder.cpp	(revision 658)
@@ -90,4 +90,6 @@
 t_irc RTCM3Decoder::Decode(char* buffer, int bufLen) {
 
+  bool decoded = false;
+
   for (int ii = 0; ii < bufLen; ii++) {
 
@@ -100,4 +102,5 @@
         // -----------------
         if (rr == 1 || rr == 2) {
+                decoded = true;
 
           if (!_Parser.init) {
@@ -185,4 +188,5 @@
         // -------------
         else if (rr == 1019) {
+          decoded = true;
           gpsephemeris* ep = new gpsephemeris(_Parser.ephemerisGPS);
           emit _ephSender.newGPSEph(ep);
@@ -192,4 +196,5 @@
         // -----------------
         else if (rr == 1020) {
+          decoded = true;
           glonassephemeris* ep = new glonassephemeris(_Parser.ephemerisGLONASS);
           emit _ephSender.newGlonassEph(ep);
@@ -198,4 +203,9 @@
     }
   }
+  if (!decoded) {
+  return failure;
+  }
+  else {
   return success;
-}
+  }
+}
Index: trunk/BNC/bnc.pro
===================================================================
--- trunk/BNC/bnc.pro	(revision 657)
+++ trunk/BNC/bnc.pro	(revision 658)
@@ -2,6 +2,6 @@
 # Switch to debug configuration
 # -----------------------------
-### CONFIG -= release
-### CONFIG += debug
+CONFIG -= release
+CONFIG += debug
 
 DEFINES += NO_RTCM3_MAIN
Index: trunk/BNC/bncgetthread.cpp
===================================================================
--- trunk/BNC/bncgetthread.cpp	(revision 657)
+++ trunk/BNC/bncgetthread.cpp	(revision 658)
@@ -103,4 +103,12 @@
     _staID = _staID.left(_staID.length()-1) + QString("%1").arg(num).toAscii();
   }    
+
+  // Notice threshold
+  // ----------------
+  _inspSegm = settings.value("inspSegm").toInt();
+  _noticeFail = settings.value("noticeFail").toInt();
+  _noticeReco = settings.value("noticeReco").toInt();
+  _noticeScript = settings.value("noticeScript").toString();
+  expandEnvVar(_noticeScript);
 
   // RINEX writer
@@ -374,4 +382,22 @@
   }
 
+  bool decode = true;
+  int numSucc = 0;
+  int secSucc = 0;
+  int secFail = 0;
+  int initPause = 30;
+  int currPause = 0;
+  bool begCorrupt = false;
+  bool endCorrupt = false;
+  _decodeTime = QDateTime::currentDateTime();
+ 
+  if (initPause < _inspSegm) {
+    initPause = _inspSegm;
+  }
+  if ( _noticeFail < 1 && _noticeReco < 1 ) {
+    initPause = 0;
+  }
+  currPause = initPause;
+
   // Read Incoming Data
   // ------------------
@@ -397,22 +423,92 @@
         _socket->read(data, nBytes);
 
-        if ( !_decodeFailure.isValid() || 
-             _decodeFailure.secsTo(QDateTime::currentDateTime()) > 60 ) {
-          if ( _decoder->Decode(data, nBytes) == success ) {
-            _decodeFailure.setDate(QDate());
-            _decodeFailure.setTime(QTime());
-          }
-          else {
-            _decodeFailure = QDateTime::currentDateTime();
+      if (_inspSegm<1) {
+        _decoder->Decode(data, nBytes);
+      }
+      else {
+
+        // Decode data
+        // -----------
+        if (!_decodePause.isValid() || 
+          _decodePause.secsTo(QDateTime::currentDateTime()) >= currPause )  {
+
+          if (decode) { 
+            if ( _decoder->Decode(data, nBytes) == success ) { 
+              numSucc += 1;
+            } 
+            if ( _decodeTime.secsTo(QDateTime::currentDateTime()) > _inspSegm ) {
+              decode = false;
+            }
+          }
+
+          // Check - once per inspect segment
+          // --------------------------------
+          if (!decode) {
+            _decodeTime = QDateTime::currentDateTime();
+            if (numSucc>0) {
+              secSucc += _inspSegm;
+              if (secSucc > _noticeReco * 60) {
+                secSucc = _noticeReco * 60 + 1;
+              }
+              numSucc = 0;
+              currPause = initPause;
+              _decodePause.setDate(QDate());
+              _decodePause.setTime(QTime());
+            }
+            else {
+              secFail += _inspSegm;
+              secSucc = 0;
+              if (secFail > _noticeFail * 60) { 
+                secFail = _noticeFail * 60 + 1;
+              }
+              if (!_decodePause.isValid()) {
+                _decodePause = QDateTime::currentDateTime();
+              }
+              else {
+                _decodePause.setDate(QDate());
+                _decodePause.setTime(QTime());
+                secFail = secFail + currPause - _inspSegm;
+                currPause = currPause * 2;
+                if (currPause > 960) {
+                currPause = 960;
+                }
+              }
+            }
+
+            // End corrupt threshold
+            // ---------------------
+            if ( begCorrupt && !endCorrupt && secSucc > _noticeReco * 60 ) {
+              emit(newMessage(_staID + ": End_Corrupted threshold exceeded"));
+              callScript("End_Corrupted");
+              endCorrupt = true;
+              begCorrupt = false;
+              secFail = 0;
+            } 
+            else {
+
+              // Begin corrupt threshold
+              // -----------------------
+              if ( !begCorrupt && secFail > _noticeFail * 60 ) {
+                emit(newMessage(_staID + ": Begin_Corrupted threshold exceeded"));
+                callScript("Begin_Corrupted");
+                begCorrupt = true;
+                endCorrupt = false;
+                secSucc = 0;
+                numSucc = 0;
+              }
+            }
+            decode = true;
           }
         }
-        else {
-          if ( _decodeFailure.isValid() &&
-               _decodeFailure.secsTo(QDateTime::currentDateTime()) < 5 &&
-               _decoder->Decode(data, nBytes) == success ) {
-               _decodeFailure.setDate(QDate());
-               _decodeFailure.setTime(QTime());
-          }
-        }
+      }
+
+      // End outage threshold
+      // --------------------
+      if ( _decodeStart.isValid() && _decodeStart.secsTo(QDateTime::currentDateTime()) > _noticeReco * 60 ) {
+        _decodeStart.setDate(QDate());
+        _decodeStart.setTime(QTime());
+        emit(newMessage(_staID + ": End_Outage threshold exceeded"));
+        callScript("End_Outage");
+      }
 
         delete [] data;
@@ -425,4 +521,5 @@
           // -----------------------
           int    week;
+          bool   wrongEpoch = false;
           double sec;
           currentGPSWeeks(week, sec);
@@ -441,7 +538,13 @@
           double dt = fabs(sec - obs->_o.GPSWeeks);
           if (week != obs->_o.GPSWeek || dt > maxDt) {
-            emit( newMessage("Wrong observation epoch") );
+            if  (!wrongEpoch) {
+              emit( newMessage(_staID + ": Wrong observation epoch") );
+              wrongEpoch = true;
+            }
             delete obs;
             continue;
+          }
+          else {
+            wrongEpoch = false;
           }
 
@@ -491,11 +594,26 @@
     _rnx->setReconnectFlag(true);
   }
+  if ( !_decodeStart.isValid()) {
+    _decodeStop = QDateTime::currentDateTime();
+  }
   while (1) {
     delete _socket; _socket = 0;
     sleep(_nextSleep);
     if ( initRun() == success ) {
+      if ( !_decodeStop.isValid()) {
+        _decodeStart = QDateTime::currentDateTime();
+      }
       break;
     }
     else {
+
+      // Begin outage threshold
+      // ----------------------
+      if ( _decodeStop.isValid() && _decodeStop.secsTo(QDateTime::currentDateTime()) > _noticeFail * 60 ) {
+        _decodeStop.setDate(QDate());
+        _decodeStop.setTime(QTime());
+        emit(newMessage(_staID + ": Begin_Outage threshold exceeded"));
+        callScript("Begin_Outage");
+      }
       _nextSleep *= 2;
       if (_nextSleep > 256) {
@@ -507,2 +625,14 @@
   _nextSleep = 1;
 }
+
+// Call notice advisory script    
+////////////////////////////////////////////////////////////////////////////
+void bncGetThread::callScript(const char* _comment) {
+  if (!_noticeScript.isEmpty()) {
+#ifdef WIN32
+    QProcess::startDetached(_noticeScript, QStringList() << _staID << _comment) ;
+#else
+    QProcess::startDetached("nohup", QStringList() << _noticeScript << _staID << _comment) ;
+#endif
+  }
+}
Index: trunk/BNC/bncgetthread.h
===================================================================
--- trunk/BNC/bncgetthread.h	(revision 657)
+++ trunk/BNC/bncgetthread.h	(revision 658)
@@ -65,4 +65,5 @@
    void  exit(int exitCode = 0);
    void  tryReconnect();
+   void  callScript(const char* _comment);
    GPSDecoder* _decoder;
    QTcpSocket* _socket;
@@ -74,4 +75,8 @@
    QByteArray  _longitude;
    QByteArray  _nmea;
+   QString     _noticeScript;
+   int         _inspSegm;
+   int         _noticeFail;
+   int         _noticeReco;
    int         _timeOut;
    int         _nextSleep;
@@ -80,4 +85,8 @@
    bncRinex*   _rnx;
    QDateTime   _decodeFailure;
+   QDateTime   _decodeStart;
+   QDateTime   _decodeStop;
+   QDateTime   _decodePause;
+   QDateTime   _decodeTime;
 };
 
Index: trunk/BNC/bnchelp.html
===================================================================
--- trunk/BNC/bnchelp.html	(revision 657)
+++ trunk/BNC/bnchelp.html	(revision 658)
@@ -77,15 +77,20 @@
 &nbsp; &nbsp; &nbsp; 3.6.2. <a href=#ephvers>RINEX Version</a><br>
 &nbsp; &nbsp; &nbsp; 3.6.3. <a href=#ephinterval>Ephemeris File Interval</a><br>
-3.7. <a href=#mountpoints>Mountpoints</a><br>
-&nbsp; &nbsp; &nbsp; 3.7.1. <a href=#AddMounts>Add Mountpoints</a><br>
-&nbsp; &nbsp; &nbsp; 3.7.2. <a href=#HostPort>Broadcaster Host and Port</a><br>
-&nbsp; &nbsp; &nbsp; 3.7.3. <a href=#account>Broadcaster User and Password</a><br>
-&nbsp; &nbsp; &nbsp; 3.7.4. <a href=#GetTable>Get Table</a><br>
-&nbsp; &nbsp; &nbsp; 3.7.5. <a href=#delete>Delete Mountpoints</a><br>
-&nbsp; &nbsp; &nbsp; 3.7.6. <a href=#edit>Edit Mountpoints</a><br>
-3.8. <a href=#log>Log</a><br>
-3.9. <a href=#start>Start</a><br>
-3.10. <a href=#stop>Stop</a><br>
-3.11. <a href=#nw>No Window</a>
+3.7. <a href=#thresholds>Notice Advisories</a><br>
+&nbsp; &nbsp; &nbsp; 3.7.1. <a href=#threshFail>Failure Threshold</a><br>
+&nbsp; &nbsp; &nbsp; 3.7.2. <a href=#threshReco>Recovery Threshold</a><br>
+&nbsp; &nbsp; &nbsp; 3.7.3. <a href=#inspectSegm>Inspect Segment</a><br>
+&nbsp; &nbsp; &nbsp; 3.7.4. <a href=#noteScript>Notice Script</a><br>
+3.8. <a href=#mountpoints>Mountpoints</a><br>
+&nbsp; &nbsp; &nbsp; 3.8.1. <a href=#AddMounts>Add Mountpoints</a><br>
+&nbsp; &nbsp; &nbsp; 3.8.2. <a href=#HostPort>Broadcaster Host and Port</a><br>
+&nbsp; &nbsp; &nbsp; 3.8.3. <a href=#account>Broadcaster User and Password</a><br>
+&nbsp; &nbsp; &nbsp; 3.8.4. <a href=#GetTable>Get Table</a><br>
+&nbsp; &nbsp; &nbsp; 3.8.5. <a href=#delete>Delete Mountpoints</a><br>
+&nbsp; &nbsp; &nbsp; 3.8.6. <a href=#edit>Edit Mountpoints</a><br>
+3.9. <a href=#log>Log</a><br>
+3.10. <a href=#start>Start</a><br>
+3.11. <a href=#stop>Stop</a><br>
+3.12. <a href=#nw>No Window</a>
 </p>
 
@@ -354,5 +359,54 @@
 </p> 
 
-<p><a name="mountpoints"><h4>3.7. Mountpoints</h4></p>
+<p><a name="thresholds"><h4>3.7. Notice Advisories</h4></p>
+<p>
+It may happen at any time that a stream becomes unavailable or corrupted. Understanding problem situations is of importance for BNC's operator as well as for the affected stream providers so that maintenance efforts can be initiated. Furthermore, continuously trying to decode a corrupted stream can generate an unnecessary workload for BNC.
+</p>
+<p>
+<u>Stream outages:</u> Connection to an NTRIP broadcaster can sometimes be disrupted or a stream requested may temporarily be unavailable. Connection is defined by BNC as broken if no data is coming in for a period of 20 seconds. When this occurs, reconnects are attempted at decreasing rate. BNC first attempts to reconnect with ~1 second lag, if unsuccessful, again in ~2 seconds since the previous attempt. If it is still unsuccessful, it will attempt to reconnect within ~4 seconds since the previous attempt etc. Each attempt doubles the wait time from the previous attempt. The maximum delay between attempts is limited to ~256 seconds. This reconnection process is documented in the 'Log' file/section.
+</p>
+<p>
+<u>Stream corruption:</u> Not each transfer of a chunk of bits (as received) to BNC's internal decoders necessarily results in the return of valid observations. It may need several chunks till the next observation can be derived. Hence BNC collects all returns (success or failure) coming from a decoder within a certain short 'Inspect segment' time span to then decide whether a stream content is okay or not. When a stream is corrupted, the decoding process can be stopped temporarily. Decodings are tried again at decreasing rate. BNC first attempts to decode again after a 30 second lag, if unsuccessful, again in 60 seconds since the previous attempt. If it is still unsuccessful, it will attempt to decode after 120 seconds since the previous attempt etc. Each decoding attempt doubles the wait time from the previous attempt. The maximum delay between attempts is limited to 960 seconds. 
+</p>
+<p>
+If a persistent stream failure or recovery caused by a stream outage or corruption exceeds the 'Failure' or 'Recovery' threshold, BNC can inform its users about this event. The information becomes available in the 'Log' file/section as a 'Begin_Outage', 'End_Outage', 'Begin_Corrupted', or 'End_Corrupted' message. It can also be passed on as a Notice advisory to a 'Notice script' or batch file to keep BNC's operator or affected stream providers up-to-date by email. This functionality lets you use BNC as a real-time performance monitor and alarm system for the network of GNSS reference stations in use.
+</p>
+
+<p><a name="threshFail"><h4>3.7.1 Failure Threshold - optional</h4></p>
+<p>A Notice advisory is generated if no or only corrupted observations are received throughout the 'Failure' threshold time span. Specifying a value of 15 min (default) is recommendable to not bother a BNC user with too much information.
+</p>
+<p>
+Note that specifying a value of zero '0' for both, the 'Failure' and the 'Recovery' threshold means that BNC immediately informs about any failure/recovery and that decoding efforts shall never pause.
+</p> 
+<p>
+Note further that using this function for corrupted streams needs an 'Inspect segment' greater zero '0'.
+</p> 
+
+<p><a name="threshReco"><h4>3.7.2 Recovery Threshold - optional</h4></p>
+<p>
+Following a longer lasting stream outage or series of completely corrupted observations, a Notice advisory is generated as soon as a valid observation is received again at least once within the 'Recovery' threshold time span. Specifying a value of 5 min (default) is recommendable to not bother a BNC user with too much information.
+</p>
+<p>
+Note that specifying a value of zero '0' for both, the 'Failure' and the 'Recovery' threshold means that BNC immediately informs about any failure/recovery and that decoding efforts shall never pause.
+</p> 
+<p>
+Note further that using this function for corrupted streams needs an 'Inspect segment' greater zero '0'.
+</p>
+
+<p><a name="inspectSegm"><h4>3.7.3 Inspect Segment - mandatory for 'Failure' and 'Recovery' thresholds</h4></p>
+<p>
+BNC can collect all returns (failure or success) coming from a decoder within a short 'Inspect segment' time span to then decide whether a stream content is corrupted or not. If a continuous problem (or recovery) is detected, BNC informs about this event. A value of about 15 sec (default) as 'Inspect segment' is recommended when handling 1Hz data. If this value is specified too small, temporary communication bottlenecks my lead to an additional loss of some data of the affected stream.
+</p>
+<p>
+Specifying a value of zero '0' means that you by-pass BNC's corruption check. However, this may result in an additional workload in case of long-lasting stream corruptions. Note that specifying an 'Inspect segment' greater zero '0' is mandatory to generate Notice advisories informing about corrupted streams.
+</p> 
+
+<p><a name="noteScript"><h4>3.7.4 Notice Script - optional </h4></p>
+<p>
+Specify the full path to a script or batch file to handle Notice advisories generated in case of outages or currupted streams. The affected mountpoint and of a comment 'Begin_Outage', 'End_Outage', 'Begin_Currupted', or 'End_Corrupted' are transfered to the script as command line parameters (%1 and %2 on Windows systems, $1 and $2 on Unix/Linux systems).
+</p><p>The script may contain commands to archive outage/corrupt information or to send an email to BNC's operator and/or to the affected stream provider. An empty option field or invalid path means that you don't want to use this option.
+</p> 
+
+<p><a name="mountpoints"><h4>3.8. Mountpoints</h4></p>
 <p>
 Each stream on an NTRIP broadcaster is defined using a unique source ID called mountpoint. An NTRIP client like BNC access the desired data stream by referring to its mountpoint. Information about mountpoints is available through the source-table maintained by the NTRIP broadcaster. Note that mountpoints could show up in BNC more than once when retrieving streams from several NTRIP broadcasters.
@@ -371,20 +425,20 @@
 </table>
 
-<p><a name="AddMounts"><h4>3.7.1 Add Mountpoints</h4></p>
+<p><a name="AddMounts"><h4>3.8.1 Add Mountpoints</h4></p>
 <p>
 Button 'Add Mountpoints' opens a window that allows user to select data streams from an NTRIP broadcaster according to their mountpoints.
 </p> 
 
-<p><a name="HostPort"><h4>3.7.2 Broadcaster Host and Port - required</h4></p>
+<p><a name="HostPort"><h4>3.8.2 Broadcaster Host and Port - required</h4></p>
 <p>
 Enter the NTRIP broadcaster host IP and port number. <u>http://www.rtcm-ntrip.org/home</u> provides information about known NTRIP broadcaster installations. Note that EUREF and IGS operate NTRIP broadcasters at <u>http://www.euref-ip.net/home</u> and <u>http://www.igs-ip.net/home</u>.
 </p> 
 
-<p><a name="account"><h4>3.7.3 Broadcaster User and Password - required for protected streams</h4></p>
+<p><a name="account"><h4>3.8.3 Broadcaster User and Password - required for protected streams</h4></p>
 <p>
 Some streams on NTRIP broadcasters may be restricted. Enter a valid 'User' ID and 'Password' for access to protected streams. Accounts are usually provided per NTRIP broadcaster through a registration procedure. Register through <u>http://igs.bkg.bund.de/index_ntrip_reg.htm</u> for access to protected streams on <u>www.euref-ip.net</u> and <u>www.igs-ip.net</u>.
 </p> 
 
-<p><a name="GetTable"><h4>3.7.4 Get Table</h4></p>
+<p><a name="GetTable"><h4>3.8.4 Get Table</h4></p>
 <p>
 Use the 'Get Table' button to download the source-table from the NTRIP broadcaster. Pay attention to data fields 'format' and 'format-details'. Keep in mind that BNC can only decode and convert streams that come in RTCM Version 2.x, RTCM Version 3.x, or RTIGS format. RTCM Version 2.x streams must contain message types 18 and 19 while RTCM Version 3.x streams must contain GPS or SBAS message types 1002 or 1004 and may contain GLONASS message types 1010 or 1012, see data field 'format-details' for available message types and their repetition rates in brackets. Note that in order to produce RINEX Navigation files RTCM Version 3.x streams containing message types 1019 (GPS) and 1020 (GLONASS) are required. Select your streams line by line, use +Shift and +Ctrl when necessary.
@@ -397,9 +451,9 @@
 </p> 
 
-<p><a name="delete"><h4>3.7.5 Delete Mountpoints</h4></p>
+<p><a name="delete"><h4>3.8.5 Delete Mountpoints</h4></p>
 <p>
 To remove a stream from the 'Mountpoints' list in the main window, highlight it by clicking on it and hit the 'Delete Mountpoints' button. You can also remove multiple mountpoints simultaneously by highlighting them using +Shift and +Ctrl.</p>
 
-<p><a name="edit"><h4>3.7.6 Edit Mountpoints</h4></p>
+<p><a name="edit"><h4>3.8.6 Edit Mountpoints</h4></p>
 <ul>
 <li>
@@ -416,20 +470,20 @@
 </ul> 
 
-<p><a name="log"><h4>3.8. Log - optional</h4></p>
+<p><a name="log"><h4>3.9. Log - optional</h4></p>
 <p>
 Records of BNC's activities are shown in the 'Log' section of the main windows. These logs can be saved into a file when a valid path is specified in the 'Log (full path)' field. The message log covers the communication status between BNC and the NTRIP broadcaster as well as problems that may occur in the communication link, stream availability, stream delay, stream conversion etc. The default value for 'Log (full path)' is an empty option field, meaning that BNC logs will not saved into a file.
 </p>
 
-<p><a name="start"><h4>3.9. Start</h4></p>
+<p><a name="start"><h4>3.10. Start</h4></p>
 <p>
 Hit 'Start' to start retrieving, decoding, and converting GNSS data streams in real-time. Note that 'Start' generally forces BNC to begin with fresh RINEX which might overwrite existing files when necessary unless the option 'Append files' is ticked.
 </p> 
 
-<p><a name="stop"><h4>3.10. Stop</h4></p>
+<p><a name="stop"><h4>3.11. Stop</h4></p>
 <p>
 Hit the 'Stop' button in order to stop BNC. 
 </p> 
 
-<p><a name="nw"><h4>3.11. No Window - optional</h4></p>
+<p><a name="nw"><h4>3.12. No Window - optional</h4></p>
 <p>
 On all systems BNC can be started in batch mode with the command line option '-nw'. BNC will then run in 'no window' mode, using options from the configuration file ${HOME}/.config/BKG/BNC_NTRIP_Client.conf (Unix/Linux, see Config File example in the Annex) or from the register BKG_NTRIP_Client (Windows).
@@ -440,7 +494,4 @@
 <p><a name="limits"><h3>4. Limitations</h3></p>
 <ul>
-<li>
-Connection to an NTRIP broadcaster can sometimes be disrupted or a stream requested may temporarily be unavailable. Connection is defined by BNC as broken if no data is coming in for a period of 20 seconds. When this occurs, reconnects are attempted at decreasing rate. BNC first attempts to reconnect with ~1 second lag, if unsuccessful, again in ~2 seconds since the previous attempt. If it is still unsuccessful, it will attempt to reconnect within ~4 seconds since the previous attempt etc. Each attempt doubles the wait time from the previous attempt. The maximum delay between attempts is limited to ~256 seconds. This reconnection process is documented in the 'Log' file/section.
-</li> 
 <li>
 Currently BNC only handles GPS, SBAS and GLONASS data. Galileo is not yet supported.
Index: trunk/BNC/bncmain.cpp
===================================================================
--- trunk/BNC/bncmain.cpp	(revision 657)
+++ trunk/BNC/bncmain.cpp	(revision 658)
@@ -81,4 +81,7 @@
     settings.setValue("rnxSkel",    "SKL");
     settings.setValue("waitTime",   5);
+    settings.setValue("inspSegm",   "15");
+    settings.setValue("noticeFail", "15");
+    settings.setValue("noticeReco", "5");
   }
 
Index: trunk/BNC/bncwindow.cpp
===================================================================
--- trunk/BNC/bncwindow.cpp	(revision 657)
+++ trunk/BNC/bncwindow.cpp	(revision 658)
@@ -173,5 +173,5 @@
   _rnxAppendCheckBox->setWhatsThis(tr("<p>When BNC is started, new RINEX Observation files are created by default and any existing files with the same name will be overwritten. However, users might want to append observations and ephemeris to existing RINEX files following a restart of BNC, a system crash or when BNC crashed. Tick 'Append files' to continue with existing files and keep what has been recorded so far.</p>"));
   _rnxIntrComboBox    = new QComboBox();
-  _rnxIntrComboBox->setWhatsThis(tr("<p>Select the length of the RINEX Observation file generated.</p>"));
+  _rnxIntrComboBox->setWhatsThis(tr("<p>Select the length of the RINEX Observation file.</p>"));
   _rnxIntrComboBox->setMaximumWidth(9*ww);
   _rnxIntrComboBox->setEditable(false);
@@ -182,5 +182,5 @@
   }
   _ephIntrComboBox    = new QComboBox();
-  _ephIntrComboBox->setWhatsThis(tr("<p>Select the length of the RINEX Navigation file generated.</p>"));
+  _ephIntrComboBox->setWhatsThis(tr("<p>Select the length of the RINEX Navigation file.</p>"));
   _ephIntrComboBox->setMaximumWidth(9*ww);
   _ephIntrComboBox->setEditable(false);
@@ -198,6 +198,33 @@
   _rnxSamplSpinBox->setValue(settings.value("rnxSampl").toInt());
   _rnxSamplSpinBox->setSuffix(" sec");
+  _inspSegmSpinBox    = new QSpinBox();
+  _inspSegmSpinBox->setWhatsThis(tr("<p>Select the RINEX Observation sampling interval in seconds. A value of zero '0' tells BNC to store all received epochs into RINEX.</p>"));
+  _inspSegmSpinBox->setMinimum(0);
+  _inspSegmSpinBox->setMaximum(60);
+  _inspSegmSpinBox->setSingleStep(1);
+  _inspSegmSpinBox->setMaximumWidth(9*ww);
+  _inspSegmSpinBox->setValue(settings.value("inspSegm").toInt());
+  _inspSegmSpinBox->setSuffix(" sec");
+  _inspSegmSpinBox->setWhatsThis(tr("<p>BNC can collect all returns (success or failure) coming from a decoder within a certain short time span (Inspect segment) to then decide whether a stream content is corrupted or not. When a continuous problem is detected, BNC can inform its operator about this event through a Notice advisory. A value of about 15 sec (default) as 'Inspect segment' is recommended when handling 1Hz data.</p><p>A value of zero '0' means that you don't want BNC to inform you about incoming data that can not be decoded.</p>"));
+  _noticeRecoSpinBox = new QSpinBox();
+  _noticeRecoSpinBox->setMinimum(0);
+  _noticeRecoSpinBox->setMaximum(60);
+  _noticeRecoSpinBox->setSingleStep(1);
+  _noticeRecoSpinBox->setSuffix(" min");
+  _noticeRecoSpinBox->setMaximumWidth(9*ww);
+  _noticeRecoSpinBox->setValue(settings.value("noticeReco").toInt());
+  _noticeRecoSpinBox->setWhatsThis(tr("<p>Following a stream outage or a longer series of corrupted observations, a Notice advisory is generated when at least one valid observation is received again within the 'Recovery' threshold time span defined here. A value of about 5min (default) is recommendable. A valu of zero '0' means that BNC immediately informs about any stream recovery. </p><p>Note that using this function for corrupted streams needs an 'Inspect segment' greater zero '0'.</p>"));
+  _noticeFailSpinBox = new QSpinBox();
+  _noticeFailSpinBox->setMinimum(0);
+  _noticeFailSpinBox->setMaximum(60);
+  _noticeFailSpinBox->setSingleStep(1);
+  _noticeFailSpinBox->setSuffix(" min");
+  _noticeFailSpinBox->setMaximumWidth(9*ww);
+  _noticeFailSpinBox->setValue(settings.value("noticeFail").toInt());
+  _noticeFailSpinBox->setWhatsThis(tr("<p>A Notice advisory is generated when no (or corrupted) observations are received throughout the 'Failure' threshold time span defined here. A value of about 15 min (default) is recommendable. A value of zero '0' means that BNC immediately informs about any stream failure.</p><p>Note that using this function forcorrupted streams needs an 'Inspect segment' greater zero '0'.</p>"));
   _logFileLineEdit    = new QLineEdit(settings.value("logFile").toString());
   _logFileLineEdit->setWhatsThis(tr("<p>Records of BNC's activities are shown in the 'Log' section below. They can be saved into a file when a valid path is specified in the 'Log (full path)' field.</p>"));
+  _noticeScriptLineEdit    = new QLineEdit(settings.value("noticeScript").toString());
+  _noticeScriptLineEdit->setWhatsThis(tr("<p>Specify the full path to a script or batch file to handle Notice advisories generated in case of corrupted streams of stream outages. The affected mountpoint and one of the comments 'Begin_Outage', 'End_Outage', 'Begin_Currupted', or 'End_Corrupted' are passed on to the script as two command line parameters.</p><p>The script may be used to send an email to BNC's operator and/or to the affected streamprovider. An empty option field or invalid path means that you don't want to use this option.</p>"));
   _mountPointsTable   = new QTableWidget(0,7);
   _mountPointsTable->setWhatsThis(tr("<p>Streams selected for retrieval are listed in the 'Mountpoints' section. Button 'Add Mountpoints' opens a window that allows the user to select data streams from an NTRIP broadcaster according to their mountpoints. To remove a stream from the 'Mountpoints' list, highlight it by clicking on it and hit the 'Delete Mountpoints' button. You can also remove multiple mountpoints simultaneously by highlighting them using +Shift and +Ctrl.</p><p>BNC automatically allocates one of its internal decoders to a stream based on the stream's 'format' and 'format-details' as given in the source-table. However, there might be cases where you need to override the automatic selection due to incorrect source-table for example. BNC allows users to manually select the required decoder by editing the decoder string. Doubleclick on the 'decoder' field, enter your preferred decoder and then hit Enter. The accepted decoder strings are 'RTCM_2.x', 'RTCM_3.x', and 'RTIGS'.</p><p>In case you need to log the raw data as is, BNC allows users to by-pass its decoders and and directly save the input in daily log files. To do this specify the decoder string as 'ZERO'.</p><p>BNC can also retrieve streams from virtual reference stations (VRS). To initiate these streams, an approximate rover position needs to be sent in NMEA format to the NTRIP broadcaster. In return, a user-specific data stream is generated, typically by a Network-RTK software. This stream is customized to the exact latitude and longitude as shown in the 'lat' and 'long' columns under 'Mountpoints'. These VRS streams are indicated by a 'yes' in the 'nmea' column under 'Mountpoints' as well as in the source-table. The default 'lat' and 'long' values are taken from the source-table. However, in most cases you would probably want to change this according to your requirement. Double-click on 'lat' and 'long' fields, enter the values you wish to send and then hit Enter. The format is in positive north latitude degrees (e.g. for northern hemisphere: 52.436, for southern hemisphere: -24.567) and eastern longitude degrees (example: 358.872 or -1.128). Only mountpoints with a 'yes' in its 'nmea' column can be edited. The position must preferably be a point within the service area of the network.</p>"));
@@ -289,5 +316,5 @@
   layout->addWidget(_outFileLineEdit,                            2, 2, 1, 3);
 
-  layout->addWidget(new QLabel("Port for output"),               3, 0, 1, 2);
+  layout->addWidget(new QLabel("Ports for output"),              3, 0, 1, 2);
   QBoxLayout* bl1 = new QBoxLayout(QBoxLayout::LeftToRight);
   bl1->addWidget(_outPortLineEdit);
@@ -308,5 +335,5 @@
   layout->addWidget(_rnxScrpLineEdit,                            5, 2, 1, 3);
 
-  layout->addWidget(new QLabel("File interval"),                 6, 0, 1, 2);
+  layout->addWidget(new QLabel("File intervals"),                6, 0, 1, 2);
 
   QBoxLayout* bl = new QBoxLayout(QBoxLayout::LeftToRight);
@@ -333,11 +360,24 @@
   _ephV3CheckBox->setWhatsThis(tr("<p>Default format for RINEX Navigation files containing Broadcast Ephemeris is RINEX Version 2.11. Select 'RINEX v3' if you want to save the ephemeris in RINEX Version 3 format.</p>"));
 
-  layout->addWidget(new QLabel("Mountpoints"),                   9, 0, 1, 2);
-
-  layout->addWidget(_mountPointsTable,                          10, 0, 1, 5);
-
-  layout->addWidget(new QLabel("Log (full path)"),              11, 0, 1, 2);
-  layout->addWidget(_logFileLineEdit,                           11, 2, 1, 3);
-  layout->addWidget(_log,                                       12, 0, 1, 5);
+  layout->addWidget(new QLabel("Notice thresholds"),             9, 0, 1, 2);
+  QBoxLayout* bl2 = new QBoxLayout(QBoxLayout::LeftToRight);
+  bl2->addWidget(_noticeFailSpinBox);
+  bl2->addWidget(new QLabel("Failure"));
+  bl2->addWidget(_noticeRecoSpinBox);
+  bl2->addWidget(new QLabel("Recovery"));
+  bl2->addWidget(new QLabel("Inspect segment"));
+  bl2->addWidget(_inspSegmSpinBox);
+  layout->addLayout(bl2, 9, 2, 1, 3);
+
+  layout->addWidget(new QLabel("Notice script (full path)"),    10, 0, 1, 2);
+  layout->addWidget(_noticeScriptLineEdit,                      10, 2, 1, 3);
+
+  layout->addWidget(new QLabel("Mountpoints"),                  11, 0, 1, 2);
+
+  layout->addWidget(_mountPointsTable,                          12, 0, 1, 5);
+
+  layout->addWidget(new QLabel("Log (full path)"),              13, 0, 1, 2);
+  layout->addWidget(_logFileLineEdit,                           13, 2, 1, 3);
+  layout->addWidget(_log,                                       14, 0, 1, 5);
 }
 
@@ -466,4 +506,7 @@
   settings.setValue("proxyPort",   _proxyPortLineEdit->text());
   settings.setValue("waitTime",    _waitTimeSpinBox->value());
+  settings.setValue("inspSegm",    _inspSegmSpinBox->value());
+  settings.setValue("noticeFail",  _noticeFailSpinBox->value());
+  settings.setValue("noticeReco",  _noticeRecoSpinBox->value());
   settings.setValue("outFile",     _outFileLineEdit->text());
   settings.setValue("outPort",     _outPortLineEdit->text());
@@ -480,4 +523,5 @@
   settings.setValue("ephV3",       _ephV3CheckBox->checkState());
   settings.setValue("logFile",     _logFileLineEdit->text());
+  settings.setValue("noticeScript",_noticeScriptLineEdit->text());
   
 QStringList mountPoints;
Index: trunk/BNC/bncwindow.h
===================================================================
--- trunk/BNC/bncwindow.h	(revision 657)
+++ trunk/BNC/bncwindow.h	(revision 658)
@@ -92,4 +92,8 @@
     QCheckBox* _rnxAppendCheckBox;
     QSpinBox*  _waitTimeSpinBox;
+    QSpinBox*  _inspSegmSpinBox;
+    QSpinBox*  _noticeFailSpinBox;
+    QSpinBox*  _noticeRecoSpinBox;
+    QLineEdit* _noticeScriptLineEdit;
     QTableWidget* _mountPointsTable;
 
