- Timestamp:
- Oct 13, 2010, 5:05:26 PM (14 years ago)
- Location:
- trunk/BNS
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNS/bnseph.cpp
r2562 r2618 18 18 19 19 #include "bnseph.h" 20 #include "bnsutils.h"21 20 #include "bnssettings.h" 22 21 #include "bnctime.h" … … 149 148 numlines = 4; 150 149 } 151 else {150 else if (prn.indexOf('G') != -1) { 152 151 eph = new t_ephGPS(); 153 152 numlines = 8; 153 } 154 else { 155 emit(newMessage(QString("Ephemeris server: line not recognized: %1") 156 .arg(line.data()).toAscii().data())); 154 157 } 155 158 … … 172 175 lines << line; 173 176 } 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 } 178 187 } 179 188 … … 192 201 // Read GPS Ephemeris 193 202 //////////////////////////////////////////////////////////////////////////// 194 voidt_ephGPS::read(const QStringList& lines) {203 t_irc t_ephGPS::read(const QStringList& lines) { 195 204 196 205 for (int ii = 1; ii <= lines.size(); ii++) { … … 207 216 QTime(int(hour), int(minute), int(second)), Qt::UTC); 208 217 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 209 225 GPSweekFromDateAndTime(*dateTime, _GPSweek, _GPSweeks); 210 226 … … 236 252 } 237 253 } 254 return success; 238 255 } 239 256 … … 489 506 // Read Glonass Ephemeris 490 507 //////////////////////////////////////////////////////////////////////////// 491 voidt_ephGlo::read(const QStringList& lines) {508 t_irc t_ephGlo::read(const QStringList& lines) { 492 509 493 510 static const double secPerWeek = 7 * 86400.0; … … 505 522 if (year < 100) year += 2000; 506 523 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 507 531 bncTime tHlp; 508 532 tHlp.set(int(year), int(month), int(day), … … 542 566 _xv(5) = _y_velocity * 1.e3; 543 567 _xv(6) = _z_velocity * 1.e3; 568 569 return success; 544 570 } 545 571 -
trunk/BNS/bnseph.h
r2558 r2618 9 9 #include <QtNetwork> 10 10 11 #include "bnsutils.h" 11 12 12 13 class t_eph { … … 19 20 virtual void position(int GPSweek, double GPSweeks, ColumnVector& xc, 20 21 ColumnVector& vv) const = 0; 21 virtual voidread(const QStringList& lines) = 0;22 virtual t_irc read(const QStringList& lines) = 0; 22 23 virtual int IOD() const = 0; 23 24 virtual int RTCM3(unsigned char *) = 0; 25 24 26 protected: 25 27 QString _prn; … … 35 37 }; 36 38 virtual ~t_ephGlo() {}; 37 virtual voidread(const QStringList& lines);39 virtual t_irc read(const QStringList& lines); 38 40 virtual void position(int GPSweek, double GPSweeks, ColumnVector& xc, 39 41 ColumnVector& vv) const; … … 69 71 t_ephGPS() {}; 70 72 virtual ~t_ephGPS() {}; 71 virtual voidread(const QStringList& lines);73 virtual t_irc read(const QStringList& lines); 72 74 virtual void position(int GPSweek, double GPSweeks, ColumnVector& xc, 73 75 ColumnVector& vv) const;
Note:
See TracChangeset
for help on using the changeset viewer.