Changeset 10692 in ntrip


Ignore:
Timestamp:
Jul 8, 2025, 10:07:50 AM (5 months ago)
Author:
stuerze
Message:

RTCM message 1230 (on-change) and the size of each RTCM message is added in scanRTCM

Location:
trunk/BNC/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/GPSDecoder.h

    r10691 r10692  
    6262  struct t_typeInfo {
    6363    t_typeInfo() {
    64       type = 0;
    65       size = 0;
     64      _type = 0;
     65      _size = 0;
    6666    };
    67     int    type;
    68     size_t size;
     67    int    _type;
     68    size_t _size;
    6969  };
    7070
     
    7474
    7575    t_antRefPoint() {
    76       xx = yy = zz = height = 0.0;
    77       type = ARP;
    78       height_f = false;
    79       message  = 0;
     76      _xx = _yy = _zz = _height = 0.0;
     77      _type = ARP;
     78      _height_f = false;
     79      _message  = 0;
    8080    };
    8181
    82     double xx;
    83     double yy;
    84     double zz;
    85     t_type type;
    86     double height;
    87     bool   height_f;
    88     int    message;
     82    double _xx;
     83    double _yy;
     84    double _zz;
     85    t_type _type;
     86    double _height;
     87    bool   _height_f;
     88    int    _message;
    8989  };
    9090
     
    9292    t_antInfo() {
    9393    };
    94     char descriptor[256];
    95     char serialnumber[256];
     94    char _descriptor[256];
     95    char _serialnumber[256];
    9696  };
    9797
     
    9999    t_recInfo() {
    100100    };
    101     char descriptor[256];
    102     char serialnumber[256];
    103     char firmware[256];
     101    char _descriptor[256];
     102    char _serialnumber[256];
     103    char _firmware[256];
    104104  };
    105105
     
    107107  public:
    108108    t_GloBiasInfo() {
    109       clear();
     109      init();
    110110    };
    111     bool operator==(const t_GloBiasInfo& biasInfo2) const {
    112       if (staID     == biasInfo2.staID &&
    113           indicator == biasInfo2.indicator &&
    114           L1C_value == biasInfo2.L1C_value &&
    115           L1P_value == biasInfo2.L1P_value &&
    116           L2C_value == biasInfo2.L2C_value &&
    117           L2P_value == biasInfo2.L2P_value  ) {
     111    bool operator!=(const t_GloBiasInfo& gloBiasInfo2) {
     112
     113      if (_staID     != gloBiasInfo2._staID     ||
     114          _indicator != gloBiasInfo2._indicator ||
     115          (fabs(_L1C_value - gloBiasInfo2._L1C_value) > 0.000000000001 ) ||
     116          (fabs(_L1P_value - gloBiasInfo2._L1P_value) > 0.000000000001 ) ||
     117          (fabs(_L2C_value - gloBiasInfo2._L2C_value) > 0.000000000001 ) ||
     118          (fabs(_L2P_value - gloBiasInfo2._L2P_value) > 0.000000000001 )  ) {
     119        setChanged(true);
    118120        return true;
    119121      }
    120122      else {
     123        setChanged(false);
    121124        return false;
    122125      }
    123126    }
    124127
    125     void set(const t_GloBiasInfo& biasInfo) {
    126       staID     = biasInfo.staID;
    127       indicator = biasInfo.indicator;
    128       L1C_value = biasInfo.L1C_value;
    129       L1P_value = biasInfo.L1P_value;
    130       L2C_value = biasInfo.L2C_value;
    131       L2P_value = biasInfo.L2P_value;
    132       changed = true;
     128    void set(const t_GloBiasInfo& gloBiasInfo) {
     129      _staID     = gloBiasInfo._staID;
     130      _indicator = gloBiasInfo._indicator;
     131      _L1C_value = gloBiasInfo._L1C_value;
     132      _L1P_value = gloBiasInfo._L1P_value;
     133      _L2C_value = gloBiasInfo._L2C_value;
     134      _L2P_value = gloBiasInfo._L2P_value;
    133135    }
    134 
    135     void clear() {
    136       staID = 0;
    137       indicator = 0;
    138       L1C_value = 0.0;
    139       L1P_value = 0.0;
    140       L2C_value = 0.0;
    141       L2P_value = 0.0;
    142       changed = false;
     136    void setChanged(bool changed) {
     137      _changed = changed;
     138    }
     139    bool changed() {return _changed;};
     140    void init() {
     141      _staID = 0;
     142      _indicator = 1;
     143      _L1C_value = 0.0;
     144      _L1P_value = 0.0;
     145      _L2C_value = 0.0;
     146      _L2P_value = 0.0;
     147      _changed = false;
    143148    }
    144149    QString toString() {
    145       QString biasIndicator =  (indicator == 1) ? QString("aligned") : QString("unaligned");
     150      QString biasIndicator =  (_indicator == 1) ? QString("aligned") : QString("unaligned");
    146151      QString biasesStr =
    147152          QString(": GLONASS L1/L2 Code-Phase Biases: staID=%1 indicator=%2 L1C=%3 L1P=%4 L2C=%5 L2P=%6")
    148           .arg(staID).arg(biasIndicator)
    149           .arg(L1C_value, 0, 'f', 2)
    150           .arg(L1P_value, 0, 'f', 2)
    151           .arg(L2C_value, 0, 'f', 2)
    152           .arg(L2P_value, 0, 'f', 2);
     153          .arg(_staID).arg(biasIndicator)
     154          .arg(_L1C_value, 0, 'f', 2)
     155          .arg(_L1P_value, 0, 'f', 2)
     156          .arg(_L2C_value, 0, 'f', 2)
     157          .arg(_L2P_value, 0, 'f', 2);
    153158
    154159      return biasesStr;
    155160    }
    156     int      staID;
    157     int      indicator;
    158     double   L1C_value;
    159     double   L1P_value;
    160     double   L2C_value;
    161     double   L2P_value;
    162     bool     changed;
     161
     162    int      _staID;
     163    int      _indicator;
     164    double   _L1C_value;
     165    double   _L1P_value;
     166    double   _L2C_value;
     167    double   _L2P_value;
     168    bool     _changed;
    163169
    164170
     
    175181  QList<t_rtcmCrs>        _rtcmCrs;            // RTCM CRS
    176182  QString                 _gloFrq;             // GLONASS slot
    177   t_GloBiasInfo           _gloBiases;          // RTCM GLO bias information message
     183  t_GloBiasInfo           _gloBiasInfo;          // RTCM GLO bias information message
    178184  bncRinex*               _rnx;                // RINEX writer
    179185};
  • trunk/BNC/src/RTCM/RTCM2Decoder.cpp

    r10688 r10692  
    118118    }
    119119
    120     // Store message number
     120    // Store _message number
    121121    _typeList.push_back(t_typeInfo());
    122     _typeList.back().type = _PP.ID();
     122    _typeList.back()._type = _PP.ID();
    123123    //_typeList.back().size = 0;
    124124
     
    210210        _antList.push_back(t_antRefPoint());
    211211
    212         this->getStaCrd(_antList.back().xx, _antList.back().yy, _antList.back().zz);
    213 
    214         _antList.back().type = t_antRefPoint::APC;
    215         _antList.back().message = _PP.ID();
     212        this->getStaCrd(_antList.back()._xx, _antList.back()._yy, _antList.back()._zz);
     213
     214        _antList.back()._type = t_antRefPoint::APC;
     215        _antList.back()._message = _PP.ID();
    216216      }
    217217    } else if (_PP.ID() == 23) {
     
    220220        int serlen = strlen(_msg23.antSN.c_str());
    221221        if ((antlen) &&
    222             (_antType.empty() || strncmp(_antType.back().descriptor, _msg23.antType.c_str(), antlen) != 0)) {
     222            (_antType.empty() || strncmp(_antType.back()._descriptor, _msg23.antType.c_str(), antlen) != 0)) {
    223223          _antType.push_back(t_antInfo());
    224           memcpy(_antType.back().descriptor, _msg23.antType.c_str(), antlen);
    225           _antType.back().descriptor[antlen] = 0;
     224          memcpy(_antType.back()._descriptor, _msg23.antType.c_str(), antlen);
     225          _antType.back()._descriptor[antlen] = 0;
    226226          if (serlen) {
    227             memcpy(_antType.back().serialnumber,  _msg23.antSN.c_str(), serlen);
    228             _antType.back().serialnumber[serlen] = 0;
     227            memcpy(_antType.back()._serialnumber,  _msg23.antSN.c_str(), serlen);
     228            _antType.back()._serialnumber[serlen] = 0;
    229229          }
    230230        }
     
    234234        _antList.push_back(t_antRefPoint());
    235235
    236         _antList.back().xx = _msg24.x;
    237         _antList.back().yy = _msg24.y;
    238         _antList.back().zz = _msg24.z;
    239 
    240         _antList.back().height_f = true;
    241         _antList.back().height = _msg24.h;
    242 
    243         _antList.back().type = t_antRefPoint::ARP;
    244         _antList.back().message = _PP.ID();
     236        _antList.back()._xx = _msg24.x;
     237        _antList.back()._yy = _msg24.y;
     238        _antList.back()._zz = _msg24.z;
     239
     240        _antList.back()._height_f = true;
     241        _antList.back()._height = _msg24.h;
     242
     243        _antList.back()._type = t_antRefPoint::ARP;
     244        _antList.back()._message = _PP.ID();
    245245      }
    246246    }
     
    265265  currentGPSWeeks(refWeek, refSecs);
    266266
    267   // Resolve receiver time of measurement (see RTCM 2.3, page 4-42, Message 18, Note 1)
     267  // Resolve receiver time of measurement (see RTCM 2.3, page 4-42, message 18, Note 1)
    268268  // ----------------------------------------------------------------------------------
    269269  double hoursec_est = _msg2021.hoursec();      // estimated time of measurement
  • trunk/BNC/src/RTCM3/RTCM3Decoder.cpp

    r10688 r10692  
    19581958  char *antserialnum;
    19591959  char *receiver;
    1960   char *recfirmware;
     1960  char *rec_firmware;
    19611961  char *recserialnum;
    19621962  int type;
     
    19751975  GETSTRING(antnum, antenna)
    19761976  if ((antnum > -1 && antnum < 265) &&
    1977       (_antType.empty() || strncmp(_antType.back().descriptor, antenna, recnum) != 0)) {
     1977      (_antType.empty() || strncmp(_antType.back()._descriptor, antenna, recnum) != 0)) {
    19781978    _antType.push_back(t_antInfo());
    1979     memcpy(_antType.back().descriptor, antenna, antnum);
    1980     _antType.back().descriptor[antnum] = 0;
     1979    memcpy(_antType.back()._descriptor, antenna, antnum);
     1980    _antType.back()._descriptor[antnum] = 0;
    19811981  }
    19821982  SKIPBITS(8) /* antenna setup ID */
     
    19841984    GETSTRING(antsernum, antserialnum)
    19851985    if ((antsernum > -1 && antsernum < 265)) {
    1986       memcpy(_antType.back().serialnumber, antserialnum, antsernum);
    1987       _antType.back().serialnumber[antsernum] = 0;
     1986      memcpy(_antType.back()._serialnumber, antserialnum, antsernum);
     1987      _antType.back()._serialnumber[antsernum] = 0;
    19881988    }
    19891989  }
     
    19911991  if (type == 1033) {
    19921992    GETSTRING(recnum, receiver)
    1993     GETSTRING(recfirnum, recfirmware)
     1993    GETSTRING(recfirnum, rec_firmware)
    19941994    GETSTRING(recsernum, recserialnum)
    19951995    if ((recnum > -1 && recnum < 265) &&
    1996         (_recType.empty() || strncmp(_recType.back().descriptor, receiver, recnum) != 0)) {
     1996        (_recType.empty() || strncmp(_recType.back()._descriptor, receiver, recnum) != 0)) {
    19971997      _recType.push_back(t_recInfo());
    1998       memcpy(_recType.back().descriptor, receiver, recnum);
    1999       _recType.back().descriptor[recnum] = 0;
     1998      memcpy(_recType.back()._descriptor, receiver, recnum);
     1999      _recType.back()._descriptor[recnum] = 0;
    20002000      if (recfirnum > -1 && recfirnum < 265) {
    2001         memcpy(_recType.back().firmware, recfirmware, recfirnum);
    2002         _recType.back().firmware[recfirnum] = 0;
     2001        memcpy(_recType.back()._firmware, rec_firmware, recfirnum);
     2002        _recType.back()._firmware[recfirnum] = 0;
    20032003      }
    20042004      if (recsernum > -1 && recsernum < 265) {
    2005         memcpy(_recType.back().serialnumber, recserialnum, recsernum);
    2006         _recType.back().serialnumber[recsernum] = 0;
     2005        memcpy(_recType.back()._serialnumber, recserialnum, recsernum);
     2006        _recType.back()._serialnumber[recsernum] = 0;
    20072007      }
    20082008    }
     
    20232023  GETBITS(type, 12)
    20242024  _antList.push_back(t_antRefPoint());
    2025   _antList.back().type = t_antRefPoint::ARP;
     2025  _antList.back()._type = t_antRefPoint::ARP;
    20262026  SKIPBITS(22)
    20272027  GETBITSSIGN(x, 38)
    2028   _antList.back().xx = x * 1e-4;
     2028  _antList.back()._xx = x * 1e-4;
    20292029  SKIPBITS(2)
    20302030  GETBITSSIGN(y, 38)
    2031   _antList.back().yy = y * 1e-4;
     2031  _antList.back()._yy = y * 1e-4;
    20322032  SKIPBITS(2)
    20332033  GETBITSSIGN(z, 38)
    2034   _antList.back().zz = z * 1e-4;
     2034  _antList.back()._zz = z * 1e-4;
    20352035  if (type == 1006) {
    20362036    double h;
    20372037    GETBITS(h, 16)
    2038     _antList.back().height = h * 1e-4;
    2039     _antList.back().height_f = true;
    2040   }
    2041   _antList.back().message = type;
     2038    _antList.back()._height = h * 1e-4;
     2039    _antList.back()._height_f = true;
     2040  }
     2041  _antList.back()._message = type;
    20422042
    20432043  return true;
     
    20472047////////////////////////////////////////////////////////////////////////////
    20482048bool RTCM3Decoder::DecodeGLONASSCodePhaseBiases(unsigned char* data, int size) {
    2049   t_GloBiasInfo gloBiases;
     2049  t_GloBiasInfo gloBiasInfo;
     2050  int i = 0;
    20502051  uint64_t numbits = 0, bitfield = 0;
    20512052
     
    20542055
    20552056  SKIPBITS(12) // Message Number
    2056   GETBITS(gloBiases.staID, 12)
    2057   GETBITS(gloBiases.indicator, 1) // 0.. not aligned, 1.. aligned
     2057  GETBITS(gloBiasInfo._staID, 12)
     2058  GETBITS(gloBiasInfo._indicator, 1) // 0.. not aligned, 1.. aligned
    20582059  SKIPBITS(3) // reserved bits
    2059   unsigned bitmask;
     2060  unsigned int bitmask;
    20602061  GETBITS(bitmask, 4)
    20612062  bool L1C_valid = bitExtracted(unsigned(bitmask), 1, 0);
     
    20652066
    20662067  if (L1C_valid) {
    2067     GETBITS(gloBiases.L1C_value, 16)
     2068    GETBITSSIGN(i, 16)
     2069    gloBiasInfo._L1C_value = i * 0.02;
    20682070  }
    20692071  if (L1P_valid) {
    2070     GETBITS(gloBiases.L1P_value, 16)
     2072    GETBITSSIGN(i, 16)
     2073    gloBiasInfo._L1P_value = i * 0.02;
    20712074  }
    20722075  if (L2C_valid) {
    2073     GETBITS(gloBiases.L2C_value, 16)
     2076    GETBITSSIGN(i, 16)
     2077    gloBiasInfo._L2C_value = i * 0.02;
    20742078  }
    20752079  if (L2P_valid) {
    2076     GETBITS(gloBiases.L2P_value, 16)
    2077   }
    2078 
    2079   if (!(_gloBiases == gloBiases)) {
    2080     _gloBiases.set(gloBiases);
     2080    GETBITSSIGN(i, 16)
     2081    gloBiasInfo._L2P_value = i * 0.02;
     2082  }
     2083
     2084  if (_gloBiasInfo != gloBiasInfo) {
     2085    _gloBiasInfo.set(gloBiasInfo);
    20812086  }
    20822087
     
    22512256      /* store the id and message size into the list of loaded blocks */
    22522257      _typeList.push_back(t_typeInfo());
    2253       _typeList.back().type = id;
    2254       _typeList.back().size = _BlockSize -6; /* header + crc */
     2258      _typeList.back()._type = id;
     2259      _typeList.back()._size = _BlockSize -6; /* header + crc */
    22552260
    22562261      /* SSR I+II data handled in another function, already pass the
     
    22742279        }
    22752280      }
    2276       else if (id >= 1070 && id <= 1237) { /* MSM */
     2281      else if (id >= 1070 && id <= 1137) { /* MSM */
    22772282        if (DecodeRTCM3MSM(_Message, _BlockSize))
    22782283          decoded = true;
  • trunk/BNC/src/bncgetthread.cpp

    r10688 r10692  
    572572        }
    573573        while (it.hasNext()) {
    574           int rtcmType = it.next().type;
     574          int rtcmType = it.next()._type;
    575575          if ((rtcmType >= 1001 && rtcmType <= 1004) || // legacy RTCM OBS
    576576              (rtcmType >= 1009 && rtcmType <= 1012) || // legacy RTCM OBS
     
    818818      // ------------------
    819819      for (int ii = 0; ii < decoder()->_typeList.size(); ii++) {
    820         QString type = QString("%1 ").arg(decoder()->_typeList[ii].type);
    821         QString size = (decoder()->_typeList[ii].size) ? QString("(size %1)").arg(decoder()->_typeList[ii].size) : "";
     820        QString type = QString("%1 ").arg(decoder()->_typeList[ii]._type);
     821        QString size = (decoder()->_typeList[ii]._size) ? QString("(size %1)").arg(decoder()->_typeList[ii]._size) : "";
    822822        emit(newMessage(_staID + ": Received message type " + type.toLatin1() +  size.toLatin1(), true));
    823823      }
     
    897897      // -------------------------
    898898      for (int ii = 0; ii < decoder()->_antType.size(); ii++) {
    899         QString ant1 = QString(": Antenna Descriptor: %1 ").arg(decoder()->_antType[ii].descriptor);
     899        QString ant1 = QString(": Antenna Descriptor: %1 ").arg(decoder()->_antType[ii]._descriptor);
    900900        emit(newMessage(_staID + ant1.toLatin1(), true));
    901         if (strlen(decoder()->_antType[ii].serialnumber)) {
    902           QString ant2 = QString(": Antenna Serial Number: %1 ").arg(decoder()->_antType[ii].serialnumber);
     901        if (strlen(decoder()->_antType[ii]._serialnumber)) {
     902          QString ant2 = QString(": Antenna Serial Number: %1 ").arg(decoder()->_antType[ii]._serialnumber);
    903903          emit(newMessage(_staID + ant2.toLatin1(), true));
    904904        }
     
    909909      for (int ii = 0; ii < decoder()->_antList.size(); ii++) {
    910910        QByteArray antT;
    911         if (decoder()->_antList[ii].type == GPSDecoder::t_antRefPoint::ARP) {
     911        if (decoder()->_antList[ii]._type == GPSDecoder::t_antRefPoint::ARP) {
    912912          antT = "ARP";
    913         } else if (decoder()->_antList[ii].type == GPSDecoder::t_antRefPoint::APC) {
     913        } else if (decoder()->_antList[ii]._type == GPSDecoder::t_antRefPoint::APC) {
    914914          antT = "APC";
    915915        }
    916916        QByteArray ant1, ant2, ant3;
    917         ant1 = QString("%1 ").arg(decoder()->_antList[ii].xx, 0, 'f', 4).toLatin1();
    918         ant2 = QString("%1 ").arg(decoder()->_antList[ii].yy, 0, 'f', 4).toLatin1();
    919         ant3 = QString("%1 ").arg(decoder()->_antList[ii].zz, 0, 'f', 4).toLatin1();
     917        ant1 = QString("%1 ").arg(decoder()->_antList[ii]._xx, 0, 'f', 4).toLatin1();
     918        ant2 = QString("%1 ").arg(decoder()->_antList[ii]._yy, 0, 'f', 4).toLatin1();
     919        ant3 = QString("%1 ").arg(decoder()->_antList[ii]._zz, 0, 'f', 4).toLatin1();
    920920        emit(newMessage(_staID + ": " + antT + " (ITRF) X " + ant1 + "m", true));
    921921        emit(newMessage(_staID + ": " + antT + " (ITRF) Y " + ant2 + "m", true));
    922922        emit(newMessage(_staID + ": " + antT + " (ITRF) Z " + ant3 + "m", true));
    923923        double hh = 0.0;
    924         if (decoder()->_antList[ii].height_f) {
    925           hh = decoder()->_antList[ii].height;
     924        if (decoder()->_antList[ii]._height_f) {
     925          hh = decoder()->_antList[ii]._height;
    926926          QByteArray ant4 = QString("%1 ").arg(hh, 0, 'f', 4).toLatin1();
    927927          emit(newMessage(
    928928              _staID + ": Antenna height above marker " + ant4 + "m", true));
    929929        }
    930         emit(newAntCrd(_staID, decoder()->_antList[ii].xx,
    931             decoder()->_antList[ii].yy, decoder()->_antList[ii].zz, hh, antT));
     930        emit(newAntCrd(_staID, decoder()->_antList[ii]._xx,
     931            decoder()->_antList[ii]._yy, decoder()->_antList[ii]._zz, hh, antT));
    932932      }
    933933
     
    935935      // --------------------------
    936936      for (int ii = 0; ii < decoder()->_recType.size(); ii++) {
    937         QString rec1 = QString(": Receiver Descriptor: %1 ").arg(decoder()->_recType[ii].descriptor);
    938         QString rec2 = QString(": Receiver Firmware Version: %1 ").arg(decoder()->_recType[ii].firmware);
    939         QString rec3 = QString(": Receiver Serial Number: %1 ").arg(decoder()->_recType[ii].serialnumber);
     937        QString rec1 = QString(": Receiver Descriptor: %1 ").arg(decoder()->_recType[ii]._descriptor);
     938        QString rec2 = QString(": Receiver Firmware Version: %1 ").arg(decoder()->_recType[ii]._firmware);
     939        QString rec3 = QString(": Receiver Serial Number: %1 ").arg(decoder()->_recType[ii]._serialnumber);
    940940        emit(newMessage(_staID + rec1.toLatin1(), true));
    941941        emit(newMessage(_staID + rec2.toLatin1(), true));
     
    963963      // RTCM GLONASS Code-Phase biases (MT 1230)
    964964      // ----------------------------------------
    965       if (decoder()->_gloBiases.changed) {
    966         QString gloCodePhaseBiases = decoder()->_gloBiases.toString();
     965      if (decoder()->_gloBiasInfo.changed()) {
     966        QString gloCodePhaseBiases = decoder()->_gloBiasInfo.toString();
    967967        emit(newMessage(_staID + gloCodePhaseBiases.toLatin1(), true));
     968        decoder()->_gloBiasInfo.setChanged(false);
    968969      }
    969970
Note: See TracChangeset for help on using the changeset viewer.