Changeset 349 in ntrip
- Timestamp:
- Dec 12, 2006, 4:59:42 PM (18 years ago)
- Location:
- trunk/BNC
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/bnccaster.cpp
r347 r349 114 114 // New Observations 115 115 //////////////////////////////////////////////////////////////////////////// 116 void bncCaster::newObs(const QByteArray& staID, const QUrl& mountPoint, 117 bool firstObs, Observation* obs, 118 const QByteArray& format) { 116 int bncCaster::newObs(const QByteArray& staID, 117 bool firstObs, Observation* obs) { 119 118 120 119 QMutexLocker locker(&_mutex); … … 128 127 obs->StatID[sizeof(obs->StatID)-1] = '\0'; 129 128 130 // Prepare RINEX Output131 // --------------------132 if (_rinexWriters.find(obs->StatID) == _rinexWriters.end()) {133 _rinexWriters.insert(obs->StatID, new bncRinex(obs->StatID,134 mountPoint, format));135 }136 bncRinex* rnx = _rinexWriters.find(obs->StatID).value();137 if (_samplingRate == 0 || iSec % _samplingRate == 0) {138 rnx->deepCopy(obs);139 }140 rnx->dumpEpoch(newTime);141 142 129 // First time, set the _lastDumpSec immediately 143 130 // -------------------------------------------- … … 158 145 } 159 146 delete obs; 160 return ;147 return 1; 161 148 } 162 149 … … 172 159 _lastDumpSec = newTime - _waitTime; 173 160 } 161 162 return 0; 174 163 } 175 164 -
trunk/BNC/bnccaster.h
r336 r349 32 32 33 33 #include "RTCM/GPSDecoder.h" 34 #include "bncrinex.h"35 34 36 35 class bncGetThread; … … 44 43 void addGetThread(bncGetThread* getThread); 45 44 int numStations() const {return _staIDs.size();} 46 void newObs(const QByteArray& staID, const QUrl& mountPoint, 47 bool firstObs, Observation* obs, const QByteArray& format); 45 int newObs(const QByteArray& staID, bool firstObs, Observation* obs); 48 46 49 47 signals: … … 66 64 QList<QTcpSocket*>* _sockets; 67 65 QList<QByteArray> _staIDs; 68 QMap<QString, bncRinex*> _rinexWriters;69 66 QList<bncGetThread*> _threads; 70 67 int _samplingRate; -
trunk/BNC/bncgetthread.cpp
r336 r349 49 49 #include "bnctabledlg.h" 50 50 #include "bncapp.h" 51 #include "bncutils.h" 51 52 52 53 #include "RTCM/RTCM2Decoder.h" … … 60 61 bncGetThread::bncGetThread(const QUrl& mountPoint, 61 62 const QByteArray& format, int iMount) { 62 _decoder = 0; 63 _mountPoint = mountPoint; 64 _staID = mountPoint.path().mid(1).toAscii(); 65 _staID_orig = _staID; 66 _format = format; 67 _socket = 0; 68 _timeOut = 20*1000; // 20 seconds 69 _nextSleep = 1; // 1 second 70 _iMount = iMount; // index in mountpoints array 63 _decoder = 0; 64 _mountPoint = mountPoint; 65 _staID = mountPoint.path().mid(1).toAscii(); 66 _staID_orig = _staID; 67 _format = format; 68 _socket = 0; 69 _timeOut = 20*1000; // 20 seconds 70 _nextSleep = 1; // 1 second 71 _iMount = iMount; // index in mountpoints array 72 _rinexWriter = 0; 71 73 72 74 // Check name conflict … … 87 89 } 88 90 } 91 92 _samplingRate = settings.value("rnxSampl").toInt(); 89 93 90 94 if (num > 0) { … … 288 292 for (list<Observation*>::iterator it = _decoder->_obsList.begin(); 289 293 it != _decoder->_obsList.end(); it++) { 294 295 // Check observation epoch 296 // ----------------------- 297 int week; 298 double sec; 299 currentGPSWeeks(week, sec); 300 301 const double secPerWeek = 7.0 * 24.0 * 3600.0; 302 const double maxDt = 600.0; 303 304 if (week < (*it)->GPSWeek) { 305 week += 1; 306 sec -= secPerWeek; 307 } 308 if (week > (*it)->GPSWeek) { 309 week -= 1; 310 sec += secPerWeek; 311 } 312 double dt = fabs(sec - (*it)->GPSWeeks); 313 if (week != (*it)->GPSWeek || dt > maxDt) { 314 emit( newMessage("Wrong observation epoch") ); 315 delete (*it); 316 continue; 317 } 318 290 319 emit newObs(_staID, *it); 291 320 bool firstObs = (it == _decoder->_obsList.begin()); 292 _global_caster->newObs(_staID, _mountPoint, firstObs, *it, _format); 321 if ( _global_caster->newObs(_staID, firstObs, *it) == 0 ) { 322 323 if (_rinexWriter == 0) { 324 _rinexWriter = new bncRinex((*it)->StatID, _mountPoint, _format); 325 } 326 327 long iSec = long(floor((*it)->GPSWeeks+0.5)); 328 long newTime = (*it)->GPSWeek * 7*24*3600 + iSec; 329 330 if (_samplingRate == 0 || iSec % _samplingRate == 0) { 331 _rinexWriter->deepCopy(*it); 332 } 333 _rinexWriter->dumpEpoch(newTime); 334 } 335 336 293 337 } 294 338 _decoder->_obsList.clear(); -
trunk/BNC/bncgetthread.h
r282 r349 32 32 #include "RTCM/GPSDecoder.h" 33 33 #include "bncconst.h" 34 #include "bncrinex.h" 34 35 35 36 class bncGetThread : public QThread { … … 68 69 int _nextSleep; 69 70 int _iMount; 71 int _samplingRate; 72 bncRinex* _rinexWriter; 70 73 }; 71 74
Note:
See TracChangeset
for help on using the changeset viewer.