Index: trunk/BNC/src/RTCM3/RTCM3Decoder.cpp
===================================================================
--- trunk/BNC/src/RTCM3/RTCM3Decoder.cpp	(revision 9199)
+++ trunk/BNC/src/RTCM3/RTCM3Decoder.cpp	(revision 9201)
@@ -1046,5 +1046,10 @@
     GETFLOATSIGN(eph._Cus,            16, 1.0 / (double )(1 << 29))
     GETFLOAT(eph._sqrt_A,             32, 1.0 / (double )(1 << 19))
-    if (eph._sqrt_A < 1000.0) {return false;}
+    if (eph._sqrt_A < 1000.0) {
+      emit(newMessage(QString("%1: Block %2 (%3) SQRT_A %4 m!")
+           .arg(_staID).arg(1020,4).arg(eph._prn.toString().c_str())
+           .arg(eph._sqrt_A,10,'F',3).toLatin1(), true));
+      return false;
+    }
     GETBITS(i, 16)
     i <<= 4;
@@ -1101,5 +1106,10 @@
     GETBITS(eph._almanac_health, 1) /* almanac healthy */
     GETBITS(eph._almanac_health_availablility_indicator, 1) /* almanac health ok */
-    if (eph._almanac_health_availablility_indicator == 0.0) {return false;}
+    if (eph._almanac_health_availablility_indicator == 0.0) {
+      emit(newMessage(QString("%1: Block %2 (%3): ALM = %4: missing data!")
+           .arg(_staID).arg(1019,4).arg(eph._prn.toString().c_str())
+           .arg(eph._almanac_health_availablility_indicator).toLatin1(), true));
+      return false;
+    }
     GETBITS(eph._P1, 2) /*  P1 */
     GETBITS(i, 5)
@@ -1130,6 +1140,6 @@
     GETFLOATSIGNM(eph._gamma,      11, 1.0 / (double )(1 << 30) / (double )(1 << 10))
     GETBITS(eph._M_P,  2) /* GLONASS-M P, */
-    GETBITS(eph._M_l3, 1) /*GLONASS-M ln (third string) */
-    GETFLOATSIGNM(eph._tau,        22, 1.0 / (double )(1 << 30))    /* GLONASS tau n(tb) */
+    GETBITS(eph._M_l3, 1) /* GLONASS-M ln (third string) */
+    GETFLOATSIGNM(eph._tau,        22, 1.0 / (double )(1 << 30))  /* GLONASS tau n(tb) */
     GETFLOATSIGNM(eph._M_delta_tau, 5, 1.0 / (double )(1 << 30))  /* GLONASS-M delta tau n(tb) */
     GETBITS(eph._E, 5)
@@ -1137,8 +1147,17 @@
     GETBITS(eph._M_FT,  4) /* GLONASS-M Ft */
     GETBITS(eph._M_NT, 11) /* GLONASS-M Nt */
-    if (eph._M_NT == 0.0) {return false;}
+    if (eph._M_NT == 0.0) {
+      emit(newMessage(QString("%1: Block %2 (%3): NT = %4: missing data!")
+           .arg(_staID).arg(1019,4).arg(eph._prn.toString().c_str()).arg(eph._M_NT,4).toLatin1(), true));
+      return false;
+    }
     GETBITS(eph._M_M,   2) /* GLONASS-M M */
     GETBITS(eph._additional_data_availability, 1) /* GLONASS-M The Availability of Additional Data */
-    if (eph._additional_data_availability == 0.0) {return false;}
+    if (eph._additional_data_availability == 0.0) {
+      emit(newMessage(QString("%1: Block %2 (%3): ADD = %4: missing data!")
+           .arg(_staID).arg(1019,4).arg(eph._prn.toString().c_str())
+           .arg(eph._additional_data_availability).toLatin1(), true));
+      return false;
+    }
     GETBITS(eph._NA,  11) /* GLONASS-M Na */
     GETFLOATSIGNM(eph._tauC,       32, 1.0/(double)(1<<30)/(double)(1<<1)) /* GLONASS tau c */
@@ -1155,8 +1174,17 @@
     eph._xv(2) = eph._y_pos * 1.e3;
     eph._xv(3) = eph._z_pos * 1.e3;
+    if (eph._xv.Rows(1,3).NormFrobenius() < 1.0) {
+      emit(newMessage(QString("%1: Block %2 (%3): zero position!")
+           .arg(_staID).arg(1019,4).arg(eph._prn.toString().c_str()).toLatin1(), true));
+      return false;
+    }
     eph._xv(4) = eph._x_velocity * 1.e3;
     eph._xv(5) = eph._y_velocity * 1.e3;
     eph._xv(6) = eph._z_velocity * 1.e3;
-
+    if (eph._xv.Rows(4,6).NormFrobenius() < 1.0) {
+      emit(newMessage(QString("%1: Block %2 (%3): zero velocity!")
+           .arg(_staID).arg(1019,4).arg(eph._prn.toString().c_str()).toLatin1(), true));
+      return false;
+    }
     GLOFreq[sv - 1] = 100 + eph._frequency_number ; /* store frequency for other users (MSM) */
     _gloFrq = QString("%1 %2").arg(eph._prn.toString().c_str()).arg(eph._frequency_number, 2, 'f', 0);
@@ -1203,5 +1231,10 @@
     GETFLOATSIGN(eph._Cus,     16, 1.0 / (double )(1 << 29))
     GETFLOAT(eph._sqrt_A,      32, 1.0 / (double )(1 << 19))
-    if (eph._sqrt_A < 1000.0) {return false;}
+    if (eph._sqrt_A < 1000.0) {
+      emit(newMessage(QString("%1: Block %2 (%3) SQRT_A %4 m!")
+           .arg(_staID).arg(1044,4).arg(eph._prn.toString().c_str())
+           .arg(eph._sqrt_A,10,'F',3).toLatin1(), true));
+      return false;
+    }
     GETBITS(i, 16)
     i <<= 4;
@@ -1312,5 +1345,10 @@
     GETFLOAT(eph._e,            32, 1.0 / (double )(1 << 30) / (double )(1 << 3))
     GETFLOAT(eph._sqrt_A,       32, 1.0 / (double )(1 << 19))
-    if (eph._sqrt_A < 1000.0) {return false;}
+    if (eph._sqrt_A < 1000.0) {
+      emit(newMessage(QString("%1: Block %2 (%3) SQRT_A %4 m!")
+           .arg(_staID).arg(1041,4).arg(eph._prn.toString().c_str())
+           .arg(eph._sqrt_A,10,'F',3).toLatin1(), true));
+      return false;
+    }
     GETFLOATSIGN(eph._OMEGA0,   32, R2R_PI/(double)(1<<30)/(double)(1<< 1))
     GETFLOATSIGN(eph._omega,    32, R2R_PI/(double)(1<<30)/(double)(1<< 1))
@@ -1354,4 +1392,11 @@
     GETFLOATSIGN(eph._y_pos, 30, 0.08)
     GETFLOATSIGN(eph._z_pos, 25, 0.4)
+    ColumnVector pos(3);
+    pos(1) = eph._x_pos; pos(2) = eph._y_pos; pos(3) = eph._z_pos;
+    if (pos.NormFrobenius() < 1.0) {
+      emit(newMessage(QString("%1: Block %2 (%3): zero position!")
+           .arg(_staID).arg(1043,4).arg(eph._prn.toString().c_str()).toLatin1(), true));
+      return false;
+    }
     GETFLOATSIGN(eph._x_velocity, 17, 0.000625)
     GETFLOATSIGN(eph._y_velocity, 17, 0.000625)
@@ -1410,5 +1455,4 @@
     GETFLOATSIGN(eph._Cus,            16, 1.0 / (double )(1 << 29))
     GETFLOAT(eph._sqrt_A,             32, 1.0 / (double )(1 << 19))
-    if (eph._sqrt_A < 1000.0) {return false;}
     GETBITSFACTOR(eph._TOEsec, 14, 60)
     /* FIXME: overwrite value, copied from old code */
@@ -1433,8 +1477,14 @@
       GETBITS(eph._e1DataInValid, 1)
       if (eph._E5bHS != eph._E1_bHS) {
+        emit(newMessage(QString("%1: Block %2 (%3) SHS E5b %4 E1B %5: inconsistent health!")
+             .arg(_staID).arg(1046,4).arg(eph._prn.toString().c_str())
+             .arg(eph._E5bHS).arg(eph._E1_bHS).toLatin1(), true));
         return false;
       }
       if ((eph._BGD_1_5A == 0.0 && fabs(eph._BGD_1_5B) > 1e-9) ||
           (eph._BGD_1_5B == 0.0 && fabs(eph._BGD_1_5A) > 1e-9)) {
+        emit(newMessage(QString("%1: Block %2 (%3) BGD_15a = %4 BGD_15b = %5: inconsistent BGD!")
+             .arg(_staID).arg(1046,4).arg(eph._prn.toString().c_str())
+             .arg(eph._BGD_1_5A,10,'E',3).arg(eph._BGD_1_5B,10,'E',3).toLatin1(), true));
         return false;
       }
@@ -1452,4 +1502,11 @@
     }
     eph._TOT = 0.9999e9;
+
+    if (eph._sqrt_A < 1000.0) {
+      emit(newMessage(QString("%1: Block %2 (%3) SQRT_A %4 m!")
+           .arg(_staID).arg(eph._inav? 1046 : 1045,4).arg(eph._prn.toString().c_str())
+           .arg(eph._sqrt_A,10,'F',3).toLatin1(), true));
+      return false;
+    }
 
     emit newGalileoEph(eph);
@@ -1498,5 +1555,10 @@
     GETFLOATSIGN(eph._Cus,     18, 1.0 / (double )(1 << 30) / (double )(1 << 1))
     GETFLOAT(eph._sqrt_A,      32, 1.0 / (double )(1 << 19))
-    if (eph._sqrt_A < 1000.0) {return false;}
+    if (eph._sqrt_A < 1000.0) {
+      emit(newMessage(QString("%1: Block %2 (%3) SQRT_A %4 m!")
+           .arg(_staID).arg(1042,4).arg(eph._prn.toString().c_str())
+           .arg(eph._sqrt_A,10,'F',3).toLatin1(), true));
+      return false;
+    }
     GETBITS(i, 17)
     i <<= 3;
@@ -1708,7 +1770,9 @@
           case 1045:
           case 1046:
-            // reject 1045/1046 from JAXA RTKLIB encoded stations
             if (_staID.contains("AIRA") || _staID.contains("STK2") ||
                 _staID.contains("CCJ2") || _staID.contains("SYOG")) {
+              emit(newMessage(
+                   QString("%1: Block temporary %2 from JAXA RTKLIB encoded stations!")
+                       .arg(_staID).arg(id).toLatin1(), true));
               break;
             }
