Changeset 2461 in ntrip


Ignore:
Timestamp:
Apr 28, 2010, 1:08:15 PM (14 years ago)
Author:
mervart
Message:

* empty log message *

Location:
trunk/BNS
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNS/bns.cpp

    r2429 r2461  
    4646  bnsSettings settings;
    4747
     48  _GPSweek   = 0;
     49  _GPSweeks  = 0;
     50   
    4851  // Set Proxy (application-wide)
    4952  // ----------------------------
     
    314317    if (_clkSocket && _clkSocket->state() == QAbstractSocket::ConnectedState) {
    315318      if ( _clkSocket->canReadLine()) {
    316         readEpoch();
     319        readRecords();
    317320      }
    318321      else {
     
    330333void t_bns::readEpoch() {
    331334
     335  QTextStream in(_clkLine);
     336
     337  QString hlp;
     338  in >> hlp >> _year >> _month >> _day >> _hour >> _min >> _sec;
     339
     340  GPSweekFromYMDhms(_year, _month, _day, _hour, _min, _sec, _GPSweek, _GPSweeks);
     341
     342  if (_echoStream) {
     343    *_echoStream << _clkLine;
     344    _echoStream->flush();
     345  }
     346  emit(newClkBytes(_clkLine.length()));
     347}
     348
     349
     350//
     351////////////////////////////////////////////////////////////////////////////
     352void t_bns::readRecords() {
     353
    332354  bnsSettings settings;
    333355
    334356  // Read the first line (if not already read)
    335357  // -----------------------------------------
    336   if (_clkLine.indexOf('*') == -1) {
     358  if ( _GPSweek == 0 and _clkLine.indexOf('*') == -1 ) {
     359       
    337360    _clkLine = _clkSocket->readLine();
    338     if (_echoStream) {
    339       *_echoStream << _clkLine;
    340       _echoStream->flush();
    341     }
    342     emit(newClkBytes(_clkLine.length()));
    343   }
    344 
    345   if (_clkLine.indexOf('*') == -1) {
    346     return;
    347   }
    348 
    349   QTextStream in(_clkLine);
    350 
    351   QString hlp;
    352   int     year, month, day, hour, min;
    353   double  sec;
    354   in >> hlp >> year >> month >> day >> hour >> min >> sec;
    355 
    356   int     GPSweek;
    357   double  GPSweeks;
    358 
    359   GPSweekFromYMDhms(year, month, day, hour, min, sec, GPSweek, GPSweeks);
    360 
    361   QStringList prns;
     361//  cout << "trying epoch:" << _clkLine.data() << endl;
     362     
     363    if (_clkLine.indexOf('*') == -1) {
     364      return;
     365    }else{
     366      readEpoch();
     367    }   
     368  }
    362369
    363370  // Loop over all satellites
     
    368375      break;
    369376    }
     377
     378    QByteArray tmp = _clkSocket->peek(80);
     379
     380    // found epoch, but not first record, break
     381    if( tmp.indexOf('*') >= 0 and lines.size() > 0 ) {
     382      // cout << "find epoch, not first, thus break" << endl;
     383      break;
     384    }
     385     
    370386    _clkLine = _clkSocket->readLine();
     387
     388    // found epoch, but still first record, continue
     389    if (_clkLine[0] == '*') {
     390      // cout << "epoch:" << _clkLine.data();
     391      readEpoch();
     392    }
     393
     394    if (_clkLine[0] == 'P') {
     395      // cout << "data:" << _clkLine.data();
     396      _clkLine.remove(0,1);
     397      lines.push_back(_clkLine);
     398    }
     399     
    371400    if (_echoStream) {
    372401      *_echoStream << _clkLine;
    373402      _echoStream->flush();
    374403    }
    375     if (_clkLine[0] == '*') {
    376       return;
    377     }
    378     if (_clkLine[0] == 'P') {
    379       _clkLine.remove(0,1);
    380       lines.push_back(_clkLine);
    381     }
    382   }
    383 
     404     
     405  }
     406
     407  // some data records to be processed ?
    384408  if (lines.size() > 0) {
    385409
     
    393417        struct ClockOrbit co;
    394418        memset(&co, 0, sizeof(co));
    395         co.GPSEpochTime      = (int)GPSweeks;
    396         co.GLONASSEpochTime  = (int)fmod(GPSweeks, 86400.0)
    397                              + 3 * 3600 - gnumleap(year, month, day);
     419        co.GPSEpochTime      = (int)_GPSweeks;
     420        co.GLONASSEpochTime  = (int)fmod(_GPSweeks, 86400.0)
     421                             + 3 * 3600 - gnumleap(_year, _month, _day);
    398422        co.ClockDataSupplied = 1;
    399423        co.OrbitDataSupplied = 1;
     
    402426        struct Bias bias;
    403427        memset(&bias, 0, sizeof(bias));
    404         bias.GPSEpochTime      = (int)GPSweeks;
    405         bias.GLONASSEpochTime  = (int)fmod(GPSweeks, 86400.0)
    406                                + 3 * 3600 - gnumleap(year, month, day);
     428        bias.GPSEpochTime      = (int)_GPSweeks;
     429        bias.GLONASSEpochTime  = (int)fmod(_GPSweeks, 86400.0)
     430                               + 3 * 3600 - gnumleap(_year, _month, _day);
    407431
    408432        for (int ii = 0; ii < lines.size(); ii++) {
     
    452476            }
    453477          }
    454      
    455478          if (ep != 0) {
    456479            struct ClockOrbit::SatData* sd = 0;
     
    467490              processSatellite(oldEph, ic, _caster.at(ic)->crdTrafo(),
    468491                               _caster.at(ic)->CoM(), ep,
    469                                GPSweek, GPSweeks, prn, xx, sd, outLine);
     492                               _GPSweek, _GPSweeks, prn, xx, sd, outLine);
    470493              _caster.at(ic)->printAscii(outLine);
    471494            }
  • trunk/BNS/bns.h

    r2349 r2461  
    6969  void openCaster();
    7070  void readEpoch();
     71  void readRecords();
    7172  void processSatellite(int oldEph, int iCaster, const QString trafo, bool CoM,
    7273                        t_eph* ep, int GPSweek, double GPSweeks,
     
    8990  bnsSP3*                   _sp3;
    9091  QByteArray                _clkLine;
     92 
     93  int    _GPSweek;
     94  double _GPSweeks;
     95  int    _year;
     96  int    _month;
     97  int    _day;
     98  int    _hour;
     99  int    _min;
     100  double _sec;
     101
    91102  double _dx;
    92103  double _dy;
  • trunk/BNS/bnsoutf.cpp

    r1668 r2461  
    110110
    111111  if (nextEpoch) {
    112    *nextEpoch = QDateTime(nextDate, nextTime);
     112    *nextEpoch = QDateTime(nextDate, nextTime, Qt::UTC);
    113113  }
    114114
Note: See TracChangeset for help on using the changeset viewer.