Index: trunk/BNC/RTCM/GPSDecoder.h
===================================================================
--- trunk/BNC/RTCM/GPSDecoder.h	(revision 361)
+++ trunk/BNC/RTCM/GPSDecoder.h	(revision 366)
@@ -40,4 +40,5 @@
     GPSWeeks  = 0.0;
     C1        = 0.0;
+    C2        = 0.0;
     P1        = 0.0;
     P2        = 0.0;
@@ -55,4 +56,5 @@
   double GPSWeeks;    // Second of Week (GPS-Time)
   double C1;          // CA-code pseudorange (meters)
+  double C2;          // CA-code pseudorange (meters)
   double P1;          // P1-code pseudorange (meters)
   double P2;          // P2-code pseudorange (meters)
Index: trunk/BNC/RTCM/RTCM2.cpp
===================================================================
--- trunk/BNC/RTCM/RTCM2.cpp	(revision 361)
+++ trunk/BNC/RTCM/RTCM2.cpp	(revision 366)
@@ -880,6 +880,8 @@
     t = 0.6*P.modZCount() 
         + P.getUnsignedBits(4,20)*1.0e-6;
-    // Round t to 5 milliseconds
-    t = floor(t*200.+0.5)/200.; // g. weber
+    // SC-104 V2.3 4-42 Note 1 4. Assume measurements at hard edges
+    // of receiver clock with minimum divisions of 10ms
+    // and clock error less then recommended 1.1ms
+    t = floor(t*100.+0.5)/100.;
     
     // Frequency (exit if neither L1 nor L2)
@@ -971,6 +973,8 @@
     t = 0.6*P.modZCount() 
         + P.getUnsignedBits(4,20)*1.0e-6;
-    // Round t to 5 milliseconds
-    t = floor(t*200.+0.5)/200.; // g. weber
+    // SC-104 V2.3 4-42 Note 1 4. Assume measurements at hard edges
+    // of receiver clock with minimum divisions of 10ms
+    // and clock error less then recommended 1.1ms
+    t = floor(t*100.+0.5)/100.;
     
     // Frequency (exit if neither L1 nor L2)
Index: trunk/BNC/RTCM3/RTCM3Decoder.cpp
===================================================================
--- trunk/BNC/RTCM3/RTCM3Decoder.cpp	(revision 361)
+++ trunk/BNC/RTCM3/RTCM3Decoder.cpp	(revision 366)
@@ -90,5 +90,5 @@
         if (rr == 2) {
           std::cerr << "No valid RINEX! All values are modulo 299792.458!\n";
-          exit(1);
+//        exit(1); 
         }
 
@@ -107,13 +107,30 @@
 
           for (int jj = 0; jj < _Parser.numdatatypes; jj++) {
-
-            if ( !(_Parser.Data.dataflags[ii] & _Parser.dataflag[jj])
-                 || isnan(_Parser.Data.measdata[ii][_Parser.datapos[jj]])
-                 || isinf(_Parser.Data.measdata[ii][_Parser.datapos[jj]]) ) {
-              continue;
+            int v = 0;
+            int df = _Parser.dataflag[jj];
+            int pos = _Parser.datapos[jj];
+            if ( (_Parser.Data.dataflags[ii] & df)
+                 && !isnan(_Parser.Data.measdata[ii][pos])
+                 && !isinf(_Parser.Data.measdata[ii][pos])) {
+              v = 1;
             }
-              
+            else {
+              df = _Parser.dataflag2[jj];
+              pos = _Parser.datapos2[jj];
+              if ( (_Parser.Data.dataflags[ii] & df)
+                   && !isnan(_Parser.Data.measdata[ii][pos])
+                   && !isinf(_Parser.Data.measdata[ii][pos])) {
+              v = 1;
+              }
+            }
+          if(!v)
+          { continue; }
+          else
+          {
             if      (_Parser.dataflag[jj] & GNSSDF_C1DATA) {
               obs->C1 = _Parser.Data.measdata[ii][_Parser.datapos[jj]];
+            }
+            else if (_Parser.dataflag[jj] & GNSSDF_C2DATA) {
+              obs->C2 = _Parser.Data.measdata[ii][_Parser.datapos[jj]];
             }
             else if (_Parser.dataflag[jj] & GNSSDF_P1DATA) {
@@ -123,12 +140,13 @@
               obs->P2 = _Parser.Data.measdata[ii][_Parser.datapos[jj]];
             }
-            else if (_Parser.dataflag[jj] & (GNSSDF_L1CDATA|GNSSDF_L1PDATA)) {
-              obs->L1   = _Parser.Data.measdata[ii][_Parser.datapos[jj]];
+            else if (df & (GNSSDF_L1CDATA|GNSSDF_L1PDATA)) {
+              obs->L1   = _Parser.Data.measdata[ii][pos];
               obs->SNR1 = _Parser.Data.snrL1[ii];
             }
-            else if (_Parser.dataflag[jj] & (GNSSDF_L2CDATA|GNSSDF_L2PDATA)) {
-              obs->L2   = _Parser.Data.measdata[ii][_Parser.datapos[jj]];
+            else if (df & (GNSSDF_L2CDATA|GNSSDF_L2PDATA)) {
+              obs->L2   = _Parser.Data.measdata[ii][pos];
               obs->SNR2 = _Parser.Data.snrL2[ii];
             }
+          }
           }
           _obsList.push_back(obs);
Index: trunk/BNC/RTCM3/rtcm3torinex.cpp
===================================================================
--- trunk/BNC/RTCM3/rtcm3torinex.cpp	(revision 361)
+++ trunk/BNC/RTCM3/rtcm3torinex.cpp	(revision 366)
@@ -1,5 +1,5 @@
 /*
   Converter for RTCM3 data to RINEX.
-  $Id: rtcm3torinex.c,v 1.11 2006/11/21 08:27:35 stoecker Exp $
+  $Id: rtcm3torinex.c,v 1.16 2007/01/11 15:32:26 stoecker Exp $
   Copyright (C) 2005-2006 by Dirk Stoecker <stoecker@euronik.eu>
 
@@ -51,5 +51,5 @@
 
 /* CVS revision and version */
-static char revisionstr[] = "$Revision: 1.11 $";
+static char revisionstr[] = "$Revision: 1.16 $";
 
 static uint32_t CRC24(long size, const unsigned char *buf)
@@ -332,5 +332,5 @@
               gnss->dataflags[num] |= s;
               gnss->measdata[num][se] = i*0.25;
-              i /= 4*4;
+              i /= 4*6;
               if(i > 9) i = 9;
               else if(i < 1) i = 1;
@@ -380,5 +380,5 @@
                 gnss->dataflags[num] |= s;
                 gnss->measdata[num][se] = i*0.25;
-                i /= 4*4;
+                i /= 4*6;
                 if(i > 9) i = 9;
                 else if(i < 1) i = 1;
@@ -495,5 +495,5 @@
               gnss->dataflags[num] |= s;
               gnss->measdata[num][se] = i*0.25;
-              i /= 4*4;
+              i /= 4*6;
               if(i > 9) i = 9;
               else if(i < 1) i = 1;
@@ -543,5 +543,5 @@
                 gnss->dataflags[num] |= s;
                 gnss->measdata[num][se] = i*0.25;
-                i /= 4*4;
+                i /= 4*6;
                 if(i > 9) i = 9;
                 else if(i < 1) i = 1;
@@ -654,92 +654,15 @@
 }
 
-#define NUMSTARTSKIP 3
+#define NUMSTARTSKIP 1
+
+////////////////////////////////////////////////////////////////////
+// Aenderung Perlt - kein check auf vorhandene Daten 
+// Abgefragt werden : C1 C2 L1 L2 P1 P2 S1 S2
+
 void HandleHeader(struct RTCM3ParserData *Parser)
 {
-  struct HeaderData hdata;
-  char thebuffer[MAXHEADERBUFFERSIZE];
-  char *buffer = thebuffer;
-  size_t buffersize = sizeof(thebuffer);
   int i;
-
-  hdata.data.named.version =
-  "     2.11           OBSERVATION DATA    M (Mixed)"
-  "           RINEX VERSION / TYPE";
-
-  {
-    const char *str;
-    time_t t;
-    struct tm * t2;
-
-#ifdef NO_RTCM3_MAIN
-    if(revisionstr[0] == '$')
-    {
-      char *a;
-      int i=0;
-      for(a = revisionstr+11; *a && *a != ' '; ++a)
-        revisionstr[i++] = *a;
-      revisionstr[i] = 0;
-    }
-#endif
-
-    str = getenv("USER");
-    if(!str) str = "";
-    t = time(&t);
-    t2 = gmtime(&t);
-    hdata.data.named.pgm = buffer;
-    i = 1+snprintf(buffer, buffersize,
-    "RTCM3TORINEX %-7.7s%-20.20s%04d-%02d-%02d %02d:%02d    "
-    "PGM / RUN BY / DATE",
-    revisionstr, str, 1900+t2->tm_year, t2->tm_mon+1, t2->tm_mday, t2->tm_hour,
-    t2->tm_min);
-    buffer += i; buffersize -= i;
-
-    hdata.data.named.observer = buffer;
-    i = 1+snprintf(buffer, buffersize,
-    "%-20.20s                                        "
-    "OBSERVER / AGENCY", str);
-    buffer += i; buffersize -= i;
-  }
-
-  hdata.data.named.marker =
-  "RTCM3TORINEX                                                "
-  "MARKER NAME";
-
-  hdata.data.named.receiver =
-  "                                                            "
-  "REC # / TYPE / VERS";
-
-  hdata.data.named.antenna =
-  "                                                            "
-  "ANT # / TYPE";
-
-  hdata.data.named.position =
-  "         .0000         .0000         .0000                  "
-  "APPROX POSITION XYZ";
-
-  hdata.data.named.antennaposition =
-  "         .0000         .0000         .0000                  "
-  "ANTENNA: DELTA H/E/N";
-  
-  hdata.data.named.wavelength =
-  "     1     1                                                "
-  "WAVELENGTH FACT L1/2";
-
-  {
-#define CHECKFLAGS(a, b) \
-    if(flags & GNSSDF_##a##DATA \
-    && !data[RINEXENTRY_##b##DATA]) \
-    { \
-      Parser->dataflag[Parser->numdatatypes] = GNSSDF_##a##DATA; \
-      Parser->datapos[Parser->numdatatypes++] = data[RINEXENTRY_##b##DATA] \
-      = GNSSENTRY_##a##DATA; \
-      snprintf(tbuffer+tbufferpos, sizeof(tbuffer)-tbufferpos, "    "#b); \
-      tbufferpos += 6; \
-    }
-
     int flags = Parser->startflags;
     int data[RINEXENTRY_NUMBER];
-    char tbuffer[6*RINEXENTRY_NUMBER+1];
-    int tbufferpos = 0;
     for(i = 0; i < RINEXENTRY_NUMBER; ++i)
       data[i] = 0;
@@ -747,138 +670,58 @@
       flags |= Parser->Data.dataflags[i];
 
-    CHECKFLAGS(C1,C1)
-    CHECKFLAGS(C2,C2)
-    CHECKFLAGS(P1,P1)
-    CHECKFLAGS(P2,P2)
-    CHECKFLAGS(L1C,L1)
-    CHECKFLAGS(L1P,L1)
-    CHECKFLAGS(L2C,L2)
-    CHECKFLAGS(L2P,L2)
-    CHECKFLAGS(D1C,D1)
-    CHECKFLAGS(D1P,D1)
-    CHECKFLAGS(D2C,D2)
-    CHECKFLAGS(D2P,D2)
-    CHECKFLAGS(S1C,S1)
-    CHECKFLAGS(S1P,S1)
-    CHECKFLAGS(S2C,S2)
-    CHECKFLAGS(S2P,S2)
-
-    hdata.data.named.typesofobs = buffer;
-    i = 1+snprintf(buffer, buffersize,
-    "%6i%-54.54s# / TYPES OF OBSERV", Parser->numdatatypes, tbuffer);
-    if(Parser->numdatatypes>9)
-    {
-      i += snprintf(buffer+i-1, buffersize,
-      "\n      %-54.54s# / TYPES OF OBSERV", tbuffer+9*6);
-    }
-    buffer += i; buffersize -= i;
-  }
-
-  {
-    struct converttimeinfo cti;
-    converttime(&cti, Parser->Data.week,
-    (int)floor(Parser->Data.timeofweek/1000.0));
-    hdata.data.named.timeoffirstobs = buffer;
-      i = 1+snprintf(buffer, buffersize,
-    "  %4d    %2d    %2d    %2d    %2d   %10.7f     GPS         "
-    "TIME OF FIRST OBS", cti.year%100, cti.month, cti.day, cti.hour,
-    cti.minute, cti.second + fmod(Parser->Data.timeofweek/1000.0,1.0));
-
-    buffer += i; buffersize -= i;
-  }
-
-  hdata.numheaders = 11;
-
-  if(Parser->headerfile)
-  {
-    FILE *fh;
-    if((fh = fopen(Parser->headerfile, "r")))
-    {
-      size_t siz;
-      char *lastblockstart;
-      if((siz = fread(buffer, 1, buffersize-1, fh)) > 0)
-      {
-        buffer[siz] = '\n';
-        if(siz == buffersize)
-        {
-          RTCM3Error("Header file is too large. Only %d bytes read.",
-          siz);
-        }
-        /* scan the file line by line and enter the entries in the list */
-        /* warn for "# / TYPES OF OBSERV" and "TIME OF FIRST OBS" */
-        /* overwrites entries, except for comments */
-        lastblockstart = buffer;
-        for(i = 0; i < (int)siz; ++i)
-        {
-          if(buffer[i] == '\n')
-          { /* we found a line */
-            char *end;
-            while(buffer[i+1] == '\r')
-              ++i; /* skip \r in case there are any */
-            end = buffer+i;
-            while(*end == '\t' || *end == ' ' || *end == '\r' || *end == '\n')
-              *(end--) = 0;
-            if(end-lastblockstart < 60+5) /* short line */
-              RTCM3Error("Short Header line '%s' ignored.\n", lastblockstart);
-            else
-            {
-              int pos;
-              if(!strcmp("COMMENT", lastblockstart+60))
-                pos = hdata.numheaders;
-              else
-              {
-                for(pos = 0; pos < hdata.numheaders; ++pos)
-                {
-                  if(!strcmp(hdata.data.unnamed[pos]+60, lastblockstart+60))
-                    break;
-                }
-                if(!strcmp("# / TYPES OF OBSERV", lastblockstart+60)
-                || !strcmp("TIME OF FIRST OBS", lastblockstart+60))
-                {
-                  RTCM3Error("Overwriting header '%s' is dangerous.\n",
-                  lastblockstart+60);
-                }
-              }
-              if(pos >= MAXHEADERLINES)
-              {
-                RTCM3Error("Maximum number of header lines of %d reached.\n",
-                MAXHEADERLINES);
-              }
-              else if(!strcmp("END OF HEADER", lastblockstart+60))
-              {
-                RTCM3Error("End of header ignored.\n");
-              }
-              else
-              {
-                hdata.data.unnamed[pos] = lastblockstart;
-                if(pos == hdata.numheaders)
-                  ++hdata.numheaders;
-              }
-            }
-            lastblockstart = buffer+i+1;
-          }
-        }
-      }
-      else
-      {
-        RTCM3Error("Could not read data from headerfile '%s'.\n",
-        Parser->headerfile);
-      }
-      fclose(fh);
-    }
-    else
-    {
-      RTCM3Error("Could not open header datafile '%s'.\n",
-      Parser->headerfile);
-    }
-  }
-
-#ifndef NO_RTCM3_MAIN
-  for(i = 0; i < hdata.numheaders; ++i)
-    RTCM3Text("%s\n", hdata.data.unnamed[i]);
-  RTCM3Text("                                                            "
-  "END OF HEADER\n");
-#endif
-}
+Parser->dataflag[Parser->numdatatypes] = GNSSDF_C1DATA; 
+Parser->datapos[Parser->numdatatypes] = GNSSENTRY_C1DATA; 
+data[RINEXENTRY_C1DATA] = ++Parser->numdatatypes; 
+
+Parser->dataflag[Parser->numdatatypes] = GNSSDF_C2DATA; 
+Parser->datapos[Parser->numdatatypes] = GNSSENTRY_C2DATA; 
+data[RINEXENTRY_C2DATA] = ++Parser->numdatatypes; 
+
+Parser->dataflag[Parser->numdatatypes] = GNSSDF_P1DATA; 
+Parser->datapos[Parser->numdatatypes] = GNSSENTRY_P1DATA; 
+data[RINEXENTRY_P1DATA] = ++Parser->numdatatypes; 
+
+Parser->dataflag[Parser->numdatatypes] = GNSSDF_P2DATA; 
+Parser->datapos[Parser->numdatatypes] = GNSSENTRY_P2DATA; 
+data[RINEXENTRY_P2DATA] = ++Parser->numdatatypes; 
+
+Parser->dataflag[Parser->numdatatypes] = GNSSDF_L1CDATA; 
+Parser->datapos[Parser->numdatatypes] = GNSSENTRY_L1CDATA; 
+data[RINEXENTRY_L1DATA] = ++Parser->numdatatypes; 
+Parser->dataflag2[data[RINEXENTRY_L1DATA]-1] = GNSSDF_L1PDATA; 
+Parser->datapos2[data[RINEXENTRY_L1DATA]-1] = GNSSENTRY_L1PDATA; 
+
+Parser->dataflag[Parser->numdatatypes] = GNSSDF_L2CDATA; 
+Parser->datapos[Parser->numdatatypes] = GNSSENTRY_L2CDATA; 
+data[RINEXENTRY_L2DATA] = ++Parser->numdatatypes; 
+Parser->dataflag2[data[RINEXENTRY_L2DATA]-1] = GNSSDF_L2PDATA; 
+Parser->datapos2[data[RINEXENTRY_L2DATA]-1] = GNSSENTRY_L2PDATA; 
+
+Parser->dataflag[Parser->numdatatypes] = GNSSDF_S1CDATA; 
+Parser->datapos[Parser->numdatatypes] = GNSSENTRY_S1CDATA; 
+data[RINEXENTRY_S1DATA] = ++Parser->numdatatypes; 
+Parser->dataflag2[data[RINEXENTRY_S1DATA]-1] = GNSSDF_S1PDATA; 
+Parser->datapos2[data[RINEXENTRY_S1DATA]-1] = GNSSENTRY_S1PDATA; 
+
+Parser->dataflag[Parser->numdatatypes] = GNSSDF_S2CDATA; 
+Parser->datapos[Parser->numdatatypes] = GNSSENTRY_S2CDATA; 
+data[RINEXENTRY_S2DATA] = ++Parser->numdatatypes; 
+Parser->dataflag2[data[RINEXENTRY_S2DATA]-1] = GNSSDF_S2PDATA; 
+Parser->datapos2[data[RINEXENTRY_S2DATA]-1] = GNSSENTRY_S2PDATA; 
+
+Parser->dataflag[Parser->numdatatypes] = GNSSDF_D1CDATA; 
+Parser->datapos[Parser->numdatatypes] = GNSSENTRY_D1CDATA; 
+data[RINEXENTRY_D1DATA] = ++Parser->numdatatypes; 
+Parser->dataflag2[data[RINEXENTRY_D1DATA]-1] = GNSSDF_D1PDATA; 
+Parser->datapos2[data[RINEXENTRY_D1DATA]-1] = GNSSENTRY_D1PDATA; 
+
+Parser->dataflag[Parser->numdatatypes] = GNSSDF_D2CDATA; 
+Parser->datapos[Parser->numdatatypes] = GNSSENTRY_D2CDATA; 
+data[RINEXENTRY_D2DATA] = ++Parser->numdatatypes; 
+Parser->dataflag2[data[RINEXENTRY_D2DATA]-1] = GNSSDF_D2PDATA; 
+Parser->datapos2[data[RINEXENTRY_D2DATA]-1] = GNSSENTRY_D2PDATA; 
+}
+// Ende Aenderung Perlt - kein check auf vorhandene Daten 
+
 
 void HandleByte(struct RTCM3ParserData *Parser, unsigned int byte)
@@ -955,7 +798,27 @@
         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]]))
+          int v = 0;
+          int df = Parser->dataflag[j];
+          int pos = Parser->datapos[j];
+          if((Parser->Data.dataflags[i] & df)
+          && !isnan(Parser->Data.measdata[i][pos])
+          && !isinf(Parser->Data.measdata[i][pos]))
+          {
+            v = 1;
+          }
+          else
+          {
+            df = Parser->dataflag2[j];
+            pos = Parser->datapos2[j];
+
+            if((Parser->Data.dataflags[i] & df)
+            && !isnan(Parser->Data.measdata[i][pos])
+            && !isinf(Parser->Data.measdata[i][pos]))
+            {
+              v = 1;
+            }
+          }
+
+          if(!v)
           { /* no or illegal data */
             RTCM3Text("                ");
@@ -965,5 +828,5 @@
             char lli = ' ';
             char snr = ' ';
-            if(Parser->dataflag[j] & (GNSSDF_L1CDATA|GNSSDF_L1PDATA))
+            if(df & (GNSSDF_L1CDATA|GNSSDF_L1PDATA))
             {
               if(Parser->Data.dataflags[i] & GNSSDF_LOCKLOSSL1)
@@ -971,5 +834,5 @@
               snr = '0'+Parser->Data.snrL1[i];
             }
-            if(Parser->dataflag[j] & (GNSSDF_L2CDATA|GNSSDF_L2PDATA))
+            if(df & (GNSSDF_L2CDATA|GNSSDF_L2PDATA))
             {
               if(Parser->Data.dataflags[i] & GNSSDF_LOCKLOSSL2)
@@ -978,5 +841,5 @@
             }
             RTCM3Text("%14.3f%c%c",
-            Parser->Data.measdata[i][Parser->datapos[j]],lli,snr);
+            Parser->Data.measdata[i][pos],lli,snr);
           }
           if(j%5 == 4 || j == Parser->numdatatypes-1)
@@ -989,5 +852,5 @@
 
 #ifndef NO_RTCM3_MAIN
-static char datestr[]     = "$Date: 2006/11/21 08:27:35 $";
+static char datestr[]     = "$Date: 2007/01/11 15:32:26 $";
 
 /* The string, which is send as agent in HTTP request */
@@ -1286,10 +1149,10 @@
     if(!(he=gethostbyname(args.server)))
     {
-      perror("gethostbyname");
+      RTCM3Error("Function gethostbyname: %s\n", strerror(errno));
       exit(1);
     }
     if((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1)
     {
-      perror("socket");
+      RTCM3Error("Function socket: %s\n", strerror(errno));
       exit(1);
     }
@@ -1301,5 +1164,5 @@
     sizeof(struct sockaddr)) == -1)
     {
-      perror("connect");
+      RTCM3Error("Function connect: %s\n", strerror(errno));
       exit(1);
     }
@@ -1339,10 +1202,12 @@
         exit(1);
       }
-      snprintf(buf+i, 5, "\r\n\r\n");
-      i += 5;
+      buf[i++] = '\r';
+      buf[i++] = '\n';
+      buf[i++] = '\r';
+      buf[i++] = '\n';
     }
     if(send(sockfd, buf, (size_t)i, 0) != i)
     {
-      perror("send");
+      RTCM3Error("Function send: %s\n", strerror(errno));
       exit(1);
     }
Index: trunk/BNC/RTCM3/rtcm3torinex.h
===================================================================
--- trunk/BNC/RTCM3/rtcm3torinex.h	(revision 361)
+++ trunk/BNC/RTCM3/rtcm3torinex.h	(revision 366)
@@ -1,8 +1,8 @@
 #ifndef RTCM3TORINEX_H
-#define RTCM3TORINES_H
+#define RTCM3TORINEX_H
 
 /*
   Converter for RTCM3 data to RINEX.
-  $Id: rtcm3torinex.h,v 1.3 2006/11/15 12:31:31 stoecker Exp $
+  $Id: rtcm3torinex.h,v 1.5 2007/01/11 14:10:13 stoecker Exp $
   Copyright (C) 2005-2006 by Dirk Stoecker <stoecker@euronik.eu>
 
@@ -94,10 +94,9 @@
 #define GLO_WAVELENGTH_L2(a) (LIGHTSPEED / GLO_FREQU_L2(a)) /* m */
 
-/* unimportant, only for approx. time needed */
-#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 */
+
+#define LEAPSECONDS     14 /* only needed for approx. time */
 
 struct gnssdata {
@@ -127,4 +126,6 @@
   int    datapos[RINEXENTRY_NUMBER];
   int    dataflag[RINEXENTRY_NUMBER];
+  int    datapos2[RINEXENTRY_NUMBER];
+  int    dataflag2[RINEXENTRY_NUMBER];
   int    numdatatypes;
   int    validwarning;
Index: trunk/BNC/bnccaster.cpp
===================================================================
--- trunk/BNC/bnccaster.cpp	(revision 361)
+++ trunk/BNC/bnccaster.cpp	(revision 366)
@@ -116,5 +116,8 @@
 void bncCaster::newObs(const QByteArray& staID, const QUrl& mountPoint,
                        bool firstObs, Observation* obs,
-                       const QByteArray& format) {
+                       const QByteArray& format,
+                       const QByteArray& latitude,
+                       const QByteArray& longitude,
+                       const QByteArray& nmea) {
 
   QMutexLocker locker(&_mutex);
@@ -132,5 +135,5 @@
   if (_rinexWriters.find(obs->StatID) == _rinexWriters.end()) {
     _rinexWriters.insert(obs->StatID, new bncRinex(obs->StatID, 
-                                                   mountPoint, format));
+                                                   mountPoint, format, latitude, longitude, nmea));
   }
   bncRinex* rnx = _rinexWriters.find(obs->StatID).value();
@@ -238,4 +241,6 @@
           _out->setFieldWidth(1); *_out << " ";
           _out->setFieldWidth(14); _out->setRealNumberPrecision(3); *_out << obs->C1; 
+          _out->setFieldWidth(1); *_out << " ";
+          _out->setFieldWidth(14); _out->setRealNumberPrecision(3); *_out << obs->C2; 
           _out->setFieldWidth(1); *_out << " ";
           _out->setFieldWidth(14); _out->setRealNumberPrecision(3); *_out << obs->P1; 
Index: trunk/BNC/bnccaster.h
===================================================================
--- trunk/BNC/bnccaster.h	(revision 361)
+++ trunk/BNC/bnccaster.h	(revision 366)
@@ -45,5 +45,7 @@
    int  numStations() const {return _staIDs.size();}
    void newObs(const QByteArray& staID, const QUrl& mountPoint,
-               bool firstObs, Observation* obs, const QByteArray& format);
+               bool firstObs, Observation* obs, const QByteArray& format,
+               const QByteArray& latitude, const QByteArray& longitude,
+               const QByteArray& nmea);
 
  signals:
Index: trunk/BNC/bncgetthread.cpp
===================================================================
--- trunk/BNC/bncgetthread.cpp	(revision 361)
+++ trunk/BNC/bncgetthread.cpp	(revision 366)
@@ -61,5 +61,8 @@
 ////////////////////////////////////////////////////////////////////////////
 bncGetThread::bncGetThread(const QUrl& mountPoint, 
-                           const QByteArray& format, int iMount) {
+                           const QByteArray& format,
+                           const QByteArray& latitude,
+                           const QByteArray& longitude,
+                           const QByteArray& nmea, int iMount) {
   _decoder    = 0;
   _mountPoint = mountPoint;
@@ -67,4 +70,7 @@
   _staID_orig = _staID;
   _format     = format;
+  _latitude   = latitude;
+  _longitude  = longitude;
+  _nmea       = nmea;
   _socket     = 0;
   _timeOut    = 20*1000;  // 20 seconds
@@ -105,5 +111,7 @@
 // Connect to Caster, send the Request (static)
 ////////////////////////////////////////////////////////////////////////////
-QTcpSocket* bncGetThread::request(const QUrl& mountPoint, int timeOut, 
+QTcpSocket* bncGetThread::request(const QUrl& mountPoint,
+                                  QByteArray& latitude, QByteArray& longitude,
+                                  QByteArray& nmea, int timeOut, 
                                   QString& msg) {
 
@@ -160,7 +168,9 @@
 
   double lat, lon;
-  lat = settings.value("approxLat", 0).toDouble();
-  lon = settings.value("approxLon", 0).toDouble();
-  if ((lat != 0.0) && (lon != 0.0) && (hlp.path().length() > 2) && (hlp.path().indexOf(".skl") < 0)) {
+
+  lat = strtod(latitude,NULL);
+  lon = strtod(longitude,NULL);
+
+  if ((nmea == "VRS") && (hlp.path().length() > 2) && (hlp.path().indexOf(".skl") < 0)) {
     const char* flagN="N";
     const char* flagE="E";
@@ -221,5 +231,5 @@
   QString msg;
 
-  _socket = bncGetThread::request(_mountPoint, _timeOut, msg);
+  _socket = bncGetThread::request(_mountPoint, _latitude, _longitude, _nmea, _timeOut, msg);
 
   ////  emit(newMessage(msg.toAscii()));
@@ -361,5 +371,5 @@
           emit newObs(_staID, *it);
           bool firstObs = (it == _decoder->_obsList.begin());
-          _global_caster->newObs(_staID, _mountPoint, firstObs, *it, _format);
+          _global_caster->newObs(_staID, _mountPoint, firstObs, *it, _format, _latitude, _longitude, _nmea);
         }
         _decoder->_obsList.clear();
Index: trunk/BNC/bncgetthread.h
===================================================================
--- trunk/BNC/bncgetthread.h	(revision 361)
+++ trunk/BNC/bncgetthread.h	(revision 366)
@@ -38,9 +38,12 @@
  public:
    bncGetThread(const QUrl& mountPoint, 
-                const QByteArray& format, int iMount);
+                const QByteArray& format,
+                const QByteArray& latitude,
+                const QByteArray& longitude,
+                const QByteArray& nmea, int iMount);
    ~bncGetThread();
 
-   static QTcpSocket* request(const QUrl& mountPoint,
-                              int timeOut, QString& msg);
+   static QTcpSocket* request(const QUrl& mountPoint, QByteArray& latitude, QByteArray& longitude,
+                              QByteArray& nmea, int timeOut, QString& msg);
 
    QByteArray staID() const {return _staID;}
@@ -65,4 +68,7 @@
    QByteArray  _staID_orig;
    QByteArray  _format;
+   QByteArray  _latitude;
+   QByteArray  _longitude;
+   QByteArray  _nmea;
    int         _timeOut;
    int         _nextSleep;
Index: trunk/BNC/bnchelp.html
===================================================================
--- trunk/BNC/bnchelp.html	(revision 361)
+++ trunk/BNC/bnchelp.html	(revision 366)
@@ -60,5 +60,4 @@
 &nbsp; &nbsp; &nbsp; B - 5.5. <a href=#rnxskeleton>RINEX Skeleton Extension</a><br>
 &nbsp; &nbsp; &nbsp; B - 5.6. <a href=#rnxappend>Append Files</a><br>
-&nbsp; &nbsp; &nbsp; B - 5.7. <a href=#approxlatlon>Approx. Lat./Lon.</a><br>
 B - 6. <a href=#mountpoints>Mountpoints</a><br>
 &nbsp; &nbsp; &nbsp; B - 6.1. <a href=#AddMounts>Add Mountpoints</a><br>
@@ -119,5 +118,5 @@
 <p>
 BNC lets you output synchronized observations epoch by epoch. This output is made available in a plain ASCII format and in a binary format. The output comprises the following observations if available:</p>
-StatID, SVPRN, GPSWeek, GPSWeeks, C1, P1, P2, L1, L2, SNR1, SNR2.
+StatID, SVPRN, GPSWeek, GPSWeeks, C1, C2, P1, P2, L1, L2, SNR1, SNR2.
 </p>
 <p>
@@ -164,5 +163,6 @@
   int    GPSWeek;     // Week of GPS-Time
   double GPSWeeks;    // Second of Week (GPS-Time)
-  double C1;          // CA-code pseudorange (meters)
+  double C1;          // C1-code pseudorange (meters)
+  double C2;          // C2-code pseudorange (meters)
   double P1;          // P1-code pseudorange (meters)
   double P2;          // P2-code pseudorange (meters)
@@ -176,5 +176,5 @@
 <p><a name="rinex"><h4>B - 5. RINEX</h4></p>
 <p>
-Observations are converted to RINEX Version 2.1. RINEX file names are derived by BNC from the first 4 characters of the corresponding mountpoint (4Char Station ID) while omitting the residual part of the mountpoint string. Thus, retrieving data from mountpoints FRANKFURT and WETTZELL leads to hourly RINEX observation files named</p>
+Observations are converted to RINEX Version 2.11. RINEX file names are derived by BNC from the first 4 characters of the corresponding mountpoint (4Char Station ID) while omitting the residual part of the mountpoint string. Thus, retrieving data from mountpoints FRANKFURT and WETTZELL leads to hourly RINEX observation files named</p>
 <p>
 FRAN{ddd}{h}.{yy}O<br>
@@ -205,5 +205,5 @@
 </p>
 <p>
-BNC's RINEX observation files generally contain C1, P1, P2, L1, and L2 observations. In case an observation is unavailable, its value is set to zero '0.000'. Note that even if a RINEX file does not contain GLONASS data, the 'RINEX TYPE' field in the RINEX file header may be set to 'M (MIXED)'.
+BNC's RINEX observation files generally contain C1, C2, P1, P2, L1, L2, SNR1, and SNR3 observations. In case an observation is unavailable, its value is set to zero '0.000'. Note that even if a RINEX file does not contain GLONASS data, the 'RINEX TYPE' field in the RINEX file header may be set to 'M (MIXED)'.
 </p>
 
@@ -283,17 +283,20 @@
 When starting BNC, new RINEX files are created by default. Probably existing files will be overwritten. However, it may be desirable to append observations to already existing RINEX files following a restart of BNC after an intentional 'Stop', a system crash or a crash of BNC. Hit 'Append files' to continue with already existing files and thus save what has been recorded so far. Note that the option 'Append files' also concerns the 'ASCII output file' and the 'Log' file.
 </p> 
-
-<p><a name="approxlatlon"><h4>B - 5.7 Approx. Lat./Lon. - mandatory for Virtual Reference Stations (VRS)</h4></p>
-<p>
-BNC allows to retrieve streams from Virtual Reference Stations (VRS). For that an approximate rover position needs to be send in NMEA format to a VRS supporting NTRIP broadcaster. In return, an individual user-specific data stream is generated by a network RTK software. This stream is tailored exactly to the 'Approx. Lat./Lon.' you enter. The approximate position has to be introduced in northern latitude degrees (example for northern hemisphere: 52.436, example for eastern hemisphere: -24.567) and eastern longitude degrees (example: 358.872 or -1.128).
-</p>
-<p>
-Introducing an 'Approx. Lat./Lon.' is only necessary when retrieving a VRS stream. The approximate position must point to a location within the service area of the affected RTK network. Note that VRS streams that require an 'Approx. Lat./Lon.' are marked by the integer '1' in data field 'nmea' of the affected NTRIP broadcaster source-table. Note further that when working in a Local Area Network (LAN), NMEA messages may be blocked by a proxy server, firewall or virus scanner.
-</p> 
-
 <p><a name="mountpoints"><h4>B - 6. Mountpoints</h4></p>
 <p>
 Each stream on an NTRIP broadcaster is defined through a unique source ID called mountpoint. An NTRIP client like BNC can access the data of a desired stream by 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.
-</p> 
+</p>
+
+Streams selected for retrieval are listed in the 'Mountpoints' section on BNC's main window. The list provides the following information extracted from NTRIP broadcaster source-tables:
+ 
+<table>
+<tr></tr>
+<tr><td>'mountpoint' &nbsp;</td><td>NTRIP broadcaster URL, port, and mountpoint.</td></tr>
+<tr><td>'decoder' &nbsp;</td><td>Internal decoder used to handle the incoming stream content according to its format; editable.</td></tr>
+<tr><td>'lat' &nbsp;</td><td>Latitude of reference station, degrees, north; editable for VRS streams.</td></tr>
+<tr><td>'long' &nbsp;</td><td>Longitude of reference station, degrees, east; editable for VRS streams.</td></tr>
+<tr><td>'type' &nbsp;</td><td>Mountpoint refers to physical Reference Station (RS) or Virtual Reference Station (VRS).</td></tr>
+<tr><td>'bytes' &nbsp;</td><td>Number of bytes retrieved.
+</table>
 
 <p><a name="AddMounts"><h4>B - 6.1 Add Mountpoints</h4></p>
@@ -325,7 +328,12 @@
 
 <p><a name="edit"><h4>B - 6.6 Edit Mountpoints</h4></p>
-<p>
-BNC automatically selects one out of several incorporated decoders for a stream based on its 'format' and 'format-details' as given in the source-table. It may happen that you need to overrule the automated decoder selection because of source-table setup deficiencies. Therefore BNC allows to edit (double-click) the decoder string for each stream shown under 'Mountpoints'. Accepted decoder strings allowed to be introduced are 'RTCM_2.x', 'RTCM_3', and 'RTIGS'.
-</p> 
+<ul>
+<li>
+BNC automatically selects one out of several internal decoders for a stream based on its 'format' and 'format-details' as given in the source-table. It may happen that you need to overrule the automated decoder selection because of source-table setup deficiencies. Therefore BNC allows to edit the decoder string (first double-click, then edit field 'decoder', then hit Enter) for the streams shown under 'Mountpoints'. Accepted decoder strings allowed to be introduced are 'RTCM_2.x', 'RTCM_3', and 'RTIGS'.
+</li>
+<li>
+BNC allows to retrieve streams from Virtual Reference Stations. Whether a stream comes from a physical Reference Station (RS) or a Virtual Reference Station (VRS) is indicated in column 'type' under 'Mountpoints' as well as in column 'type' of the affected source-table. For retrieving a VRS stream, an approximate rover position is required to be send in NMEA format to the NTRIP broadcaster. In return, an individual user-specific data stream is generated, usually by a network RTK software. This stream is tailored exactly to the latitude and longitude shown in the 'lat' and 'long' columns under 'Mountpoints'. Default values for 'lat' and 'long' are taken from the source-table. You may change these values (first double-click, then edit fields 'lat' and/or 'long', then hit Enter) according to your needs. The position has to be introduced in northern latitude degrees (example for northern hemisphere: 52.436, example for eastern hemisphere: -24.567) and eastern longitude degrees (example: 358.872 or -1.128). Editing the 'lat' and 'long' values under 'Mountpoints' is only possible for VRS streams. The position must point to a location within the service area of the affected RTK network.  Note that when running BNC in a Local Area Network (LAN), NMEA strings may be blocked by a proxy server, firewall or virus scanner.
+</li>
+</ul> 
 
 <p><a name="log"><h4>B - 7. Log - optional</h4></p>
@@ -358,8 +366,8 @@
 </li> 
 <li>
-So far BNC only handles GPS and GLONASS data while ignoring Galileo. Furthermore, its function is limited today to processing C1, P1, P2, L1, and L2 observations only.
-</li>
-<li>
-Due to a limitation of the RTIGS format and transport protocol, streams coming in that format can only contain GPS data.
+So far BNC only handles GPS and GLONASS data while ignoring Galileo.
+</li>
+<li>
+BNC's function is limited today to processing C1, C2, P1, P2, L1, L2, SNR1, and SNR2 observations. Which observables become available through a specific stream depends on the setup of the affected receiver and the applied data format. Note that RTCM Version 2.x streams can not transport signal-to-noise ratios (SNR) and RTCM Version 3 streams can only transport one code observable per frequency. Note further that signal-to-noise ratios SNR1 and SNR2 are mapped to integer numbers 1 to 9.
 </li>
 <li>
@@ -367,5 +375,8 @@
 </li>
 <li>
-If the ambiguity field is not set in RTCM Version 3 streams, the BNC output will be no valid RINEX. All values will be stored modulo 299792.458. A COMMENT line will tell you, when this happens. It would be necessary to approximately calculate the range to fix the ambiguity (needing ephemeris/almanac and easy positioning algorithm).
+If the ambiguity field is not set in RTCM Version 3 streams (i.e. when sending message type 1003 but no 1004), the BNC output will be no valid RINEX. All values will be stored modulo 299792.458. (It would be necessary to approximately calculate the range to fix the ambiguity, needing ephemeris/almanac and an easy positioning algorithm).
+</li>
+<li>
+As a consequence of the current implementation of the RTIGS format and transport protocol, streams coming in that format contain only GPS data.
 </li>
 <li>
Index: trunk/BNC/bncmain.cpp
===================================================================
--- trunk/BNC/bncmain.cpp	(revision 361)
+++ trunk/BNC/bncmain.cpp	(revision 366)
@@ -119,5 +119,8 @@
       QUrl url(hlp[0]);
       QByteArray format = hlp[1].toAscii();
-      bncGetThread* getThread = new bncGetThread(url, format, iMount);
+      QByteArray latitude = hlp[2].toAscii();
+      QByteArray longitude = hlp[3].toAscii();
+      QByteArray nmea = hlp[4].toAscii();
+      bncGetThread* getThread = new bncGetThread(url, format, latitude, longitude, nmea, iMount);
       app.connect(getThread, SIGNAL(newMessage(const QByteArray&)), 
                   &app, SLOT(slotMessage(const QByteArray&)));
Index: trunk/BNC/bncrinex.cpp
===================================================================
--- trunk/BNC/bncrinex.cpp	(revision 361)
+++ trunk/BNC/bncrinex.cpp	(revision 366)
@@ -62,8 +62,12 @@
 ////////////////////////////////////////////////////////////////////////////
 bncRinex::bncRinex(const char* StatID, const QUrl& mountPoint, 
-                   const QByteArray& format) {
+                   const QByteArray& format, const QByteArray& latitude,
+                   const QByteArray& longitude, const QByteArray& nmea) {
   _statID        = StatID;
   _mountPoint    = mountPoint;
   _format        = format.left(6);
+  _latitude      = latitude;
+  _longitude     = longitude;
+  _nmea          = nmea;
   _headerWritten = false;
 
@@ -145,5 +149,8 @@
       const int timeOut = 10*1000;
       QString msg;
-      QTcpSocket* socket = bncGetThread::request(url, timeOut, msg);
+      QByteArray _latitude;
+      QByteArray _longitude;
+      QByteArray _nmea;
+      QTcpSocket* socket = bncGetThread::request(url, _latitude, _longitude, _nmea, timeOut, msg);
 
       if (socket) {
@@ -154,5 +161,5 @@
             line.chop(1);
             if (line.indexOf("RINEX VERSION") != -1) {
-              _headerLines.append("     2.10           OBSERVATION DATA"
+              _headerLines.append("     2.11           OBSERVATION DATA"
                                   "    M (MIXED)"
                                   "           RINEX VERSION / TYPE");
@@ -294,9 +301,4 @@
 
   QSettings settings;
-//  double lat, lon;
-//  int vrsstream = 0;
-//  lat = settings.value("approxLat", 0).toDouble();
-//  lon = settings.value("approxLon", 0).toDouble();
-//  if ((lat != 0.0) && (lon != 0.0)) {vrsstream=1;}
 
   // Open the Output File
@@ -332,6 +334,6 @@
       }
       else if (line.indexOf("# / TYPES OF OBSERV") != -1) {
-        _out << "     5    C1    P1    P2    L1    L2"
-                "                        # / TYPES OF OBSERV"  << endl;
+        _out << "     6    C1    C2    P1    P2    L1    L2"
+                "                  # / TYPES OF OBSERV"  << endl;
       }
       else if (line.indexOf("TIME OF FIRST OBS") != -1) {
@@ -342,6 +344,4 @@
                       _mountPoint.path())).leftJustified(60, ' ', true);
         _out << hlp.toAscii().data() << "COMMENT" << endl;
-//        hlp = QString("Approx VRS Position %1%2").arg(lat, -20, 'f', 4).arg(lon, -20, 'f', 4);
-//        _out << hlp.toAscii().data() << "COMMENT" << endl;
       }
       else {
@@ -357,5 +357,5 @@
     double antennaNEU[3]; antennaNEU[0] = antennaNEU[1] = antennaNEU[2] = 0.0;
     
-    _out << "     2.10           OBSERVATION DATA    M (MIXED)           RINEX VERSION / TYPE" << endl;
+    _out << "     2.11           OBSERVATION DATA    M (MIXED)           RINEX VERSION / TYPE" << endl;
     QString hlp = QDate::currentDate().toString("dd-MMM-yyyy").leftJustified(20, ' ', true);
     _out << _pgmName.toAscii().data() << _userName.toAscii().data() 
@@ -380,5 +380,5 @@
          << "                  "                                     << "ANTENNA: DELTA H/E/N" << endl;
     _out << "     1     1                                                WAVELENGTH FACT L1/2" << endl;
-    _out << "     5    C1    P1    P2    L1    L2                        # / TYPES OF OBSERV"  << endl;
+    _out << "     6    C1    C2    P1    P2    L1    L2                  # / TYPES OF OBSERV"  << endl;
         _out << datTim.toString("  yyyy    MM    dd"
                                 "    hh    mm   ss.zzz0000").toAscii().data();
@@ -387,6 +387,9 @@
           _mountPoint.path())).leftJustified(60, ' ', true);
     _out << hlp.toAscii().data() << "COMMENT" << endl;
-//    hlp = QString("Approx VRS Position %1%2").arg(lat, -20, 'f', 4).arg(lon, -20, 'f', 4);
-//    _out << hlp.toAscii().data() << "COMMENT" << endl;
+
+    if (_nmea == "VRS") {
+    hlp = ("VRS LAT=" + _latitude + " " + "LONG=" + _longitude).leftJustified(60, ' ',true);
+    _out << hlp.toAscii().data() << "COMMENT" << endl; }
+
     _out << "                                                            END OF HEADER"        << endl;
   }
@@ -469,8 +472,9 @@
     char snr = ' ';
     _out << setw(14) << setprecision(3) << ob->C1 << lli << snr;
+    _out << setw(14) << setprecision(3) << ob->C2 << lli << snr;
     _out << setw(14) << setprecision(3) << ob->P1 << lli << snr;
     _out << setw(14) << setprecision(3) << ob->P2 << lli << snr; 
     _out << setw(14) << setprecision(3) << ob->L1 << lli 
-         << setw(1) << ob->SNR1;
+         << setw(1) << ob->SNR1 << endl;
     _out << setw(14) << setprecision(3) << ob->L2 << lli
          << setw(1) << ob->SNR2;
Index: trunk/BNC/bncrinex.h
===================================================================
--- trunk/BNC/bncrinex.h	(revision 361)
+++ trunk/BNC/bncrinex.h	(revision 366)
@@ -39,5 +39,6 @@
  public:
    bncRinex(const char* StatID, const QUrl& mountPoint, 
-            const QByteArray& format);
+            const QByteArray& format, const QByteArray& latitude,
+            const QByteArray& longitude, const QByteArray& nmea);
    ~bncRinex();
    void deepCopy(const Observation* obs);
@@ -63,4 +64,7 @@
    QString             _sklName;
    QByteArray          _format;
+   QByteArray          _latitude;
+   QByteArray          _longitude;
+   QByteArray          _nmea;
 };
 
Index: trunk/BNC/bnctabledlg.cpp
===================================================================
--- trunk/BNC/bnctabledlg.cpp	(revision 361)
+++ trunk/BNC/bnctabledlg.cpp	(revision 366)
@@ -87,5 +87,5 @@
   _buttonGet = new QPushButton(tr("Get table"), this);
   connect(_buttonGet, SIGNAL(clicked()), this, SLOT(slotGetTable()));
-
+ 
   _buttonCancel = new QPushButton(tr("Cancel"), this);
   connect(_buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
@@ -142,5 +142,8 @@
   const int timeOut = 10*1000;
   QString msg;
-  QTcpSocket* socket = bncGetThread::request(url, timeOut, msg);
+  QByteArray _latitude;
+  QByteArray _longitude;
+  QByteArray _nmea;
+  QTcpSocket* socket = bncGetThread::request(url, _latitude, _longitude, _nmea, timeOut, msg);
 
   if (!socket) {
@@ -207,5 +210,5 @@
   static const QStringList labels = QString("mountpoint,identifier,format,"
     "format-details,carrier,nav-system,network,country,latitude,longitude,"
-    "nmea,solution,generator,compression,authentication,fee,bitrate,"
+    "type,solution,generator,compression,authentication,fee,bitrate,"
     "misc").split(",");
 
@@ -224,4 +227,7 @@
       ++nRow;
       for (int ic = 0; ic < columns.size()-1; ic++) {
+
+        if (ic+1 == 11) { if (columns[ic+1] == "0") { columns[ic+1] = "RS"; } else { columns[ic+1] = "VRS"; }}
+
         QTableWidgetItem* it = new QTableWidgetItem(columns[ic+1]);
         it->setFlags(it->flags() & ~Qt::ItemIsEditable);
@@ -251,4 +257,7 @@
       QTableWidgetItem* item   = _table->item(ir,0);
       QString           format = _table->item(ir,2)->text();
+      QString         latitude = _table->item(ir,8)->text();
+      QString        longitude = _table->item(ir,9)->text();
+      QString             nmea = _table->item(ir,10)->text();
       format.replace(" ", "_");
       if (_table->isItemSelected(item)) {
@@ -260,5 +269,5 @@
         url.setPath(item->text());
 
-        mountPoints->push_back(url.toString() + " " + format);
+        mountPoints->push_back(url.toString() + " " + format + " " + latitude + " " + longitude + " " + nmea);
       }
     }
Index: trunk/BNC/bncwindow.cpp
===================================================================
--- trunk/BNC/bncwindow.cpp	(revision 361)
+++ trunk/BNC/bncwindow.cpp	(revision 366)
@@ -47,5 +47,5 @@
 #include "bnchlpdlg.h" 
 #include "bnchtml.h" 
-#include "bnctableitem.h" 
+#include "bnctableitem.h"
 
 using namespace std;
@@ -57,8 +57,7 @@
   int ww = QFontMetrics(this->font()).width('w');
   
-  static const QStringList labels = QString("account,mountpoint,"
-    "decoder,bytes").split(",");
-
-  setMinimumSize(60*ww, 60*ww);
+  static const QStringList labels = QString("account,mountpoint,decoder,lat,long,type,bytes").split(",");
+
+  setMinimumSize(77*ww, 60*ww);
   setWindowTitle(tr("BKG Ntrip Client (BNC), Version 1.1b"));
 
@@ -163,10 +162,10 @@
   _rnxSamplSpinBox->setSuffix(" sec");
   _logFileLineEdit    = new QLineEdit(settings.value("logFile").toString());
-  _LatLineEdit     = new QLineEdit(settings.value("approxLat").toString());
-  _LatLineEdit->setMaximumWidth(9*ww);
-  _LonLineEdit     = new QLineEdit(settings.value("approxLon").toString());
-  _LonLineEdit->setMaximumWidth(9*ww);
-  _mountPointsTable   = new QTableWidget(0,4);
+  _mountPointsTable   = new QTableWidget(0,7);
   _mountPointsTable->horizontalHeader()->resizeSection(1,25*ww);
+  _mountPointsTable->horizontalHeader()->resizeSection(2,9*ww);
+  _mountPointsTable->horizontalHeader()->resizeSection(3,7*ww); 
+  _mountPointsTable->horizontalHeader()->resizeSection(4,7*ww); 
+  _mountPointsTable->horizontalHeader()->resizeSection(5,5*ww); 
   _mountPointsTable->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
   _mountPointsTable->horizontalHeader()->setStretchLastSection(true);
@@ -186,4 +185,5 @@
     QStringList hlp = it.next().split(" ");
     if (hlp.size() <= 1) continue;
+    if (hlp.size() == 2) continue; // For downward compatibility
     _mountPointsTable->insertRow(iRow);
 
@@ -191,5 +191,6 @@
 
     QString fullPath = url.host() + QString(":%1").arg(url.port()) + url.path();
-    QString format(hlp[1]);
+    QString format(hlp[1]); QString latitude(hlp[2]); QString longitude(hlp[3]);
+    QString nmea(hlp[4]);
 
     QTableWidgetItem* it;
@@ -205,7 +206,25 @@
     _mountPointsTable->setItem(iRow, 2, it);
 
+    if      (nmea == "VRS") {
+    it = new QTableWidgetItem(latitude);
+    _mountPointsTable->setItem(iRow, 3, it);
+    it = new QTableWidgetItem(longitude);
+    _mountPointsTable->setItem(iRow, 4, it);
+    } else {
+    it = new QTableWidgetItem(latitude);
+    it->setFlags(it->flags() & ~Qt::ItemIsEditable);
+    _mountPointsTable->setItem(iRow, 3, it);
+    it = new QTableWidgetItem(longitude);
+    it->setFlags(it->flags() & ~Qt::ItemIsEditable);
+    _mountPointsTable->setItem(iRow, 4, it);
+    }
+
+    it = new QTableWidgetItem(nmea);
+    it->setFlags(it->flags() & ~Qt::ItemIsEditable);
+    _mountPointsTable->setItem(iRow, 5, it);
+
     bncTableItem* bncIt = new bncTableItem();
     bncIt->setFlags(bncIt->flags() & ~Qt::ItemIsEditable);
-    _mountPointsTable->setItem(iRow, 3, bncIt);
+    _mountPointsTable->setItem(iRow, 6, bncIt);
 
     iRow++;
@@ -252,8 +271,4 @@
 
   layout->addWidget(new QLabel("Mountpoints"),                   8, 0, 1, 2);
-
-  layout->addWidget(new QLabel(tr("Approx. Lat./Lon.")),         8, 2);
-  layout->addWidget(_LatLineEdit,                                8, 3);
-  layout->addWidget(_LonLineEdit,                                8, 4);
 
   layout->addWidget(_mountPointsTable,                           9, 0, 1, 5);
@@ -332,5 +347,6 @@
     QUrl    url(hlp[0]);
     QString fullPath = url.host() + QString(":%1").arg(url.port()) + url.path();
-    QString format(hlp[1]);
+    QString format(hlp[1]); QString latitude(hlp[2]); QString longitude(hlp[3]);
+    QString nmea(hlp[4]);
 
     _mountPointsTable->insertRow(iRow);
@@ -348,6 +364,24 @@
     _mountPointsTable->setItem(iRow, 2, it);
 
+    if      (nmea == "VRS") {
+    it = new QTableWidgetItem(latitude);
+    _mountPointsTable->setItem(iRow, 3, it);
+    it = new QTableWidgetItem(longitude);
+    _mountPointsTable->setItem(iRow, 4, it);
+    } else {
+    it = new QTableWidgetItem(latitude);
+    it->setFlags(it->flags() & ~Qt::ItemIsEditable);
+    _mountPointsTable->setItem(iRow, 3, it);
+    it = new QTableWidgetItem(longitude);
+    it->setFlags(it->flags() & ~Qt::ItemIsEditable);
+    _mountPointsTable->setItem(iRow, 4, it);
+    }
+
+    it = new QTableWidgetItem(nmea);
+    it->setFlags(it->flags() & ~Qt::ItemIsEditable);
+    _mountPointsTable->setItem(iRow, 5, it);
+
     bncTableItem* bncIt = new bncTableItem();
-    _mountPointsTable->setItem(iRow, 3, bncIt);
+    _mountPointsTable->setItem(iRow, 6, bncIt);
 
     iRow++;
@@ -377,6 +411,4 @@
   settings.setValue("rnxAppend",   _rnxAppendCheckBox->checkState());
   settings.setValue("logFile",     _logFileLineEdit->text());
-  settings.setValue("approxLat",   _LatLineEdit->text());
-  settings.setValue("approxLon",   _LonLineEdit->text());
   
 QStringList mountPoints;
@@ -387,5 +419,8 @@
 
     mountPoints.append(url.toString() + " " + 
-                       _mountPointsTable->item(iRow, 2)->text());
+                       _mountPointsTable->item(iRow, 2)->text()
+               + " " + _mountPointsTable->item(iRow, 3)->text()
+               + " " + _mountPointsTable->item(iRow, 4)->text()
+               + " " + _mountPointsTable->item(iRow, 5)->text());
   }
   settings.setValue("mountPoints", mountPoints);
@@ -431,5 +466,9 @@
     QByteArray format = _mountPointsTable->item(iRow, 2)->text().toAscii();
 
-    bncGetThread* getThread = new bncGetThread(url, format, iRow);
+    QByteArray latitude = _mountPointsTable->item(iRow, 3)->text().toAscii();
+    QByteArray longitude = _mountPointsTable->item(iRow, 4)->text().toAscii();
+    QByteArray nmea = _mountPointsTable->item(iRow, 5)->text().toAscii();
+
+    bncGetThread* getThread = new bncGetThread(url, format, latitude, longitude, nmea, iRow);
 
     connect(getThread, SIGNAL(newMessage(const QByteArray&)), 
@@ -439,5 +478,5 @@
 
     connect(getThread, SIGNAL(newObs(const QByteArray&, Observation*)),
-            (bncTableItem*) _mountPointsTable->item(iRow, 3), 
+            (bncTableItem*) _mountPointsTable->item(iRow, 6), 
             SLOT(slotNewObs(const QByteArray&, Observation*)));
 
