Index: trunk/rtcm3torinex/lib/rtcm3torinex.c
===================================================================
--- trunk/rtcm3torinex/lib/rtcm3torinex.c	(revision 3270)
+++ trunk/rtcm3torinex/lib/rtcm3torinex.c	(revision 3581)
@@ -930,6 +930,6 @@
           {GNSSENTRY_P1DATA,GNSSENTRY_L1PDATA,GNSSENTRY_D1PDATA,
           GNSSENTRY_S1PDATA,GNSSDF2_LOCKLOSSL1,GPS_WAVELENGTH_L1,"1W"},
-          {GNSSENTRY_P1DATA,GNSSENTRY_L1PDATA,GNSSENTRY_D1PDATA,
-          GNSSENTRY_S1PDATA,GNSSDF2_LOCKLOSSL1,GPS_WAVELENGTH_L1,"1Y"},
+          {0,0,0,0,0,0,0}/*{GNSSENTRY_P1DATA,GNSSENTRY_L1PDATA,GNSSENTRY_D1PDATA,
+          GNSSENTRY_S1PDATA,GNSSDF2_LOCKLOSSL1,GPS_WAVELENGTH_L1,"1Y"}*/,
           {0,0,0,0,0,0,0},
           {0,0,0,0,0,0,0},
@@ -940,6 +940,6 @@
           {GNSSENTRY_P2DATA,GNSSENTRY_L2PDATA,GNSSENTRY_D2PDATA,
           GNSSENTRY_S2PDATA,GNSSDF2_LOCKLOSSL2,GPS_WAVELENGTH_L2,"2W"},
-          {GNSSENTRY_P2DATA,GNSSENTRY_L2PDATA,GNSSENTRY_D2PDATA,
-          GNSSENTRY_S2PDATA,GNSSDF2_LOCKLOSSL2,GPS_WAVELENGTH_L2,"2Y"},
+          {0,0,0,0,0,0,0}/*{GNSSENTRY_P2DATA,GNSSENTRY_L2PDATA,GNSSENTRY_D2PDATA,
+          GNSSENTRY_S2PDATA,GNSSDF2_LOCKLOSSL2,GPS_WAVELENGTH_L2,"2Y"}*/,
           {0,0,0,0,0,0,0},
           {0,0,0,0,0,0,0},
@@ -960,5 +960,16 @@
           GNSSENTRY_S5DATA,GNSSDF2_LOCKLOSSL5,GPS_WAVELENGTH_L5,"5Q"},
           {GNSSENTRY_C5DATA,GNSSENTRY_L5DATA,GNSSENTRY_D5DATA,
-          GNSSENTRY_S5DATA,GNSSDF2_LOCKLOSSL5,GPS_WAVELENGTH_L5,"5X"}
+          GNSSENTRY_S5DATA,GNSSDF2_LOCKLOSSL5,GPS_WAVELENGTH_L5,"5X"},
+          {0,0,0,0,0,0,0},
+          {0,0,0,0,0,0,0},
+          {0,0,0,0,0,0,0},
+          {0,0,0,0,0,0,0},
+          {0,0,0,0,0,0,0},
+          {GNSSENTRY_C1DATA,GNSSENTRY_L1CDATA,GNSSENTRY_D1CDATA,
+          GNSSENTRY_S1CDATA,GNSSDF2_LOCKLOSSL1,0.0,"1S"},
+          {GNSSENTRY_C1DATA,GNSSENTRY_L1CDATA,GNSSENTRY_D1CDATA,
+          GNSSENTRY_S1CDATA,GNSSDF2_LOCKLOSSL1,0.0,"1L"},
+          {GNSSENTRY_C1DATA,GNSSENTRY_L1CDATA,GNSSENTRY_D1CDATA,
+          GNSSENTRY_S1CDATA,GNSSDF2_LOCKLOSSL1,0.0,"1X"}
         };
         /* NOTE: Uses 0.0, 1.0 for wavelength as sat index dependence is done later! */
@@ -992,4 +1003,12 @@
           {0,0,0,0,0,0,0},
           {0,0,0,0,0,0,0},
+          {0,0,0,0,0,0,0},
+          {0,0,0,0,0,0,0},
+          {0,0,0,0,0,0,0},
+          {0,0,0,0,0,0,0},
+          {0,0,0,0,0,0,0},
+          {0,0,0,0,0,0,0},
+          {0,0,0,0,0,0,0},
+          {0,0,0,0,0,0,0},
           {0,0,0,0,0,0,0}
         };
@@ -999,23 +1018,23 @@
           {GNSSENTRY_C1DATA,GNSSENTRY_L1CDATA,GNSSENTRY_D1CDATA,
           GNSSENTRY_S1CDATA,GNSSDF2_LOCKLOSSL1,GAL_WAVELENGTH_E1,"1C"},
-          {GNSSENTRY_C1DATA,GNSSENTRY_L1CDATA,GNSSENTRY_D1CDATA,
-          GNSSENTRY_S1CDATA,GNSSDF2_LOCKLOSSL1,GAL_WAVELENGTH_E1,"1A"},
+          {0,0,0,0,0,0,0}/*{GNSSENTRY_C1DATA,GNSSENTRY_L1CDATA,GNSSENTRY_D1CDATA,
+          GNSSENTRY_S1CDATA,GNSSDF2_LOCKLOSSL1,GAL_WAVELENGTH_E1,"1A"}*/,
           {GNSSENTRY_C1DATA,GNSSENTRY_L1CDATA,GNSSENTRY_D1CDATA,
           GNSSENTRY_S1CDATA,GNSSDF2_LOCKLOSSL1,GAL_WAVELENGTH_E1,"1B"},
-          {GNSSENTRY_C1DATA,GNSSENTRY_L1CDATA,GNSSENTRY_D1CDATA,
-          GNSSENTRY_S1CDATA,GNSSDF2_LOCKLOSSL1,GAL_WAVELENGTH_E1,"1X"},
-          {GNSSENTRY_C1DATA,GNSSENTRY_L1CDATA,GNSSENTRY_D1CDATA,
-          GNSSENTRY_S1CDATA,GNSSDF2_LOCKLOSSL1,GAL_WAVELENGTH_E1,"1Z"},
+          {0,0,0,0,0,0,0}/*{GNSSENTRY_C1DATA,GNSSENTRY_L1CDATA,GNSSENTRY_D1CDATA,
+          GNSSENTRY_S1CDATA,GNSSDF2_LOCKLOSSL1,GAL_WAVELENGTH_E1,"1X"}*/,
+          {0,0,0,0,0,0,0}/*{GNSSENTRY_C1DATA,GNSSENTRY_L1CDATA,GNSSENTRY_D1CDATA,
+          GNSSENTRY_S1CDATA,GNSSDF2_LOCKLOSSL1,GAL_WAVELENGTH_E1,"1Z"}*/,
           {0,0,0,0,0,0,0},
           {GNSSENTRY_C6DATA,GNSSENTRY_L6DATA,GNSSENTRY_D6DATA,
-          GNSSENTRY_S6DATA,GNSSDF2_LOCKLOSSE6,GAL_WAVELENGTH_E6,"6I"},
+          GNSSENTRY_S6DATA,GNSSDF2_LOCKLOSSE6,GAL_WAVELENGTH_E6,"6C"},
+          {0,0,0,0,0,0,0}/*{GNSSENTRY_C6DATA,GNSSENTRY_L6DATA,GNSSENTRY_D6DATA,
+          GNSSENTRY_S6DATA,GNSSDF2_LOCKLOSSE6,GAL_WAVELENGTH_E6,"6A"}*/,
           {GNSSENTRY_C6DATA,GNSSENTRY_L6DATA,GNSSENTRY_D6DATA,
-          GNSSENTRY_S6DATA,GNSSDF2_LOCKLOSSE6,GAL_WAVELENGTH_E6,"6Q"},
-          {GNSSENTRY_C6DATA,GNSSENTRY_L6DATA,GNSSENTRY_D6DATA,
-          GNSSENTRY_S6DATA,GNSSDF2_LOCKLOSSE6,GAL_WAVELENGTH_E6,"6I"},
-          {GNSSENTRY_C6DATA,GNSSENTRY_L6DATA,GNSSENTRY_D6DATA,
-          GNSSENTRY_S6DATA,GNSSDF2_LOCKLOSSE6,GAL_WAVELENGTH_E6,"6Q"},
-          {GNSSENTRY_C6DATA,GNSSENTRY_L6DATA,GNSSENTRY_D6DATA,
-          GNSSENTRY_S6DATA,GNSSDF2_LOCKLOSSE6,GAL_WAVELENGTH_E6,"6X"},
+          GNSSENTRY_S6DATA,GNSSDF2_LOCKLOSSE6,GAL_WAVELENGTH_E6,"6B"},
+          {0,0,0,0,0,0,0}/*{GNSSENTRY_C6DATA,GNSSENTRY_L6DATA,GNSSENTRY_D6DATA,
+          GNSSENTRY_S6DATA,GNSSDF2_LOCKLOSSE6,GAL_WAVELENGTH_E6,"6X"}*/,
+          {0,0,0,0,0,0,0}/*{GNSSENTRY_C6DATA,GNSSENTRY_L6DATA,GNSSENTRY_D6DATA,
+          GNSSENTRY_S6DATA,GNSSDF2_LOCKLOSSE6,GAL_WAVELENGTH_E6,"6Z"}*/,
           {0,0,0,0,0,0,0},
           {GNSSENTRY_C5BDATA,GNSSENTRY_L5BDATA,GNSSENTRY_D5BDATA,
@@ -1023,6 +1042,6 @@
           {GNSSENTRY_C5BDATA,GNSSENTRY_L5BDATA,GNSSENTRY_D5BDATA,
           GNSSENTRY_S5BDATA,GNSSDF2_LOCKLOSSE5B,GAL_WAVELENGTH_E5B,"7Q"},
-          {GNSSENTRY_C5BDATA,GNSSENTRY_L5BDATA,GNSSENTRY_D5BDATA,
-          GNSSENTRY_S5BDATA,GNSSDF2_LOCKLOSSE5B,GAL_WAVELENGTH_E5B,"7X"},
+          {0,0,0,0,0,0,0}/*{GNSSENTRY_C5BDATA,GNSSENTRY_L5BDATA,GNSSENTRY_D5BDATA,
+          GNSSENTRY_S5BDATA,GNSSDF2_LOCKLOSSE5B,GAL_WAVELENGTH_E5B,"7X"}*/,
           {0,0,0,0,0,0,0},
           {GNSSENTRY_C5ABDATA,GNSSENTRY_L5ABDATA,GNSSENTRY_D5ABDATA,
@@ -1030,6 +1049,6 @@
           {GNSSENTRY_C5ABDATA,GNSSENTRY_L5ABDATA,GNSSENTRY_D5ABDATA,
           GNSSENTRY_S5ABDATA,GNSSDF2_LOCKLOSSE5AB,GAL_WAVELENGTH_E5AB,"8Q"},
-          {GNSSENTRY_C5ABDATA,GNSSENTRY_L5ABDATA,GNSSENTRY_D5ABDATA,
-          GNSSENTRY_S5ABDATA,GNSSDF2_LOCKLOSSE5AB,GAL_WAVELENGTH_E5AB,"8X"},
+          {0,0,0,0,0,0,0}/*{GNSSENTRY_C5ABDATA,GNSSENTRY_L5ABDATA,GNSSENTRY_D5ABDATA,
+          GNSSENTRY_S5ABDATA,GNSSDF2_LOCKLOSSE5AB,GAL_WAVELENGTH_E5AB,"8X"}*/,
           {0,0,0,0,0,0,0},
           {GNSSENTRY_C5DATA,GNSSENTRY_L5DATA,GNSSENTRY_D5DATA,
@@ -1037,6 +1056,14 @@
           {GNSSENTRY_C5DATA,GNSSENTRY_L5DATA,GNSSENTRY_D5DATA,
           GNSSENTRY_S5DATA,GNSSDF2_LOCKLOSSL5,GAL_WAVELENGTH_E5A,"5Q"},
-          {GNSSENTRY_C5DATA,GNSSENTRY_L5DATA,GNSSENTRY_D5DATA,
-          GNSSENTRY_S5DATA,GNSSDF2_LOCKLOSSL5,GAL_WAVELENGTH_E5A,"5X"},
+          {0,0,0,0,0,0,0}/*{GNSSENTRY_C5DATA,GNSSENTRY_L5DATA,GNSSENTRY_D5DATA,
+          GNSSENTRY_S5DATA,GNSSDF2_LOCKLOSSL5,GAL_WAVELENGTH_E5A,"5X"}*/,
+          {0,0,0,0,0,0,0},
+          {0,0,0,0,0,0,0},
+          {0,0,0,0,0,0,0},
+          {0,0,0,0,0,0,0},
+          {0,0,0,0,0,0,0},
+          {0,0,0,0,0,0,0},
+          {0,0,0,0,0,0,0},
+          {0,0,0,0,0,0,0},
         };
 
@@ -1045,5 +1072,6 @@
         uint64_t satmask, cellmask, ui;
         double rrmod[RTCM3_MSM_NUMSAT];
-        int rrint[RTCM3_MSM_NUMSAT], rdop[RTCM3_MSM_NUMSAT];
+        int rrint[RTCM3_MSM_NUMSAT], rdop[RTCM3_MSM_NUMSAT],
+        extsat[RTCM3_MSM_NUMSAT];
         int ll[RTCM3_MSM_NUMCELLS];
         double cnr[RTCM3_MSM_NUMCELLS];
@@ -1087,5 +1115,5 @@
 
         GETBITS(syncf, 1)
-        SKIPBITS(3+7+1)
+        SKIPBITS(3+7+2+2+1+3)
         GETBITS64(satmask, RTCM3_MSM_NUMSAT)
 
@@ -1104,5 +1132,5 @@
           ++wasnoamb;
           for(j = numsat; j--;)
-            GETFLOAT(rrmod[j], 10, 1/1024.0)
+            GETFLOAT(rrmod[j], 10, 1.0/1024.0)
           break;
         case 4: case 6:
@@ -1110,5 +1138,5 @@
             GETBITS(rrint[j], 8)
           for(j = numsat; j--;)
-            GETFLOAT(rrmod[j], 10, 1/1024.0)
+            GETFLOAT(rrmod[j], 10, 1.0/1024.0)
           break;
         case 5: case 7:
@@ -1116,5 +1144,7 @@
             GETBITS(rrint[j], 8)
           for(j = numsat; j--;)
-            GETFLOAT(rrmod[j], 10, 1/1024.0)
+            GETBITS(extsat[j], 4)
+          for(j = numsat; j--;)
+            GETFLOAT(rrmod[j], 10, 1.0/1024.0)
           for(j = numsat; j--;)
             GETBITSSIGN(rdop[j], 14)
@@ -1130,10 +1160,10 @@
             for(count = numcells; count--;)
               if(cellmask & (UINT64(1)<<count))
-                GETFLOATSIGN(psr[count], 15, 0.02)
+                GETFLOATSIGN(psr[count], 15, 1.0/(1<<24))
             break;
           case 2:
             for(count = numcells; count--;)
               if(cellmask & (UINT64(1)<<count))
-                GETFLOATSIGN(cp[count], 20, 1/256.0)
+                GETFLOATSIGN(cp[count], 22, 1.0/(1<<29))
             for(count = numcells; count--;)
               if(cellmask & (UINT64(1)<<count))
@@ -1143,8 +1173,8 @@
             for(count = numcells; count--;)
               if(cellmask & (UINT64(1)<<count))
-                GETFLOATSIGN(psr[count], 15, 0.02)
+                GETFLOATSIGN(psr[count], 15, 1.0/(1<<24))
             for(count = numcells; count--;)
               if(cellmask & (UINT64(1)<<count))
-                GETFLOATSIGN(cp[count], 20, 1/256.0)
+                GETFLOATSIGN(cp[count], 22, 1.0/(1<<29))
             for(count = numcells; count--;)
               if(cellmask & (UINT64(1)<<count))
@@ -1154,8 +1184,8 @@
             for(count = numcells; count--;)
               if(cellmask & (UINT64(1)<<count))
-                GETFLOATSIGN(psr[count], 15, 0.02)
+                GETFLOATSIGN(psr[count], 15, 1.0/(1<<24))
             for(count = numcells; count--;)
               if(cellmask & (UINT64(1)<<count))
-                GETFLOATSIGN(cp[count], 20, 1/256.0)
+                GETFLOATSIGN(cp[count], 22, 1.0/(1<<29))
             for(count = numcells; count--;)
               if(cellmask & (UINT64(1)<<count))
@@ -1168,8 +1198,8 @@
             for(count = numcells; count--;)
               if(cellmask & (UINT64(1)<<count))
-                GETFLOATSIGN(psr[count], 15, 0.02)
+                GETFLOATSIGN(psr[count], 15, 1.0/(1<<24))
             for(count = numcells; count--;)
               if(cellmask & (UINT64(1)<<count))
-                GETFLOATSIGN(cp[count], 20, 1/256.0)
+                GETFLOATSIGN(cp[count], 22, 1.0/(1<<29))
             for(count = numcells; count--;)
               if(cellmask & (UINT64(1)<<count))
@@ -1185,8 +1215,8 @@
             for(count = numcells; count--;)
               if(cellmask & (UINT64(1)<<count))
-                GETFLOATSIGN(psr[count], 20, 0.001)
+                GETFLOATSIGN(psr[count], 20, 1.0/(1<<29))
             for(count = numcells; count--;)
               if(cellmask & (UINT64(1)<<count))
-                GETFLOATSIGN(cp[count], 22, 1/1024.0)
+                GETFLOATSIGN(cp[count], 24, 1.0/(1U<<31))
             for(count = numcells; count--;)
               if(cellmask & (UINT64(1)<<count))
@@ -1195,11 +1225,12 @@
               if(cellmask & (UINT64(1)<<count))
                 GETFLOAT(cnr[count], 10, 0.1)
+            break;
           case 7:
             for(count = numcells; count--;)
               if(cellmask & (UINT64(1)<<count))
-                GETFLOATSIGN(psr[count], 20, 0.001)
+                GETFLOATSIGN(psr[count], 20, 1.0/(1<<29))
             for(count = numcells; count--;)
               if(cellmask & (UINT64(1)<<count))
-                GETFLOATSIGN(cp[count], 22, 1/1024.0)
+                GETFLOATSIGN(cp[count], 24, 1.0/(1U<<31))
             for(count = numcells; count--;)
               if(cellmask & (UINT64(1)<<count))
@@ -1272,7 +1303,7 @@
                 {
                 case 1:
-                  if(psr[count] > -327.68)
+                  if(psr[count] > -1.0/(1<<10))
                   {
-                    gnss->measdata[num][cd.typeR] = psr[count]
+                    gnss->measdata[num][cd.typeR] = psr[count]*LIGHTSPEED/1000.0
                     +(rrmod[numsat])*LIGHTSPEED/1000.0;
                     gnss->dataflags[num] |= (1<<cd.typeR);
@@ -1280,7 +1311,7 @@
                   break;
                 case 2:
-                  if(wl && cp[count] > -2048.0)
+                  if(wl && cp[count] > -1.0/(1<<8))
                   {
-                    gnss->measdata[num][cd.typeP] = cp[count]
+                    gnss->measdata[num][cd.typeP] = cp[count]*LIGHTSPEED/1000.0
                     +(rrmod[numsat])*LIGHTSPEED/1000.0/wl;
                     if(handle->lastlockmsm[j][i] != ll[count])
@@ -1293,14 +1324,14 @@
                   break;
                 case 3:
-                  if(psr[count] > -327.68)
+                  if(psr[count] > -1.0/(1<<10))
                   {
-                    gnss->measdata[num][cd.typeR] = psr[count]
+                    gnss->measdata[num][cd.typeR] = psr[count]*LIGHTSPEED/1000.0
                     +(rrmod[numsat])*LIGHTSPEED/1000.0;
                     gnss->dataflags[num] |= (1<<cd.typeR);
                   }
 
-                  if(wl && cp[count] > -2048.0)
+                  if(wl && cp[count] > -1.0/(1<<8))
                   {
-                    gnss->measdata[num][cd.typeP] = cp[count]
+                    gnss->measdata[num][cd.typeP] = cp[count]*LIGHTSPEED/1000.0
                     +(rrmod[numsat]+rrint[numsat])*LIGHTSPEED/1000.0/wl;
                     if(handle->lastlockmsm[j][i] != ll[count])
@@ -1313,14 +1344,14 @@
                   break;
                 case 4:
-                  if(psr[count] > -327.68)
+                  if(psr[count] > -1.0/(1<<10))
                   {
-                    gnss->measdata[num][cd.typeR] = psr[count]
+                    gnss->measdata[num][cd.typeR] = psr[count]*LIGHTSPEED/1000.0
                     +(rrmod[numsat]+rrint[numsat])*LIGHTSPEED/1000.0;
                     gnss->dataflags[num] |= (1<<cd.typeR);
                   }
 
-                  if(wl && cp[count] > -2048.0)
+                  if(wl && cp[count] > -1.0/(1<<8))
                   {
-                    gnss->measdata[num][cd.typeP] = cp[count]
+                    gnss->measdata[num][cd.typeP] = cp[count]*LIGHTSPEED/1000.0
                     +(rrmod[numsat]+rrint[numsat])*LIGHTSPEED/1000.0/wl;
                     if(handle->lastlockmsm[j][i] != ll[count])
@@ -1336,14 +1367,14 @@
                   break;
                 case 5:
-                  if(psr[count] > -327.68)
+                  if(psr[count] > -1.0/(1<<10))
                   {
-                    gnss->measdata[num][cd.typeR] = psr[count]
+                    gnss->measdata[num][cd.typeR] = psr[count]*LIGHTSPEED/1000.0
                     +(rrmod[numsat]+rrint[numsat])*LIGHTSPEED/1000.0;
                     gnss->dataflags[num] |= (1<<cd.typeR);
                   }
 
-                  if(wl && cp[count] > -2048.0)
+                  if(wl && cp[count] > -1.0/(1<<8))
                   {
-                    gnss->measdata[num][cd.typeP] = cp[count]
+                    gnss->measdata[num][cd.typeP] = cp[count]*LIGHTSPEED/1000.0
                     +(rrmod[numsat]+rrint[numsat])*LIGHTSPEED/1000.0/wl;
                     if(handle->lastlockmsm[j][i] != ll[count])
@@ -1366,14 +1397,14 @@
                   break;
                 case 6:
-                  if(psr[count] > -524.288)
+                  if(psr[count] > -1.0/(1<<10))
                   {
-                    gnss->measdata[num][cd.typeR] = psr[count]
+                    gnss->measdata[num][cd.typeR] = psr[count]*LIGHTSPEED/1000.0
                     +(rrmod[numsat]+rrint[numsat])*LIGHTSPEED/1000.0;
                     gnss->dataflags[num] |= (1<<cd.typeR);
                   }
 
-                  if(wl && cp[count] > -2048.0)
+                  if(wl && cp[count] > -1.0/(1<<8))
                   {
-                    gnss->measdata[num][cd.typeP] = cp[count]
+                    gnss->measdata[num][cd.typeP] = cp[count]*LIGHTSPEED/1000.0
                     +(rrmod[numsat]+rrint[numsat])*LIGHTSPEED/1000.0/wl;
                     if(handle->lastlockmsm[j][i] != ll[count])
@@ -1389,14 +1420,14 @@
                   break;
                 case 7:
-                  if(psr[count] > -524.288)
+                  if(psr[count] > -1.0/(1<<10))
                   {
-                    gnss->measdata[num][cd.typeR] = psr[count]
+                    gnss->measdata[num][cd.typeR] = psr[count]*LIGHTSPEED/1000.0
                     +(rrmod[numsat]+rrint[numsat])*LIGHTSPEED/1000.0;
                     gnss->dataflags[num] |= (1<<cd.typeR);
                   }
 
-                  if(wl && cp[count] > -2048.0)
+                  if(wl && cp[count] > -1.0/(1<<8))
                   {
-                    gnss->measdata[num][cd.typeP] = cp[count]
+                    gnss->measdata[num][cd.typeP] = cp[count]*LIGHTSPEED/1000.0
                     +(rrmod[numsat]+rrint[numsat])*LIGHTSPEED/1000.0/wl;
                     if(handle->lastlockmsm[j][i] != ll[count])
