Changeset 1197 in ntrip for trunk/BNS/bns.cpp


Ignore:
Timestamp:
Nov 15, 2008, 10:33:54 AM (15 years ago)
Author:
mervart
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNS/bns.cpp

    r1123 r1197  
    289289void t_bns::readEpoch() {
    290290
    291   QByteArray line = _clkSocket->readLine();
    292 
    293   if (_echoStream) {
    294     *_echoStream << line;
    295     _echoStream->flush();
    296   }
    297 
    298   emit(newClkBytes(line.length()));
    299 
    300   if (line.indexOf('*') == -1) {
     291  // Read the first line (if not already read)
     292  // -----------------------------------------
     293  if (_clkLine.indexOf('*') == -1) {
     294    _clkLine = _clkSocket->readLine();
     295    if (_echoStream) {
     296      *_echoStream << _clkLine;
     297      _echoStream->flush();
     298    }
     299    emit(newClkBytes(_clkLine.length()));
     300  }
     301
     302  if (_clkLine.indexOf('*') == -1) {
    301303    return;
    302304  }
    303305
    304   QTextStream in(line);
     306  QTextStream in(_clkLine);
    305307
    306308  QString hlp;
    307   int     GPSweek, numSat;
     309  int     year, month, day, hour, min;
     310  double  sec;
     311  in >> hlp >> year >> month >> day >> hour >> min >> sec;
     312
     313  int     GPSweek;
    308314  double  GPSweeks;
    309315
    310   in >> hlp >> GPSweek >> GPSweeks >> numSat;
    311 
    312   if (numSat > 0) {
     316  GPSweekFromYMDhms(year, month, day, hour, min, sec, GPSweek, GPSweeks);
     317
     318  QStringList prns;
     319
     320  // Loop over all satellites
     321  // ------------------------
     322  QStringList lines;
     323  for (;;) {
     324    if (!_clkSocket->canReadLine()) {
     325      return;
     326    }
     327    _clkLine = _clkSocket->readLine();
     328    if (_echoStream) {
     329      *_echoStream << _clkLine;
     330      _echoStream->flush();
     331    }
     332    if (_clkLine[0] == '*') {
     333      return;
     334    }
     335    if (_clkLine[0] == 'P') {
     336      _clkLine.remove(0,1);
     337      lines.push_back(_clkLine);
     338    }
     339  }
     340
     341  if (lines.size() > 0) {
    313342
    314343    QStringList prns;
     
    328357        co.SatRefDatum       = DATUM_ITRF;
    329358     
    330         for (int ii = 1; ii <= numSat; ii++) {
    331      
     359        for (int ii = 0; ii < lines.size(); ii++) {
     360
    332361          QString      prn;
    333362          ColumnVector xx(5);
     
    335364     
    336365          if (oldEph == 0 && ic == 0) {
    337             line = _clkSocket->readLine();
    338 
    339             if (_echoStream) {
    340               *_echoStream << line;
    341               _echoStream->flush();
    342             }
    343 
    344             QTextStream in(line);
     366            QTextStream in(lines[ii].toAscii());
    345367            in >> prn;
    346368            prns << prn;
    347369            if ( _ephList.contains(prn) ) {
    348               in >> xx(1) >> xx(2) >> xx(3) >> xx(4) >> xx(5); xx(4) *= 1e-6;
    349      
    350               //// beg test (zero clock correction for Gerhard Wuebbena)
    351               ////            xx(4) -= xx(5) / 299792458.0;
    352               //// end test
     370              in >> xx(1) >> xx(2) >> xx(3) >> xx(4);
     371              xx(1) *= 1e3;
     372              xx(2) *= 1e3;
     373              xx(3) *= 1e3;
     374              xx(4) *= 1e-6;
    353375     
    354376              t_ephPair* pair = _ephList[prn];
     
    358380          }
    359381          else {
    360             prn = prns[ii-1];
     382            prn = prns[ii];
    361383            if ( _ephList.contains(prn) ) {
    362384              t_ephPair* pair = _ephList[prn];
Note: See TracChangeset for help on using the changeset viewer.