Changeset 872 in ntrip


Ignore:
Timestamp:
May 6, 2008, 10:00:16 AM (16 years ago)
Author:
mervart
Message:

* empty log message *

Location:
trunk/BNS
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNS/bns.cpp

    r863 r872  
    312312  in >> hlp >> GPSweek >> GPSweeks >> numSat;
    313313
    314   if (numSat > 0) {
    315 
    316     struct ClockOrbit co;
    317     memset(&co, 0, sizeof(co));
    318     co.GPSEpochTime = (int)GPSweeks;
    319     co.ClockDataSupplied = 1;
    320     co.OrbitDataSupplied = 1;
    321     co.SatRefPoint       = POINT_CENTER;
    322     co.SatRefDatum       = DATUM_ITRF;
    323 
    324     for (int ii = 1; ii <= numSat; ii++) {
    325       line = _clkSocket->readLine();
     314  for (int oldEph = 0; oldEph <= 1; oldEph++) {
     315    if (numSat > 0) {
    326316   
    327       QTextStream in(line);
     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;
    328324   
    329       QString      prn;
    330       ColumnVector xx(4);
     325      for (int ii = 1; ii <= numSat; ii++) {
     326        line = _clkSocket->readLine();
     327     
     328        QTextStream in(line);
     329     
     330        QString      prn;
     331        ColumnVector xx(4);
     332     
     333        in >> prn >> xx(1) >> xx(2) >> xx(3) >> xx(4);
     334        xx(4) *= 1e-6;
     335
     336        gpsEph* ep   = 0;
     337        if ( _ephList.contains(prn) ) {
     338          t_ephPair* pair = _ephList[prn];
     339          if (oldEph == 1) {
     340            ep = pair->oldEph;
     341          }
     342          else {
     343            ep = pair->eph;
     344          }
     345        }
     346
     347        if (ep != 0) {
     348          struct ClockOrbit::SatData* sd = 0;
     349          if      (prn[0] == 'G') {
     350            sd = co.Sat + co.NumberOfGPSSat;
     351            ++co.NumberOfGPSSat;
     352          }
     353          else if (prn[0] == 'R') {
     354            sd = co.Sat + CLOCKORBIT_NUMGPS + co.NumberOfGLONASSSat;
     355            ++co.NumberOfGLONASSSat;
     356          }
     357          processSatellite(ep, GPSweek, GPSweeks, prn, xx, sd);
     358        }
     359      }
    331360   
    332       in >> prn >> xx(1) >> xx(2) >> xx(3) >> xx(4);
    333       xx(4) *= 1e-6;
    334    
    335       struct ClockOrbit::SatData* sd = 0;
    336       if      (prn[0] == 'G') {
    337         sd = co.Sat + co.NumberOfGPSSat;
    338         ++co.NumberOfGPSSat;
     361      if ( _outSocket &&
     362           (co.NumberOfGPSSat > 0 || co.NumberOfGLONASSSat > 0) ) {
     363        char obuffer[CLOCKORBIT_BUFFERSIZE];
     364        int len = MakeClockOrbit(&co, COTYPE_AUTO, 0, obuffer, sizeof(obuffer));
     365        if (len > 0) {
     366          _outSocket->write(obuffer, len);
     367          _outSocket->flush();
     368        }
    339369      }
    340       else if (prn[0] == 'R') {
    341         sd = co.Sat + CLOCKORBIT_NUMGPS + co.NumberOfGLONASSSat;
    342         ++co.NumberOfGLONASSSat;
    343       }
    344 
    345       processSatellite(GPSweek, GPSweeks, prn, xx, sd);
    346     }
    347 
    348     if (_outSocket) {
    349       char obuffer[CLOCKORBIT_BUFFERSIZE];
    350       int len = MakeClockOrbit(&co, COTYPE_AUTO, 0, obuffer, sizeof(obuffer));
    351       if (len > 0) {
    352         _outSocket->write(obuffer, len);
    353         _outSocket->flush();
    354       }
    355370    }
    356371  }
     
    359374//
    360375////////////////////////////////////////////////////////////////////////////
    361 void t_bns::processSatellite(int GPSweek, double GPSweeks, const QString& prn,
    362                              const ColumnVector& xx,
     376void t_bns::processSatellite(gpsEph* ep, int GPSweek, double GPSweeks,
     377                             const QString& prn, const ColumnVector& xx,
    363378                             struct ClockOrbit::SatData* sd) {
    364 
    365   // No broadcast ephemeris available
    366   // --------------------------------
    367   if ( !_ephList.contains(prn) ) {
    368     return;
    369   }
    370 
    371   t_ephPair* pair = _ephList[prn];
    372   gpsEph*    ep   = pair->eph;
    373379
    374380  ColumnVector xB(4);
  • trunk/BNS/bns.h

    r863 r872  
    5454  void openCaster();
    5555  void readEpoch();
    56   void processSatellite(int GPSweek, double GPSweeks, const QString& prn,
    57                         const ColumnVector& xx, struct ClockOrbit::SatData* sd);
     56  void processSatellite(gpsEph* ep, int GPSweek, double GPSweeks,
     57                        const QString& prn, const ColumnVector& xx,
     58                        struct ClockOrbit::SatData* sd);
    5859
    5960  QTcpServer*               _clkServer;
Note: See TracChangeset for help on using the changeset viewer.