Legend:
- Unmodified
- Added
- Removed
-
trunk/BNS/bns.cpp
r770 r778 28 28 29 29 _bnseph = new t_bnseph(parent); 30 31 connect(_bnseph, SIGNAL(newEph(gpsEph*)), this, SLOT(slotNewEph(gpsEph*))); 30 32 31 33 connect(_bnseph, SIGNAL(newMessage(QByteArray)), … … 142 144 } 143 145 146 // 147 //////////////////////////////////////////////////////////////////////////// 148 void t_bns::slotNewEph(gpsEph* ep) { 149 150 QMutexLocker locker(&_mutex); 151 152 t_ephPair* pair; 153 if ( !_ephList.contains(ep->prn) ) { 154 pair = new t_ephPair(); 155 _ephList.insert(ep->prn, pair); 156 } 157 else { 158 pair = _ephList[ep->prn]; 159 } 160 161 162 } -
trunk/BNS/bns.h
r770 r778 6 6 7 7 #include "bnseph.h" 8 9 class t_ephPair { 10 public: 11 t_ephPair() { 12 eph = 0; 13 oldEph = 0; 14 } 15 16 ~t_ephPair() { 17 delete eph; 18 delete oldEph; 19 } 20 21 gpsEph* eph; 22 gpsEph* oldEph; 23 }; 8 24 9 25 class t_bns : public QThread { … … 19 35 20 36 private slots: 37 void slotNewEph(gpsEph* ep); 21 38 void slotNewConnection(); 22 39 void slotMessage(const QByteArray msg); … … 26 43 void deleteBnsEph(); 27 44 void openCaster(); 28 QTcpServer* _clkServer; 29 QTcpSocket* _clkSocket; 30 QTcpSocket* _outSocket; 31 t_bnseph* _bnseph; 32 QMutex _mutex; 45 QTcpServer* _clkServer; 46 QTcpSocket* _clkSocket; 47 QTcpSocket* _outSocket; 48 t_bnseph* _bnseph; 49 QMutex _mutex; 50 QMap<QString, t_ephPair*> _ephList; 33 51 }; 34 52 #endif -
trunk/BNS/bnseph.cpp
r776 r778 70 70 void t_bnseph::readEph() { 71 71 72 gps ephemeris* ep = new gpsephemeris;72 gpsEph* ep = new gpsEph; 73 73 74 74 QByteArray line = _socket->readLine(); 75 75 QTextStream in1(line); 76 76 77 QString prn;78 77 int year, month, day, hour, minute, second; 79 78 80 in1 >> prn >> year >> month >> day >> hour >> minute >> second79 in1 >> ep->prn >> year >> month >> day >> hour >> minute >> second 81 80 >> ep->clock_bias >> ep->clock_drift >> ep->clock_driftrate; 81 82 if (year < 100) year += 2000; 82 83 83 84 QDateTime dateTime(QDate(year,month,day), QTime(hour, minute, second), … … 107 108 108 109 double dd; 110 int GPSweek; 109 111 int ii; 110 in6 >> ep->IDOT >> dd >> ep->GPSweek >> ii;112 in6 >> ep->IDOT >> dd >> GPSweek >> ii; 111 113 112 114 line = _socket->readLine(); … … 114 116 115 117 double hlp; 116 in7 >> hlp >> ep->SVhealth >> ep->TGD >> ep->IODC; 118 double health; 119 in7 >> hlp >> health >> ep->TGD >> ep->IODC; 117 120 118 121 line = _socket->readLine(); 119 122 QTextStream in8(line); 120 123 in8 >> ep->TOW; 124 125 emit(newEph(ep)); 121 126 } -
trunk/BNS/bnseph.h
r771 r778 5 5 #include <QtNetwork> 6 6 7 struct gpsephemeris { 8 int flags; /* GPSEPHF_xxx */ 9 int satellite; /* SV ID ICD-GPS data position */ 10 int IODE; /* [s2w3b01-08] */ 11 int URAindex; /* [1..15] [s1w3b13-16] */ 12 int SVhealth; /* [s1w3b17-22] */ 13 int GPSweek; /* [s1w3b01-10] */ 14 int IODC; /* [s1w3b23-32,w8b01-08] */ 15 int TOW; /* [s] [s1w2b01-17] */ 16 int TOC; /* [s] [s1w8b09-24] */ 17 int TOE; /* [s] [s2w10b1-16] */ 18 double clock_bias; /* [s] [s1w10b1-22, af0] */ 19 double clock_drift; /* [s/s] [s1w9b09-24, af1] */ 20 double clock_driftrate; /* [s/s^2] [s1w9b01-08, af2] */ 21 double Crs; /* [m] [s2w3b09-24] */ 22 double Delta_n; /* [rad/s] [s2w4b01-16 * Pi] */ 23 double M0; /* [rad] [s2w4b17-24,w5b01-24 * Pi]*/ 24 double Cuc; /* [rad] [s2w6b01-16] */ 25 double e; /* [s2w6b17-24,w6b01-24] */ 26 double Cus; /* [rad] [s2w8b01-16] */ 27 double sqrt_A; /* [m^0.5] [s2w8b16-24,w9b01-24] */ 28 double Cic; /* [rad] [s3w3b01-16] */ 29 double OMEGA0; /* [rad] [s3w3b17-24,w4b01-24 * Pi]*/ 30 double Cis; /* [rad] [s3w5b01-16] */ 31 double i0; /* [rad] [s3w5b17-24,w6b01-24 * Pi]*/ 32 double Crc; /* [m] [s3w701-16] */ 33 double omega; /* [rad] [s3w7b17-24,w8b01-24 * Pi]*/ 34 double OMEGADOT; /* [rad/s] [s3w9b01-24 * Pi] */ 35 double IDOT; /* [rad/s] [s3w10b9-22 * Pi] */ 36 double TGD; /* [s] [s1w7b17-24] */ 7 class gpsEph { 8 public: 9 QString prn; 10 int GPSweek; 11 int TOW; // [s] 12 int TOC; // [s] 13 int TOE; // [s] 14 int IODE; 15 int IODC; 16 17 double clock_bias; // [s] 18 double clock_drift; // [s/s] 19 double clock_driftrate; // [s/s^2] 20 21 double Crs; // [m] 22 double Delta_n; // [rad/s] 23 double M0; // [rad] 24 double Cuc; // [rad] 25 double e; // 26 double Cus; // [rad] 27 double sqrt_A; // [m^0.5] 28 double Cic; // [rad] 29 double OMEGA0; // [rad] 30 double Cis; // [rad] 31 double i0; // [rad] 32 double Crc; // [m] 33 double omega; // [rad] 34 double OMEGADOT; // [rad/s] 35 double IDOT; // [rad/s] 36 37 double TGD; // [s] 37 38 }; 38 39 … … 45 46 46 47 signals: 48 void newEph(gpsEph* eph); 47 49 void newMessage(const QByteArray msg); 48 50 void error(const QByteArray msg);
Note:
See TracChangeset
for help on using the changeset viewer.