Changeset 2618 in ntrip for trunk/BNS


Ignore:
Timestamp:
Oct 13, 2010, 5:05:26 PM (14 years ago)
Author:
mervart
Message:
 
Location:
trunk/BNS
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNS/bnseph.cpp

    r2562 r2618  
    1818
    1919#include "bnseph.h"
    20 #include "bnsutils.h"
    2120#include "bnssettings.h"
    2221#include "bnctime.h"
     
    149148    numlines = 4;
    150149  }
    151   else {
     150  else if (prn.indexOf('G') != -1) {
    152151    eph = new t_ephGPS();
    153152    numlines = 8;
     153  }
     154  else {
     155    emit(newMessage(QString("Ephemeris server: line not recognized: %1")
     156                    .arg(line.data()).toAscii().data()));
    154157  }
    155158
     
    172175    lines << line;
    173176  }
    174 
    175   eph->read(lines);
    176 
    177   emit(newEph(eph, nBytes));
     177   
     178  if (eph->read(lines) == success) {
     179    emit(newEph(eph, nBytes));
     180  }
     181  else {
     182    emit(newMessage(QString("Broadcast message too new, excluded.\n%1")
     183                    .arg(lines.join("")).toAscii().data()));
     184    delete eph;
     185    return;
     186  }
    178187}
    179188
     
    192201// Read GPS Ephemeris
    193202////////////////////////////////////////////////////////////////////////////
    194 void t_ephGPS::read(const QStringList& lines) {
     203t_irc t_ephGPS::read(const QStringList& lines) {
    195204
    196205  for (int ii = 1; ii <= lines.size(); ii++) {
     
    207216                                          QTime(int(hour), int(minute), int(second)), Qt::UTC);
    208217
     218      // do not allow too new message (actually 12h) ! /JD
     219      QDateTime currTime = QDateTime::currentDateTime();
     220      if( dateTime->secsTo(currTime) < -3600*12 ){
     221         delete dateTime;
     222         return failure;
     223      }
     224       
    209225      GPSweekFromDateAndTime(*dateTime, _GPSweek, _GPSweeks);
    210226
     
    236252    }
    237253  }
     254  return success;
    238255}
    239256
     
    489506// Read Glonass Ephemeris
    490507////////////////////////////////////////////////////////////////////////////
    491 void t_ephGlo::read(const QStringList& lines) {
     508t_irc t_ephGlo::read(const QStringList& lines) {
    492509
    493510  static const double secPerWeek = 7 * 86400.0;
     
    505522      if (year < 100) year += 2000;
    506523
     524      // do not allow too new message (actually 24h) ! /JD
     525      QDateTime mesgTime = QDateTime::fromString(QString("%1-%2-%3 %4").arg(year).arg(month).arg(day).arg(hour), "yyyy-MM-dd hh");
     526      QDateTime currTime = QDateTime::currentDateTime();
     527      if (mesgTime.secsTo(currTime) < -3600*24) {
     528        return failure;
     529      }
     530       
    507531      bncTime tHlp;
    508532      tHlp.set(int(year), int(month), int(day),
     
    542566  _xv(5) = _y_velocity * 1.e3;
    543567  _xv(6) = _z_velocity * 1.e3;
     568
     569  return success;
    544570}
    545571
  • trunk/BNS/bnseph.h

    r2558 r2618  
    99#include <QtNetwork>
    1010
     11#include "bnsutils.h"
    1112
    1213class t_eph {
     
    1920  virtual void position(int GPSweek, double GPSweeks, ColumnVector& xc,
    2021                        ColumnVector& vv) const = 0;
    21   virtual void read(const QStringList& lines) = 0;
     22  virtual t_irc read(const QStringList& lines) = 0;
    2223  virtual int  IOD() const = 0;
    2324  virtual int  RTCM3(unsigned char *) = 0;
     25
    2426 protected: 
    2527  QString _prn;
     
    3537  };
    3638  virtual ~t_ephGlo() {};
    37   virtual void read(const QStringList& lines);
     39  virtual t_irc read(const QStringList& lines);
    3840  virtual void position(int GPSweek, double GPSweeks, ColumnVector& xc,
    3941                        ColumnVector& vv) const;
     
    6971  t_ephGPS() {};
    7072  virtual ~t_ephGPS() {};
    71   virtual void read(const QStringList& lines);
     73  virtual t_irc read(const QStringList& lines);
    7274  virtual void position(int GPSweek, double GPSweeks, ColumnVector& xc,
    7375                        ColumnVector& vv) const;
Note: See TracChangeset for help on using the changeset viewer.