Changeset 3206 in ntrip for trunk/BNC/upload/bncrtnetdecoder.cpp
- Timestamp:
- Mar 30, 2011, 6:20:17 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/upload/bncrtnetdecoder.cpp
r3203 r3206 49 49 //////////////////////////////////////////////////////////////////////// 50 50 bncRtnetDecoder::bncRtnetDecoder() { 51 }52 53 // Destructor54 ////////////////////////////////////////////////////////////////////////55 bncRtnetDecoder::~bncRtnetDecoder() {56 for (int ic = 0; ic < _casters->size(); ic++) {57 delete _casters->at(ic);58 }59 delete _casters;60 }61 62 // Run63 ////////////////////////////////////////////////////////////////////////64 void bncRtnetDecoder::run() {65 66 51 bncSettings settings; 67 52 68 53 // List of upload casters 69 54 // ---------------------- 70 _casters = new QVector<bncUploadCaster*>;71 55 QListIterator<QString> it(settings.value("uploadMountpointsOut").toStringList()); 72 56 while (it.hasNext()) { … … 75 59 int outPort = hlp[1].toInt(); 76 60 bool CoM = (hlp[5].toInt() == Qt::Checked); 77 _casters->push_back(new bncUploadCaster(hlp[2], hlp[0], outPort, 78 hlp[3], hlp[4], CoM, 79 hlp[6], "", "")); 61 bncUploadCaster* newCaster = new bncUploadCaster(hlp[2], hlp[0], outPort, 62 hlp[3], hlp[4], CoM, 63 hlp[6], "", ""); 64 newCaster->start(); 65 _casters.push_back(newCaster); 80 66 } 81 67 } 68 } 82 69 83 // Endless Loop - Decode 84 // --------------------- 85 while (true) {86 DecodeInThread();87 msleep(10);70 // Destructor 71 //////////////////////////////////////////////////////////////////////// 72 bncRtnetDecoder::~bncRtnetDecoder() { 73 for (int ic = 0; ic < _casters.size(); ic++) { 74 delete _casters[ic]; 88 75 } 89 76 } … … 94 81 QMutexLocker locker(&_mutex); 95 82 errmsg.clear(); 96 _buffer.append(QByteArray(buffer, bufLen)); 83 for (int ic = 0; ic < _casters.size(); ic++) { 84 _casters[ic]->decodeRtnetStream(buffer, bufLen, _eph); 85 } 97 86 return success; 98 87 } 99 88 100 // Decode and upload in separate thread101 ////////////////////////////////////////////////////////////////////////102 void bncRtnetDecoder::DecodeInThread() {103 QMutexLocker locker(&_mutex);104 105 // Prepare list of lines with satellite positions in SP3-like format106 // -----------------------------------------------------------------107 QStringList lines;108 int iLast = _buffer.lastIndexOf('\n');109 if (iLast != -1) {110 QStringList hlpLines = _buffer.split('\n', QString::SkipEmptyParts);111 _buffer = _buffer.mid(iLast+1);112 for (int ii = 0; ii < hlpLines.size(); ii++) {113 if (hlpLines[ii].indexOf('*') != -1) {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);120 }121 else if (_epoTime.valid()) {122 lines << hlpLines[ii];123 }124 }125 }126 127 // Satellite positions to be processed128 // -----------------------------------129 if (lines.size() > 0) {130 for (int ic = 0; ic < _casters->size(); ic++) {131 _casters->at(ic)->uploadClockOrbitBias(_epoTime, _eph, lines);132 }133 }134 }135
Note:
See TracChangeset
for help on using the changeset viewer.