Changeset 3203 in ntrip
- Timestamp:
- Mar 30, 2011, 4:49:50 PM (14 years ago)
- Location:
- trunk/BNC/upload
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/upload/bncrtnetdecoder.cpp
r3187 r3203 49 49 //////////////////////////////////////////////////////////////////////// 50 50 bncRtnetDecoder::bncRtnetDecoder() { 51 } 52 53 // Destructor 54 //////////////////////////////////////////////////////////////////////// 55 bncRtnetDecoder::~bncRtnetDecoder() { 56 for (int ic = 0; ic < _casters->size(); ic++) { 57 delete _casters->at(ic); 58 } 59 delete _casters; 60 } 61 62 // Run 63 //////////////////////////////////////////////////////////////////////// 64 void bncRtnetDecoder::run() { 51 65 52 66 bncSettings settings; … … 54 68 // List of upload casters 55 69 // ---------------------- 70 _casters = new QVector<bncUploadCaster*>; 56 71 QListIterator<QString> it(settings.value("uploadMountpointsOut").toStringList()); 57 72 while (it.hasNext()) { … … 60 75 int outPort = hlp[1].toInt(); 61 76 bool CoM = (hlp[5].toInt() == Qt::Checked); 62 _caster .push_back(new bncUploadCaster(hlp[2], hlp[0], outPort,63 hlp[3], hlp[4], CoM,64 hlp[6], "", ""));77 _casters->push_back(new bncUploadCaster(hlp[2], hlp[0], outPort, 78 hlp[3], hlp[4], CoM, 79 hlp[6], "", "")); 65 80 } 66 81 } 67 }68 82 69 // Destructor 70 //////////////////////////////////////////////////////////////////////// 71 bncRtnetDecoder::~bncRtnetDecoder() {72 for (int ic = 0; ic < _caster.size(); ic++) {73 delete _caster[ic];83 // Endless Loop - Decode 84 // --------------------- 85 while (true) { 86 DecodeInThread(); 87 msleep(10); 74 88 } 75 }76 77 //78 ////////////////////////////////////////////////////////////////////////79 void bncRtnetDecoder::readEpochTime(const QString& line) {80 QTextStream in(line.toAscii());81 QString hlp;82 int year, month, day, hour, min;83 double sec;84 in >> hlp >> year >> month >> day >> hour >> min >> sec;85 _epoTime.set( year, month, day, hour, min, sec);86 89 } 87 90 … … 89 92 //////////////////////////////////////////////////////////////////////// 90 93 t_irc bncRtnetDecoder::Decode(char* buffer, int bufLen, vector<string>& errmsg) { 91 94 QMutexLocker locker(&_mutex); 92 95 errmsg.clear(); 93 96 _buffer.append(QByteArray(buffer, bufLen)); 97 return success; 98 } 99 100 // Decode and upload in separate thread 101 //////////////////////////////////////////////////////////////////////// 102 void bncRtnetDecoder::DecodeInThread() { 103 QMutexLocker locker(&_mutex); 94 104 95 105 // Prepare list of lines with satellite positions in SP3-like format … … 102 112 for (int ii = 0; ii < hlpLines.size(); ii++) { 103 113 if (hlpLines[ii].indexOf('*') != -1) { 104 readEpochTime(hlpLines[ii]); 114 QTextStream in(hlpLines[ii].toAscii()); 115 QString hlp; 116 int year, month, day, hour, min; 117 double sec; 118 in >> hlp >> year >> month >> day >> hour >> min >> sec; 119 _epoTime.set( year, month, day, hour, min, sec); 105 120 } 106 121 else if (_epoTime.valid()) { … … 113 128 // ----------------------------------- 114 129 if (lines.size() > 0) { 115 for (int ic = 0; ic < _caster .size(); ic++) {116 _caster [ic]->uploadClockOrbitBias(_epoTime, _eph, lines);130 for (int ic = 0; ic < _casters->size(); ic++) { 131 _casters->at(ic)->uploadClockOrbitBias(_epoTime, _eph, lines); 117 132 } 118 133 } 119 120 return success;121 134 } 122 135 -
trunk/BNC/upload/bncrtnetdecoder.h
r3187 r3203 33 33 #include "RTCM/GPSDecoder.h" 34 34 35 class bncRtnetDecoder: public GPSDecoder, public bncEphUser {35 class bncRtnetDecoder: public GPSDecoder, public bncEphUser, public QThread { 36 36 public: 37 37 bncRtnetDecoder(); 38 38 ~bncRtnetDecoder(); 39 virtual t_irc Decode(char* buffer, int bufLen, std::vector<std::string>& errmsg); 39 virtual void run(); 40 virtual t_irc Decode(char* buffer, int bufLen, 41 std::vector<std::string>& errmsg); 40 42 private: 41 void readEpochTime(const QString& line); 42 QVector<bncUploadCaster*> _caster; 43 QString _buffer; 44 bncTime _epoTime; 43 void DecodeInThread(); 44 QVector<bncUploadCaster*>* _casters; 45 QString _buffer; 46 bncTime _epoTime; 47 QMutex _mutex; 45 48 }; 46 49
Note:
See TracChangeset
for help on using the changeset viewer.