Index: trunk/BNC/RTCM3/rtcm3.cpp
===================================================================
--- trunk/BNC/RTCM3/rtcm3.cpp	(revision 70)
+++ trunk/BNC/RTCM3/rtcm3.cpp	(revision 71)
@@ -27,5 +27,5 @@
   tim = time(0) - ((10*365+2+5)*24*60*60 + LEAPSECONDS);
   _Parser.GPSWeek = tim/(7*24*60*60);
-  _Parser.GPSTOW = tim%(7*24*60*60);
+  _Parser.GPSTOW  = tim%(7*24*60*60);
 }
 
@@ -39,5 +39,98 @@
 void rtcm3::Decode(char* buffer, int bufLen) {
   for (int ii = 0; ii < bufLen; ii++) {
-    HandleByte(&_Parser, buffer[ii]);
+
+    ////    HandleByte(&_Parser, buffer[ii]);
+
+    _Parser.Message[_Parser.MessageSize++] = buffer[ii];
+    if(_Parser.MessageSize >= _Parser.NeedBytes)
+    {
+      int r;
+      while((r = RTCM3Parser(&_Parser)))
+      {
+        int i, j, o;
+        struct converttimeinfo cti;
+    
+        if(!_Parser.init)
+        {
+          HandleHeader(&_Parser);
+          _Parser.init = 1;
+        }
+        if(r == 2 && !_Parser.validwarning)
+        {
+          printf("No valid RINEX! All values are modulo 299792.458!"
+          "           COMMENT\n");
+          _Parser.validwarning = 1;
+        }
+    
+        converttime(&cti, _Parser.Data.week,
+        floor(_Parser.Data.timeofweek/1000.0));
+        printf(" %02d %2d %2d %2d %2d %10.7f  0%3d",
+        cti.year%100, cti.month, cti.day, cti.hour, cti.minute, cti.second
+        + fmod(_Parser.Data.timeofweek/1000.0,1.0), _Parser.Data.numsats);
+        for(i = 0; i < 12 && i < _Parser.Data.numsats; ++i)
+        {
+          if(_Parser.Data.satellites[i] <= PRN_GPS_END)
+            printf("G%02d", _Parser.Data.satellites[i]);
+          else if(_Parser.Data.satellites[i] >= PRN_GLONASS_START
+          && _Parser.Data.satellites[i] <= PRN_GLONASS_END)
+            printf("R%02d", _Parser.Data.satellites[i] - (PRN_GLONASS_START-1));
+          else
+            printf("%3d", _Parser.Data.satellites[i]);
+        }
+        printf("\n");
+        o = 12;
+        j = _Parser.Data.numsats - 12;
+        while(j > 0)
+        {
+          printf("                                ");
+          for(i = o; i < o+12 && i < _Parser.Data.numsats; ++i)
+          {
+            if(_Parser.Data.satellites[i] <= PRN_GPS_END)
+              printf("G%02d", _Parser.Data.satellites[i]);
+            else if(_Parser.Data.satellites[i] >= PRN_GLONASS_START
+            && _Parser.Data.satellites[i] <= PRN_GLONASS_END)
+              printf("R%02d", _Parser.Data.satellites[i] - (PRN_GLONASS_START-1));
+            else
+              printf("%3d", _Parser.Data.satellites[i]);
+          }
+          printf("\n");
+          j -= 12;
+          o += 12;
+        }
+        for(i = 0; i < _Parser.Data.numsats; ++i)
+        {
+          for(j = 0; j < _Parser.numdatatypes; ++j)
+          {
+            if(!(_Parser.Data.dataflags[i] & _Parser.dataflag[j])
+            || isnan(_Parser.Data.measdata[i][_Parser.datapos[j]])
+            || isinf(_Parser.Data.measdata[i][_Parser.datapos[j]]))
+            { /* no or illegal data */
+              printf("                ");
+            }
+            else
+            {
+              char lli = ' ';
+              char snr = ' ';
+              if(_Parser.dataflag[j] & (GNSSDF_L1CDATA|GNSSDF_L1PDATA))
+              {
+                if(_Parser.Data.dataflags[i] & GNSSDF_LOCKLOSSL1)
+                  lli = '1';
+                snr = '0'+_Parser.Data.snrL1[i];
+              }
+              if(_Parser.dataflag[j] & (GNSSDF_L2CDATA|GNSSDF_L2PDATA))
+              {
+                if(_Parser.Data.dataflags[i] & GNSSDF_LOCKLOSSL2)
+                  lli = '1';
+                snr = '0'+_Parser.Data.snrL2[i];
+              }
+              printf("%14.3f%c%c",
+              _Parser.Data.measdata[i][_Parser.datapos[j]],lli,snr);
+            }
+            if(j%5 == 4 || j == _Parser.numdatatypes-1)
+              printf("\n");
+          }
+        }
+      }
+    }
   }
 }
Index: trunk/BNC/RTCM3/rtcm3torinex.cpp
===================================================================
--- trunk/BNC/RTCM3/rtcm3torinex.cpp	(revision 70)
+++ trunk/BNC/RTCM3/rtcm3torinex.cpp	(revision 71)
@@ -1,5 +1,5 @@
 /*
   Converter for RTCM3 data to RINEX.
-  $Id: rtcm3torinex.cpp,v 1.1 2006/08/24 13:24:14 mervart Exp $
+  $Id: rtcm3torinex.cpp,v 1.2 2006/08/24 13:56:49 mervart Exp $
 
   Program written bei
@@ -58,23 +58,12 @@
 
 /* CVS revision and version */
-static char revisionstr[] = "$Revision: 1.1 $";
-static char datestr[]     = "$Date: 2006/08/24 13:24:14 $";
+static char revisionstr[] = "$Revision: 1.2 $";
+static char datestr[]     = "$Date: 2006/08/24 13:56:49 $";
 static int stop = 0;
 
 
-struct converttimeinfo {
-  int second;    /* seconds of GPS time [0..59] */
-  int minute;    /* minutes of GPS time [0..59] */
-  int hour;      /* hour of GPS time [0..24] */
-  int day;       /* day of GPS time [1..28..30(31)*/
-  int month;     /* month of GPS time [1..12]*/
-  int year;      /* year of GPS time [1980..] */
-};
 
 #include "rtcm3torinex.h"
 
-/* Additional flags for the data field, which tell us more. */
-#define GNSSDF_LOCKLOSSL1     (1<<29)  /* lost lock on L1 */
-#define GNSSDF_LOCKLOSSL2     (1<<30)  /* lost lock on L2 */
 
 struct Args
@@ -311,5 +300,5 @@
 #define SKIPBITS(b) { LOADBITS(b) numbits -= (b); }
 
-static int RTCM3Parser(struct RTCM3ParserData *handle)
+int RTCM3Parser(struct RTCM3ParserData *handle)
 {
   int ret=0;
@@ -484,5 +473,5 @@
 }
 
-static void converttime(struct converttimeinfo *c, int week, int tow)
+void converttime(struct converttimeinfo *c, int week, int tow)
 {
   /* static variables */
@@ -534,5 +523,5 @@
 };
 
-static void HandleHeader(struct RTCM3ParserData *Parser)
+void HandleHeader(struct RTCM3ParserData *Parser)
 {
   struct HeaderData hdata;
@@ -862,5 +851,5 @@
 }
 
-#ifdef CGPS_TRANSFORM_MAIN
+#ifdef RTCM_TRANSFORM_MAIN
 int main(int argc, char **argv)
 {
Index: trunk/BNC/RTCM3/rtcm3torinex.h
===================================================================
--- trunk/BNC/RTCM3/rtcm3torinex.h	(revision 70)
+++ trunk/BNC/RTCM3/rtcm3torinex.h	(revision 71)
@@ -56,4 +56,8 @@
 #define LEAPSECONDS 14
 
+/* Additional flags for the data field, which tell us more. */
+#define GNSSDF_LOCKLOSSL1     (1<<29)  /* lost lock on L1 */
+#define GNSSDF_LOCKLOSSL2     (1<<30)  /* lost lock on L2 */
+
 struct gnssdata {
   int    flags;              /* GPSF_xxx */
@@ -87,4 +91,16 @@
 };
 
+struct converttimeinfo {
+  int second;    /* seconds of GPS time [0..59] */
+  int minute;    /* minutes of GPS time [0..59] */
+  int hour;      /* hour of GPS time [0..24] */
+  int day;       /* day of GPS time [1..28..30(31)*/
+  int month;     /* month of GPS time [1..12]*/
+  int year;      /* year of GPS time [1980..] */
+};
+
+void HandleHeader(struct RTCM3ParserData *Parser);
+int RTCM3Parser(struct RTCM3ParserData *handle);
 void HandleByte(struct RTCM3ParserData *Parser, unsigned int byte);
+void converttime(struct converttimeinfo *c, int week, int tow);
 
