Changeset 904 in ntrip


Ignore:
Timestamp:
May 9, 2008, 9:29:21 AM (16 years ago)
Author:
mervart
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNS/bns.cpp

    r884 r904  
    313313  if (numSat > 0) {
    314314
    315     for (int oldEph = 0; oldEph <= 1; oldEph++) {
    316    
    317       struct ClockOrbit co;
    318       memset(&co, 0, sizeof(co));
    319       co.GPSEpochTime = (int)GPSweeks;
    320       co.ClockDataSupplied = 1;
    321       co.OrbitDataSupplied = 1;
    322       co.SatRefPoint       = POINT_CENTER;
    323       co.SatRefDatum       = DATUM_ITRF;
    324    
    325       for (int ii = 1; ii <= numSat; ii++) {
    326 
    327         QString      prn;
    328         ColumnVector xx(4);
    329         t_eph*       ep = 0;
    330 
    331         if (oldEph == 0) {
    332           line = _clkSocket->readLine();
    333           QTextStream in(line);
    334           in >> prn;
    335           if ( _ephList.contains(prn) ) {
    336             in >> xx(1) >> xx(2) >> xx(3) >> xx(4); xx(4) *= 1e-6;
    337             t_ephPair* pair = _ephList[prn];
    338             pair->xx = xx;
    339             ep = pair->eph;
     315    for (int gpsFlg = 0; gpsFlg <= 1; gpsFlg++) {
     316      for (int oldEph = 0; oldEph <= 1; oldEph++) {
     317     
     318        struct ClockOrbit co;
     319        memset(&co, 0, sizeof(co));
     320        co.GPSEpochTime = (int)GPSweeks;
     321        co.ClockDataSupplied = 1;
     322        co.OrbitDataSupplied = 1;
     323        co.SatRefPoint       = POINT_CENTER;
     324        co.SatRefDatum       = DATUM_ITRF;
     325     
     326        for (int ii = 1; ii <= numSat; ii++) {
     327     
     328          QString      prn;
     329          ColumnVector xx(4);
     330          t_eph*       ep = 0;
     331     
     332          if (oldEph == 0) {
     333            line = _clkSocket->readLine();
     334            QTextStream in(line);
     335            in >> prn;
     336            if ( _ephList.contains(prn) ) {
     337              in >> xx(1) >> xx(2) >> xx(3) >> xx(4); xx(4) *= 1e-6;
     338              t_ephPair* pair = _ephList[prn];
     339              pair->xx = xx;
     340              ep = pair->eph;
     341            }
     342          }
     343          else {
     344            if ( _ephList.contains(prn) ) {
     345              t_ephPair* pair = _ephList[prn];
     346              prn = pair->eph->prn();
     347              xx  = pair->xx;
     348              ep  = pair->oldEph;
     349            }
     350          }
     351     
     352          if (ep != 0) {
     353            struct ClockOrbit::SatData* sd = 0;
     354            if      (gpsFlg  && prn[0] == 'G') {
     355              sd = co.Sat + co.NumberOfGPSSat;
     356              ++co.NumberOfGPSSat;
     357            }
     358            else if (!gpsFlg && prn[0] == 'R') {
     359              sd = co.Sat + CLOCKORBIT_NUMGPS + co.NumberOfGLONASSSat;
     360              ++co.NumberOfGLONASSSat;
     361            }
     362            if (sd) {
     363              processSatellite(ep, GPSweek, GPSweeks, prn, xx, sd);
     364            }
    340365          }
    341366        }
    342         else {
    343           if ( _ephList.contains(prn) ) {
    344             t_ephPair* pair = _ephList[prn];
    345             prn = pair->eph->prn();
    346             xx  = pair->xx;
    347             ep  = pair->oldEph;
     367     
     368        if ( _outSocket &&
     369             (co.NumberOfGPSSat > 0 || co.NumberOfGLONASSSat > 0) ) {
     370          char obuffer[CLOCKORBIT_BUFFERSIZE];
     371          int len = MakeClockOrbit(&co, COTYPE_AUTO, 0, obuffer, sizeof(obuffer));
     372          if (len > 0) {
     373            _outSocket->write(obuffer, len);
     374            _outSocket->flush();
    348375          }
    349         }
    350 
    351         if (ep != 0) {
    352           struct ClockOrbit::SatData* sd = 0;
    353           if      (prn[0] == 'G') {
    354             sd = co.Sat + co.NumberOfGPSSat;
    355             ++co.NumberOfGPSSat;
    356           }
    357           else if (prn[0] == 'R') {
    358             sd = co.Sat + CLOCKORBIT_NUMGPS + co.NumberOfGLONASSSat;
    359             ++co.NumberOfGLONASSSat;
    360           }
    361           processSatellite(ep, GPSweek, GPSweeks, prn, xx, sd);
    362         }
    363       }
    364    
    365       if ( _outSocket &&
    366            (co.NumberOfGPSSat > 0 || co.NumberOfGLONASSSat > 0) ) {
    367         char obuffer[CLOCKORBIT_BUFFERSIZE];
    368         int len = MakeClockOrbit(&co, COTYPE_AUTO, 0, obuffer, sizeof(obuffer));
    369         if (len > 0) {
    370           _outSocket->write(obuffer, len);
    371           _outSocket->flush();
    372376        }
    373377      }
Note: See TracChangeset for help on using the changeset viewer.