Changeset 3022 in ntrip for trunk/BNC/RTCM3/RTCM3coDecoder.cpp


Ignore:
Timestamp:
Feb 24, 2011, 10:43:21 AM (13 years ago)
Author:
mervart
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/RTCM3/RTCM3coDecoder.cpp

    r2585 r3022  
    207207        }
    208208
     209        QStringList asciiLines = corrsToASCIIlines(GPSweek, _GPSweeks,
     210                                                   _co, _bias);
     211
    209212        long coTime = GPSweek * 7*24*3600 + long(floor(_GPSweeks+0.5));
    210213
    211         // Loop over all satellites (GPS and Glonass)
    212         // ------------------------------------------
    213         if (_co.NumberOfGPSSat > 0 || _co.NumberOfGLONASSSat > 0) {
    214           QString line1;
    215           line1.sprintf("! Orbits/Clocks: %d GPS %d Glonass",
    216                         _co.NumberOfGPSSat, _co.NumberOfGLONASSSat);
    217           printLine(line1, coTime);
    218         }
    219         for (int ii = 0; ii < CLOCKORBIT_NUMGPS+_co.NumberOfGLONASSSat; ii++) {
    220           char sysCh = ' ';
    221           if      (ii < _co.NumberOfGPSSat) {
    222             sysCh = 'G';
    223           }
    224           else if (ii >= CLOCKORBIT_NUMGPS) {
    225             sysCh = 'R';
    226           }
    227           if (sysCh != ' ') {
    228 
    229             QString linePart;
    230             linePart.sprintf("%d %d %d %.1f %c%2.2d",
    231                              _co.messageType, _co.UpdateInterval, GPSweek, _GPSweeks,
    232                              sysCh, _co.Sat[ii].ID);
    233 
    234             // Combined message (orbit and clock)
    235             // ----------------------------------
    236             if ( _co.messageType == COTYPE_GPSCOMBINED     ||
    237                  _co.messageType == COTYPE_GLONASSCOMBINED ) {
    238               QString line;
    239               line.sprintf("   %3d"
    240                            "   %8.3f %8.3f %8.3f %8.3f"
    241                            "   %10.5f %10.5f %10.5f %10.5f"
    242                            "   %10.5f",
    243                            _co.Sat[ii].IOD,
    244                            _co.Sat[ii].Clock.DeltaA0,
    245                            _co.Sat[ii].Orbit.DeltaRadial,
    246                            _co.Sat[ii].Orbit.DeltaAlongTrack,
    247                            _co.Sat[ii].Orbit.DeltaCrossTrack,
    248                            _co.Sat[ii].Clock.DeltaA1,
    249                            _co.Sat[ii].Orbit.DotDeltaRadial,
    250                            _co.Sat[ii].Orbit.DotDeltaAlongTrack,
    251                            _co.Sat[ii].Orbit.DotDeltaCrossTrack,
    252                            _co.Sat[ii].Clock.DeltaA2);
    253               printLine(linePart+line, coTime);
    254             }
    255 
    256             // Orbits only
    257             // -----------
    258             else if ( _co.messageType == COTYPE_GPSORBIT     ||
    259                       _co.messageType == COTYPE_GLONASSORBIT ) {
    260               QString line;
    261               line.sprintf("   %3d"
    262                            "   %8.3f %8.3f %8.3f"
    263                            "   %10.5f %10.5f %10.5f",
    264                            _co.Sat[ii].IOD,
    265                            _co.Sat[ii].Orbit.DeltaRadial,
    266                            _co.Sat[ii].Orbit.DeltaAlongTrack,
    267                            _co.Sat[ii].Orbit.DeltaCrossTrack,
    268                            _co.Sat[ii].Orbit.DotDeltaRadial,
    269                            _co.Sat[ii].Orbit.DotDeltaAlongTrack,
    270                            _co.Sat[ii].Orbit.DotDeltaCrossTrack);
    271               printLine(linePart+line, coTime);
    272             }
    273 
    274             // Clocks only
    275             // -----------
    276             else if ( _co.messageType == COTYPE_GPSCLOCK     ||
    277                       _co.messageType == COTYPE_GLONASSCLOCK ) {
    278               QString line;
    279               line.sprintf("   %3d   %8.3f   %10.5f   %10.5f",
    280                            _co.Sat[ii].IOD,
    281                            _co.Sat[ii].Clock.DeltaA0,
    282                            _co.Sat[ii].Clock.DeltaA1,
    283                            _co.Sat[ii].Clock.DeltaA2);
    284               printLine(linePart+line, coTime);
    285             }
    286 
    287             // User Range Accuracy
    288             // -------------------
    289             else if ( _co.messageType == COTYPE_GPSURA     ||
    290                       _co.messageType == COTYPE_GLONASSURA ) {
    291               QString line;
    292               line.sprintf("   %3d   %f",
    293                            _co.Sat[ii].IOD, _co.Sat[ii].UserRangeAccuracy);
    294               printLine(linePart+line, coTime);
    295             }
    296 
    297             // High-Resolution Clocks
    298             // ----------------------
    299             else if ( _co.messageType == COTYPE_GPSHR     ||
    300                       _co.messageType == COTYPE_GLONASSHR ) {
    301               QString line;
    302               line.sprintf("   %3d   %8.3f",
    303                            _co.Sat[ii].IOD, _co.Sat[ii].hrclock);
    304               printLine(linePart+line, coTime);
    305             }
    306           }
    307         }
    308 
    309         // Loop over all satellites (GPS and Glonass)
    310         // ------------------------------------------
    311         if (_bias.NumberOfGPSSat > 0 || _bias.NumberOfGLONASSSat > 0) {
    312           QString line1;
    313           line1.sprintf("! Biases: %d GPS %d Glonass",
    314                         _bias.NumberOfGPSSat, _bias.NumberOfGLONASSSat);
    315           printLine(line1, coTime);
    316         }
    317         for (int ii = 0; ii < CLOCKORBIT_NUMGPS + _bias.NumberOfGLONASSSat; ii++) {
    318           char sysCh = ' ';
    319           int messageType;
    320           if      (ii < _bias.NumberOfGPSSat) {
    321             sysCh = 'G';
    322             messageType = BTYPE_GPS;
    323           }
    324           else if (ii >= CLOCKORBIT_NUMGPS) {
    325             sysCh = 'R';
    326             messageType = BTYPE_GLONASS;
    327           }
    328           if (sysCh != ' ') {
    329             QString line;
    330             line.sprintf("%d %d %d %.1f %c%2.2d %d",
    331                          messageType, _bias.UpdateInterval, GPSweek, _GPSweeks,
    332                          sysCh, _bias.Sat[ii].ID,
    333                          _bias.Sat[ii].NumberOfCodeBiases);
    334             for (int jj = 0; jj < _bias.Sat[ii].NumberOfCodeBiases; jj++) {
    335               QString hlp;
    336               hlp.sprintf(" %d %8.3f",  _bias.Sat[ii].Biases[jj].Type,
    337                           _bias.Sat[ii].Biases[jj].Bias);
    338               line += hlp;
    339             }
    340             printLine(line, coTime);
    341           }
     214        QStringListIterator it(asciiLines);
     215        while (it.hasNext()) {
     216          QString line = it.next();
     217          printLine(line, coTime);
    342218        }
    343219
     
    365241  emit newCorrLine(line, _staID, coTime);
    366242}
     243
     244//
     245////////////////////////////////////////////////////////////////////////////
     246QStringList RTCM3coDecoder::corrsToASCIIlines(int GPSweek, double GPSweeks,
     247                                              const ClockOrbit& co,
     248                                              const Bias& bias) {
     249
     250  QStringList retLines;
     251
     252  // Loop over all satellites (GPS and Glonass)
     253  // ------------------------------------------
     254  if (co.NumberOfGPSSat > 0 || co.NumberOfGLONASSSat > 0) {
     255    QString line1;
     256    line1.sprintf("! Orbits/Clocks: %d GPS %d Glonass",
     257                  co.NumberOfGPSSat, co.NumberOfGLONASSSat);
     258    retLines << line1;
     259  }
     260  for (int ii = 0; ii < CLOCKORBIT_NUMGPS+co.NumberOfGLONASSSat; ii++) {
     261    char sysCh = ' ';
     262    if      (ii < co.NumberOfGPSSat) {
     263      sysCh = 'G';
     264    }
     265    else if (ii >= CLOCKORBIT_NUMGPS) {
     266      sysCh = 'R';
     267    }
     268    if (sysCh != ' ') {
     269
     270      QString linePart;
     271      linePart.sprintf("%d %d %d %.1f %c%2.2d",
     272                       co.messageType, co.UpdateInterval, GPSweek, GPSweeks,
     273                       sysCh, co.Sat[ii].ID);
     274
     275      // Combined message (orbit and clock)
     276      // ----------------------------------
     277      if ( co.messageType == COTYPE_GPSCOMBINED     ||
     278           co.messageType == COTYPE_GLONASSCOMBINED ) {
     279        QString line;
     280        line.sprintf("   %3d"
     281                     "   %8.3f %8.3f %8.3f %8.3f"
     282                     "   %10.5f %10.5f %10.5f %10.5f"
     283                     "   %10.5f",
     284                     co.Sat[ii].IOD,
     285                     co.Sat[ii].Clock.DeltaA0,
     286                     co.Sat[ii].Orbit.DeltaRadial,
     287                     co.Sat[ii].Orbit.DeltaAlongTrack,
     288                     co.Sat[ii].Orbit.DeltaCrossTrack,
     289                     co.Sat[ii].Clock.DeltaA1,
     290                     co.Sat[ii].Orbit.DotDeltaRadial,
     291                     co.Sat[ii].Orbit.DotDeltaAlongTrack,
     292                     co.Sat[ii].Orbit.DotDeltaCrossTrack,
     293                     co.Sat[ii].Clock.DeltaA2);
     294        retLines << linePart+line;
     295      }
     296
     297      // Orbits only
     298      // -----------
     299      else if ( co.messageType == COTYPE_GPSORBIT     ||
     300                co.messageType == COTYPE_GLONASSORBIT ) {
     301        QString line;
     302        line.sprintf("   %3d"
     303                     "   %8.3f %8.3f %8.3f"
     304                     "   %10.5f %10.5f %10.5f",
     305                     co.Sat[ii].IOD,
     306                     co.Sat[ii].Orbit.DeltaRadial,
     307                     co.Sat[ii].Orbit.DeltaAlongTrack,
     308                     co.Sat[ii].Orbit.DeltaCrossTrack,
     309                     co.Sat[ii].Orbit.DotDeltaRadial,
     310                     co.Sat[ii].Orbit.DotDeltaAlongTrack,
     311                     co.Sat[ii].Orbit.DotDeltaCrossTrack);
     312        retLines << linePart+line;
     313      }
     314
     315      // Clocks only
     316      // -----------
     317      else if ( co.messageType == COTYPE_GPSCLOCK     ||
     318                co.messageType == COTYPE_GLONASSCLOCK ) {
     319        QString line;
     320        line.sprintf("   %3d   %8.3f   %10.5f   %10.5f",
     321                     co.Sat[ii].IOD,
     322                     co.Sat[ii].Clock.DeltaA0,
     323                     co.Sat[ii].Clock.DeltaA1,
     324                     co.Sat[ii].Clock.DeltaA2);
     325        retLines << linePart+line;
     326      }
     327
     328      // User Range Accuracy
     329      // -------------------
     330      else if ( co.messageType == COTYPE_GPSURA     ||
     331                co.messageType == COTYPE_GLONASSURA ) {
     332        QString line;
     333        line.sprintf("   %3d   %f",
     334                     co.Sat[ii].IOD, co.Sat[ii].UserRangeAccuracy);
     335        retLines << linePart+line;
     336      }
     337
     338      // High-Resolution Clocks
     339      // ----------------------
     340      else if ( co.messageType == COTYPE_GPSHR     ||
     341                co.messageType == COTYPE_GLONASSHR ) {
     342        QString line;
     343        line.sprintf("   %3d   %8.3f",
     344                     co.Sat[ii].IOD, co.Sat[ii].hrclock);
     345        retLines << linePart+line;
     346      }
     347    }
     348  }
     349
     350  // Loop over all satellites (GPS and Glonass)
     351  // ------------------------------------------
     352  if (bias.NumberOfGPSSat > 0 || bias.NumberOfGLONASSSat > 0) {
     353    QString line1;
     354    line1.sprintf("! Biases: %d GPS %d Glonass",
     355                  bias.NumberOfGPSSat, bias.NumberOfGLONASSSat);
     356    retLines << line1;
     357  }
     358  for (int ii = 0; ii < CLOCKORBIT_NUMGPS + bias.NumberOfGLONASSSat; ii++) {
     359    char sysCh = ' ';
     360    int messageType;
     361    if      (ii < bias.NumberOfGPSSat) {
     362      sysCh = 'G';
     363      messageType = BTYPE_GPS;
     364    }
     365    else if (ii >= CLOCKORBIT_NUMGPS) {
     366      sysCh = 'R';
     367      messageType = BTYPE_GLONASS;
     368    }
     369    if (sysCh != ' ') {
     370      QString line;
     371      line.sprintf("%d %d %d %.1f %c%2.2d %d",
     372                   messageType, bias.UpdateInterval, GPSweek, GPSweeks,
     373                   sysCh, bias.Sat[ii].ID,
     374                   bias.Sat[ii].NumberOfCodeBiases);
     375      for (int jj = 0; jj < bias.Sat[ii].NumberOfCodeBiases; jj++) {
     376        QString hlp;
     377        hlp.sprintf(" %d %8.3f",  bias.Sat[ii].Biases[jj].Type,
     378                    bias.Sat[ii].Biases[jj].Bias);
     379        line += hlp;
     380      }
     381      retLines << line;
     382    }
     383  }
     384
     385  return retLines;
     386}
Note: See TracChangeset for help on using the changeset viewer.