Changeset 242 in ntrip


Ignore:
Timestamp:
Oct 13, 2006, 9:36:48 AM (18 years ago)
Author:
mervart
Message:

* empty log message *

Location:
trunk/BNC/RTCM
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/RTCM/RTCM2.cpp

    r241 r242  
    1616//   2006/09/19  OMO  Fixed getHeader() methods
    1717//   2006/09/21  OMO  Reduced phase ambiguity to 2^23 cycles
     18//   2006/10/05  OMO  Specified const'ness of various member functions
     19//   2006/10/13  LMV  Fixed resolvedPhase to handle missing C1 range
    1820//
    1921// (c) DLR/GSOC
     
    2931
    3032#include "RTCM2.h"
     33
    3134
    3235using namespace std;
     
    501504    cerr << "Error: can't handle >32 bits in RTCM2packet::getUnsignedBits"
    502505         << endl;
    503     ///    exit(-1);
    504     return 0;
     506    exit(-1);
    505507  };
    506508 
    507509  if ( 24*DW.size() < start+n-1 ) {
    508510    cerr << "Error: Packet too short in RTCM2packet::getUnsignedBits" << endl;
    509     ////    exit(-1);
    510     return 0;
     511    exit(-1);
    511512  }
    512513
     
    555556    cerr << "Error: can't handle >32 bits in RTCM2packet::getBits"
    556557         << endl;
    557     ////    exit(-1);
    558     return 0;
     558    exit(-1);
    559559  };
    560560 
    561561  if ( 24*DW.size() < start+n-1 ) {
    562562    cerr << "Error: Packet too short in RTCM2packet::getBits" << endl;
    563     return 0;
     563    exit(-1);
    564564  }
    565565
     
    735735// Availability checks
    736736
    737 bool RTCM2_Obs::anyGPS() {
     737bool RTCM2_Obs::anyGPS() const {
    738738
    739739  return  availability.test(bit_L1rngGPS) ||
     
    744744};
    745745
    746 bool RTCM2_Obs::anyGLONASS() {
     746bool RTCM2_Obs::anyGLONASS() const {
    747747
    748748  return  availability.test(bit_L1rngGLO) ||
     
    753753};
    754754
    755 bool RTCM2_Obs::allGPS() {
     755bool RTCM2_Obs::allGPS() const {
    756756
    757757  return  availability.test(bit_L1rngGPS) &&
     
    762762};
    763763
    764 bool RTCM2_Obs::allGLONASS() {
     764bool RTCM2_Obs::allGLONASS() const {
    765765
    766766  return  availability.test(bit_L1rngGLO) &&
     
    773773// Validity
    774774
    775 bool RTCM2_Obs::valid() {
     775bool RTCM2_Obs::valid() const {
    776776
    777777  return ( allGPS() && (allGLONASS() || !anyGLONASS()) && !pendingMsg );
     
    985985//
    986986
    987 double RTCM2_Obs::resolvedPhase_L1(int i){
     987double RTCM2_Obs::resolvedPhase_L1(int i) const {
    988988
    989989//const double  ambig = pow(2.0,24);   // as per RTCM2 spec
     
    10051005};
    10061006
    1007 double RTCM2_Obs::resolvedPhase_L2(int i){
     1007double RTCM2_Obs::resolvedPhase_L2(int i) const {
    10081008
    10091009//const double  ambig = pow(2.0,24);   // as per RTCM2 spec
     
    10301030
    10311031void RTCM2_Obs::resolveEpoch (int  refWeek,   double  refSecs, 
    1032                               int& epochWeek, double& epochSecs   ) {
     1032                              int& epochWeek, double& epochSecs   ) const {
    10331033
    10341034  const double secsPerWeek = 604800.0;                           
     
    10431043
    10441044}; // End of namespace rtcm2
    1045 
    1046 // ---------------- begin added by LM --------------------------------------
    1047 
    1048 #include "../bncutils.h"
    1049 
    1050 // Constructor
    1051 ////////////////////////////////////////////////////////////////////////////
    1052 RTCM2::RTCM2() {
    1053 
    1054 }
    1055 
    1056 // Destructor
    1057 ////////////////////////////////////////////////////////////////////////////
    1058 RTCM2::~RTCM2() {
    1059 
    1060 }
    1061 
    1062 //
    1063 ////////////////////////////////////////////////////////////////////////////
    1064 void RTCM2::Decode(char* buffer, int bufLen) {
    1065 
    1066   _buffer.append(buffer, bufLen);
    1067   int    refWeek;
    1068   double refSecs;
    1069   currentGPSWeeks(refWeek, refSecs);
    1070 
    1071   while(true) {
    1072     _PP.getPacket(_buffer);
    1073     if (!_PP.valid()) {
    1074       return;
    1075     }
    1076 
    1077     if ( _PP.ID()==18 || _PP.ID()==19 ) {   
    1078 
    1079       _ObsBlock.extract(_PP);
    1080 
    1081       if (_ObsBlock.valid()) {
    1082 
    1083         int    epochWeek;
    1084         double epochSecs;
    1085         _ObsBlock.resolveEpoch(refWeek, refSecs, epochWeek, epochSecs);
    1086          
    1087         for (int iSat=0; iSat < _ObsBlock.nSat; iSat++) {
    1088           ////          if (_ObsBlock.PRN[iSat] > 32) continue;   // Glonass not (yet) wanted
    1089           Observation* obs = new Observation();
    1090        
    1091           obs->SVPRN    = _ObsBlock.PRN[iSat];
    1092           obs->GPSWeek  = epochWeek;
    1093           obs->GPSWeeks = epochSecs;
    1094           obs->C1       = _ObsBlock.rng_C1[iSat];
    1095           obs->P1       = _ObsBlock.rng_P1[iSat];
    1096           obs->P2       = _ObsBlock.rng_P2[iSat];
    1097           obs->L1       = _ObsBlock.resolvedPhase_L1(iSat);
    1098           obs->L2       = _ObsBlock.resolvedPhase_L2(iSat);
    1099 
    1100           _obsList.push_back(obs);
    1101         }
    1102         _ObsBlock.clear();
    1103       }
    1104     }
    1105   }
    1106 }
    1107 
    1108 // ----------------- end added by LM ---------------------------------------
  • trunk/BNC/RTCM/RTCM2.h

    r227 r242  
    2525//
    2626//   2006/09/17  OMO  Created
     27//   2006/10/05  OMO  Specified const'ness of various member functions
    2728//
    2829// (c) DLR/GSOC
     
    283284    void   extract(const RTCM2packet& P);  // Packet handler
    284285    void   clear();                        // Initialization
    285     bool   valid();                        // Check for complete obs block
    286 
    287     double resolvedPhase_L1(int i);         // L1 & L2 carrier phase of i-th sat
    288     double resolvedPhase_L2(int i);         // with resolved 2^24 cy ambiguity
     286    bool   valid() const;                  // Check for complete obs block
     287
     288    double resolvedPhase_L1(int i) const;  // L1 & L2 carrier phase of i-th sat
     289    double resolvedPhase_L2(int i) const;  // with resolved 2^24 cy ambiguity
    289290                                           // (based on rng_C1)
    290291
     
    292293                         double  refSecs,  // epoch (GPS week and secs)
    293294                         int&    epochWeek,
    294                          double& epochSecs  );
     295                         double& epochSecs  ) const;
    295296   
    296297                                               
     
    308309  private:
    309310
    310     bool anyGPS();
    311     bool anyGLONASS();
    312     bool allGPS();
    313     bool allGLONASS();
     311    bool anyGPS() const;
     312    bool anyGLONASS() const;
     313    bool allGPS() const;
     314    bool allGLONASS() const;
    314315
    315316  private:
     
    325326}; // End of namespace rtcm2
    326327
    327 // ---------------- begin added by LM --------------------------------------
    328 #include "GPSDecoder.h"
    329 class RTCM2 : public GPSDecoder {
    330   public:
    331     RTCM2();
    332     ~RTCM2();
    333     virtual void Decode(char* buffer, int bufLen);
    334   private:
    335     std::string        _buffer;
    336     rtcm2::RTCM2_Obs   _ObsBlock;
    337     rtcm2::RTCM2packet _PP;
    338 };
    339 // ----------------- end added by LM ---------------------------------------
    340 
    341328#endif  // include blocker
Note: See TracChangeset for help on using the changeset viewer.