Changeset 6137 in ntrip for trunk/BNC/src/GPSDecoder.cpp


Ignore:
Timestamp:
Sep 13, 2014, 12:19:37 PM (10 years ago)
Author:
mervart
Message:
 
File:
1 edited

Legend:

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

    r5884 r6137  
    4646#include "bncrinex.h"
    4747
    48 extern "C" {
    49 #include "rtcm3torinex.h"
    50 }
    51 
    5248using namespace std;
    5349
     
    8278// Write RINEX Epoch
    8379//////////////////////////////////////////////////////////////////////////////
    84 void GPSDecoder::dumpRinexEpoch(const t_obs& obs, const QByteArray& format) {
     80void GPSDecoder::dumpRinexEpoch(const t_satObs& obs, const QByteArray& format) {
    8581  if (_rnx) {
    86     long iSec    = long(floor(obs.GPSWeeks+0.5));
    87     long obsTime = obs.GPSWeek * 7*24*3600 + iSec;
     82    long iSec    = long(floor(obs._time.gpssec()+0.5));
     83    long obsTime = obs._time.gpsw() * 7*24*3600 + iSec;
    8884    if (_rnx->samplingRate() == 0 || iSec % _rnx->samplingRate() == 0) {
    8985      _rnx->deepCopy(obs);
     
    10197}
    10298
    103 //
    104 //////////////////////////////////////////////////////////////////////////////
    105 void t_obs::setMeasdata(QString rnxStr, float rnxVers, double value) {
    106   int ie = iEntry(rnxStr, rnxVers);
    107 
    108   if (ie != -1) {
    109     _codetype[ie] = rnxStr.mid(1);
    110     _measdata[ie] = value;
    111   }
    112 }
    113 
    114 //
    115 //////////////////////////////////////////////////////////////////////////////
    116 double t_obs::measdata(QString rnxStr, float rnxVers) const {
    117   int ie = iEntry(rnxStr, rnxVers);
    118 
    119   if (ie != -1) {
    120     return _measdata[ie];
    121   }
    122 
    123   return 0.0;
    124 }
    125 
    126 //
    127 //////////////////////////////////////////////////////////////////////////////
    128 QString t_obs::rnxStr(int iEntry) const {
    129   QString str(1,' ');
    130   switch(iEntry & 3) {
    131     case GNSSENTRY_CODE:    str[0] = 'C'; break;
    132     case GNSSENTRY_PHASE:   str[0] = 'L'; break;
    133     case GNSSENTRY_DOPPLER: str[0] = 'D'; break;
    134     case GNSSENTRY_SNR:     str[0] = 'S'; break;
    135   }
    136   str += _codetype[iEntry];
    137   return str.trimmed();
    138 }
    139 
    140 //
    141 //////////////////////////////////////////////////////////////////////////////
    142 int t_obs::iEntry(QString rnxStr, float rnxVers, bool cmode) const {
    143 
    144   int res = 0;
    145   bool tryagain = false;
    146   QString rnxStrOrig = rnxStr;
    147  
    148   if (rnxVers < 3.0) {
    149     if      (rnxStr == "C1") rnxStr = "C1C";
    150     else if (rnxStr == "P1") rnxStr = "C1P";
    151     else if (rnxStr == "C2") rnxStr = "C2C";
    152     else if (rnxStr == "P2") rnxStr = "C2P";
    153     if(cmode)
    154     {
    155       if      (rnxStr == "S1") rnxStr = "S1C";
    156       else if (rnxStr == "L1") rnxStr = "L1C";
    157       else if (rnxStr == "S2") rnxStr = "S2C";
    158       else if (rnxStr == "L2") rnxStr = "L2C";
    159     }
    160     else
    161     {
    162       if      (rnxStr == "S1") {rnxStr = "S1P"; tryagain = true; }
    163       else if (rnxStr == "L1") {rnxStr = "L1P"; tryagain = true; }
    164       else if (rnxStr == "S2") {rnxStr = "S2P"; tryagain = true; }
    165       else if (rnxStr == "L2") {rnxStr = "L2P"; tryagain = true; }
    166     }
    167   }
    168 
    169   // Observation Type (Code, Phase, Doppler, SNR)
    170   // --------------------------------------------
    171   if      (rnxStr[0] == 'C') {
    172     res += GNSSENTRY_CODE;
    173   }
    174   else if (rnxStr[0] == 'L') {
    175     res += GNSSENTRY_PHASE;
    176   }
    177   else if (rnxStr[0] == 'D') {
    178     res += GNSSENTRY_DOPPLER;
    179   }
    180   else if (rnxStr[0] == 'S') {
    181     res += GNSSENTRY_SNR;
    182   }
    183   else {
    184     return -1;
    185   }
    186 
    187   // Frequency
    188   // ---------
    189   if      (rnxStr[1] == '1') {
    190     if      (rnxStr.length() < 3) {
    191       res += GNSSENTRY_TYPEC1;
    192     }
    193     else if (QString("ABCIQ").indexOf(rnxStr[2]) != -1) {
    194       res += GNSSENTRY_TYPEC1;
    195     }
    196     else if (QString("SL").indexOf(rnxStr[2]) != -1) {
    197       res += GNSSENTRY_TYPEC1N;
    198     }
    199     else if (QString("PWY").indexOf(rnxStr[2])    != -1) {
    200       res += GNSSENTRY_TYPEP1;
    201     }
    202     else if (rnxStr[2] == 'Z') {
    203       res += GNSSENTRY_TYPECSAIF;
    204     }
    205     else if (rnxStr[2] == 'X') {
    206       if (satSys == 'C' || satSys == 'E') {
    207         res += GNSSENTRY_TYPEC1;
    208       }
    209       else {
    210         res += GNSSENTRY_TYPEC1N;
    211       }
    212     }
    213     else {
    214       return -1;
    215     }
    216   }
    217   else if (rnxStr[1] == '2') {
    218     if      (rnxStr.length() < 3) {
    219       res += GNSSENTRY_TYPEC2;
    220     }
    221     else if (QString("PWY").indexOf(rnxStr[2])  != -1) {
    222       res += GNSSENTRY_TYPEP2;
    223     }
    224     else if (QString("CSLX").indexOf(rnxStr[2]) != -1) {
    225       res += GNSSENTRY_TYPEC2;
    226     }
    227     else if (rnxStr[2] == 'I') {
    228       if (satSys == 'C') {
    229         res += GNSSENTRY_TYPEC1;  // Compass: RINEX 3.01 "2I" corresponds to "1I" RINEX 3.02
    230       }
    231       else {
    232         res += GNSSENTRY_TYPEC2;
    233       }
    234     }
    235     else if (rnxStr[2] == 'Q') {
    236       res += GNSSENTRY_TYPEC2;
    237     }
    238     else {
    239       return -1;
    240     }
    241   }
    242   else if (rnxStr[1] == '5') {
    243     res += GNSSENTRY_TYPEC5;
    244   }
    245   else if (rnxStr[1] == '6') {
    246     res += GNSSENTRY_TYPEC6;
    247   }
    248   else if (rnxStr[1] == '7') {
    249     res += GNSSENTRY_TYPEC5B;
    250   }
    251   else if (rnxStr[1] == '8') {
    252     res += GNSSENTRY_TYPEC5AB;
    253   }
    254   else {
    255     return -1;
    256   }
    257 
    258   /* Note: We prefer P over C for Lx or Sx (i.e. we first try for P values) */
    259   if(_codetype[res].isEmpty() && tryagain)
    260     res = iEntry(rnxStrOrig, rnxVers, true);
    261 
    262   return res;
    263 }
Note: See TracChangeset for help on using the changeset viewer.