Index: /trunk/BNC/RTCM/RTCM2.cpp
===================================================================
--- /trunk/BNC/RTCM/RTCM2.cpp	(revision 241)
+++ /trunk/BNC/RTCM/RTCM2.cpp	(revision 242)
@@ -16,4 +16,6 @@
 //   2006/09/19  OMO  Fixed getHeader() methods
 //   2006/09/21  OMO  Reduced phase ambiguity to 2^23 cycles
+//   2006/10/05  OMO  Specified const'ness of various member functions
+//   2006/10/13  LMV  Fixed resolvedPhase to handle missing C1 range
 //
 // (c) DLR/GSOC
@@ -29,4 +31,5 @@
 
 #include "RTCM2.h"
+
 
 using namespace std;
@@ -501,12 +504,10 @@
     cerr << "Error: can't handle >32 bits in RTCM2packet::getUnsignedBits" 
          << endl;
-    ///    exit(-1);
-    return 0;
+    exit(-1);
   };
   
   if ( 24*DW.size() < start+n-1 ) {
     cerr << "Error: Packet too short in RTCM2packet::getUnsignedBits" << endl;
-    ////    exit(-1);
-    return 0;
+    exit(-1);
   }
 
@@ -555,11 +556,10 @@
     cerr << "Error: can't handle >32 bits in RTCM2packet::getBits" 
          << endl;
-    ////    exit(-1);
-    return 0;
+    exit(-1);
   };
   
   if ( 24*DW.size() < start+n-1 ) {
     cerr << "Error: Packet too short in RTCM2packet::getBits" << endl;
-    return 0;
+    exit(-1);
   }
 
@@ -735,5 +735,5 @@
 // Availability checks
 
-bool RTCM2_Obs::anyGPS() {
+bool RTCM2_Obs::anyGPS() const {
 
   return  availability.test(bit_L1rngGPS) ||
@@ -744,5 +744,5 @@
 };
 
-bool RTCM2_Obs::anyGLONASS() {
+bool RTCM2_Obs::anyGLONASS() const {
 
   return  availability.test(bit_L1rngGLO) ||
@@ -753,5 +753,5 @@
 };
 
-bool RTCM2_Obs::allGPS() {
+bool RTCM2_Obs::allGPS() const {
 
   return  availability.test(bit_L1rngGPS) &&
@@ -762,5 +762,5 @@
 };
 
-bool RTCM2_Obs::allGLONASS() {
+bool RTCM2_Obs::allGLONASS() const {
 
   return  availability.test(bit_L1rngGLO) &&
@@ -773,5 +773,5 @@
 // Validity
 
-bool RTCM2_Obs::valid() {
+bool RTCM2_Obs::valid() const {
 
   return ( allGPS() && (allGLONASS() || !anyGLONASS()) && !pendingMsg );
@@ -985,5 +985,5 @@
 //
 
-double RTCM2_Obs::resolvedPhase_L1(int i){
+double RTCM2_Obs::resolvedPhase_L1(int i) const {
 
 //const double  ambig = pow(2.0,24);   // as per RTCM2 spec
@@ -1005,5 +1005,5 @@
 }; 
 
-double RTCM2_Obs::resolvedPhase_L2(int i){
+double RTCM2_Obs::resolvedPhase_L2(int i) const {
 
 //const double  ambig = pow(2.0,24);   // as per RTCM2 spec
@@ -1030,5 +1030,5 @@
 
 void RTCM2_Obs::resolveEpoch (int  refWeek,   double  refSecs,  
-                              int& epochWeek, double& epochSecs   ) {
+                              int& epochWeek, double& epochSecs   ) const {
 
   const double secsPerWeek = 604800.0;                            
@@ -1043,66 +1043,2 @@
 
 }; // End of namespace rtcm2
-
-// ---------------- begin added by LM --------------------------------------
-
-#include "../bncutils.h"
-
-// Constructor
-////////////////////////////////////////////////////////////////////////////
-RTCM2::RTCM2() {
-
-}
-
-// Destructor
-////////////////////////////////////////////////////////////////////////////
-RTCM2::~RTCM2() {
-
-}
-
-// 
-////////////////////////////////////////////////////////////////////////////
-void RTCM2::Decode(char* buffer, int bufLen) {
-
-  _buffer.append(buffer, bufLen);
-  int    refWeek;
-  double refSecs;
-  currentGPSWeeks(refWeek, refSecs);
-
-  while(true) {
-    _PP.getPacket(_buffer);
-    if (!_PP.valid()) {
-      return;
-    }
-
-    if ( _PP.ID()==18 || _PP.ID()==19 ) {   
-
-      _ObsBlock.extract(_PP);
-
-      if (_ObsBlock.valid()) {
-
-        int    epochWeek;
-        double epochSecs;
-        _ObsBlock.resolveEpoch(refWeek, refSecs, epochWeek, epochSecs);
-          
-        for (int iSat=0; iSat < _ObsBlock.nSat; iSat++) {
-          ////          if (_ObsBlock.PRN[iSat] > 32) continue;   // Glonass not (yet) wanted
-          Observation* obs = new Observation();
-        
-          obs->SVPRN    = _ObsBlock.PRN[iSat];
-          obs->GPSWeek  = epochWeek;
-          obs->GPSWeeks = epochSecs;
-          obs->C1       = _ObsBlock.rng_C1[iSat];
-          obs->P1       = _ObsBlock.rng_P1[iSat];
-          obs->P2       = _ObsBlock.rng_P2[iSat];
-          obs->L1       = _ObsBlock.resolvedPhase_L1(iSat);
-          obs->L2       = _ObsBlock.resolvedPhase_L2(iSat);
-
-          _obsList.push_back(obs);
-        }
-        _ObsBlock.clear();
-      }
-    }
-  }
-}
-
-// ----------------- end added by LM ---------------------------------------
Index: /trunk/BNC/RTCM/RTCM2.h
===================================================================
--- /trunk/BNC/RTCM/RTCM2.h	(revision 241)
+++ /trunk/BNC/RTCM/RTCM2.h	(revision 242)
@@ -25,4 +25,5 @@
 //
 //   2006/09/17  OMO  Created
+//   2006/10/05  OMO  Specified const'ness of various member functions
 //
 // (c) DLR/GSOC
@@ -283,8 +284,8 @@
     void   extract(const RTCM2packet& P);  // Packet handler
     void   clear();                        // Initialization
-    bool   valid();                        // Check for complete obs block 
-
-    double resolvedPhase_L1(int i);         // L1 & L2 carrier phase of i-th sat
-    double resolvedPhase_L2(int i);         // with resolved 2^24 cy ambiguity 
+    bool   valid() const;                  // Check for complete obs block 
+
+    double resolvedPhase_L1(int i) const;  // L1 & L2 carrier phase of i-th sat
+    double resolvedPhase_L2(int i) const;  // with resolved 2^24 cy ambiguity 
                                            // (based on rng_C1)
 
@@ -292,5 +293,5 @@
                          double  refSecs,  // epoch (GPS week and secs)
                          int&    epochWeek,
-                         double& epochSecs  );
+                         double& epochSecs  ) const;
     
                                                
@@ -308,8 +309,8 @@
   private:
 
-    bool anyGPS();
-    bool anyGLONASS();
-    bool allGPS();
-    bool allGLONASS();
+    bool anyGPS() const;
+    bool anyGLONASS() const;
+    bool allGPS() const;
+    bool allGLONASS() const;
 
   private:
@@ -325,17 +326,3 @@
 }; // End of namespace rtcm2
 
-// ---------------- begin added by LM --------------------------------------
-#include "GPSDecoder.h"
-class RTCM2 : public GPSDecoder {
-  public:
-    RTCM2();
-    ~RTCM2();
-    virtual void Decode(char* buffer, int bufLen);
-  private:
-    std::string        _buffer;
-    rtcm2::RTCM2_Obs   _ObsBlock;
-    rtcm2::RTCM2packet _PP;
-};
-// ----------------- end added by LM ---------------------------------------
-
 #endif  // include blocker
Index: /trunk/BNC/RTCM/RTCM2Decoder.cpp
===================================================================
--- /trunk/BNC/RTCM/RTCM2Decoder.cpp	(revision 242)
+++ /trunk/BNC/RTCM/RTCM2Decoder.cpp	(revision 242)
@@ -0,0 +1,75 @@
+//------------------------------------------------------------------------------
+//
+// RTCM2Decoder.cpp
+// 
+//------------------------------------------------------------------------------
+
+#include "../bncutils.h"
+#include "GPSDecoder.h"
+#include "RTCM2.h"
+
+using namespace std;
+
+// 
+// Constructor
+// 
+
+RTCM2Decoder::RTCM2Decoder() {
+
+}
+
+// 
+// Destructor
+// 
+
+RTCM2Decoder::~RTCM2Decoder() {
+
+}
+
+// 
+//
+//
+
+void RTCM2Decoder::Decode(char* buffer, int bufLen) {
+
+  _buffer.append(buffer, bufLen);
+  int    refWeek;
+  double refSecs;
+  currentGPSWeeks(refWeek, refSecs);
+
+  while(true) {
+    _PP.getPacket(_buffer);
+    if (!_PP.valid()) {
+      return;
+    }
+
+    if ( _PP.ID()==18 || _PP.ID()==19 ) {   
+
+      _ObsBlock.extract(_PP);
+
+      if (_ObsBlock.valid()) {
+
+        int    epochWeek;
+        double epochSecs;
+        _ObsBlock.resolveEpoch(refWeek, refSecs, epochWeek, epochSecs);
+          
+        for (int iSat=0; iSat < _ObsBlock.nSat; iSat++) {
+          Observation* obs = new Observation();
+        
+          obs->SVPRN    = _ObsBlock.PRN[iSat];
+          obs->GPSWeek  = epochWeek;
+          obs->GPSWeeks = epochSecs;
+          obs->C1       = _ObsBlock.rng_C1[iSat];
+          obs->P1       = _ObsBlock.rng_P1[iSat];
+          obs->P2       = _ObsBlock.rng_P2[iSat];
+          obs->L1       = _ObsBlock.resolvedPhase_L1(iSat);
+          obs->L2       = _ObsBlock.resolvedPhase_L2(iSat);
+
+          _obsList.push_back(obs);
+        }
+        _ObsBlock.clear();
+      }
+    }
+  }
+}
+
Index: /trunk/BNC/RTCM/RTCM2Decoder.h
===================================================================
--- /trunk/BNC/RTCM/RTCM2Decoder.h	(revision 242)
+++ /trunk/BNC/RTCM/RTCM2Decoder.h	(revision 242)
@@ -0,0 +1,28 @@
+//------------------------------------------------------------------------------
+//
+// RTCM2Decoder.h
+// 
+//------------------------------------------------------------------------------
+
+#ifndef INC_RTCM2DECODER_H
+#define INC_RTCM2DECODER_H
+
+#include "GPSDecoder.h"
+#include "RTCM2.h"
+
+class RTCM2Decoder: public GPSDecoder {
+
+  public:
+    RTCM2Decoder();
+    ~RTCMDecoder2();
+    virtual void Decode(char* buffer, int bufLen);
+
+  private:
+
+    std::string        _buffer;
+    rtcm2::RTCM2_Obs   _ObsBlock;
+    rtcm2::RTCM2packet _PP;
+
+};
+
+#endif  // include blocker
