Ignore:
Timestamp:
Mar 30, 2011, 6:20:17 PM (13 years ago)
Author:
mervart
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/upload/bncrtnetdecoder.cpp

    r3203 r3206  
    4949////////////////////////////////////////////////////////////////////////
    5050bncRtnetDecoder::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() {
    65 
    6651  bncSettings settings;
    6752
    6853  // List of upload casters
    6954  // ----------------------
    70   _casters = new QVector<bncUploadCaster*>;
    7155  QListIterator<QString> it(settings.value("uploadMountpointsOut").toStringList());
    7256  while (it.hasNext()) {
     
    7559      int  outPort = hlp[1].toInt();
    7660      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);
    8066    }
    8167  }
     68}
    8269
    83   // Endless Loop - Decode
    84   // ---------------------
    85   while (true) {
    86     DecodeInThread();
    87     msleep(10);
     70// Destructor
     71////////////////////////////////////////////////////////////////////////
     72bncRtnetDecoder::~bncRtnetDecoder() {
     73  for (int ic = 0; ic < _casters.size(); ic++) {
     74    delete _casters[ic];
    8875  }
    8976}
     
    9481  QMutexLocker locker(&_mutex);
    9582  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  }
    9786  return success;
    9887}
    9988
    100 // Decode and upload in separate thread
    101 ////////////////////////////////////////////////////////////////////////
    102 void bncRtnetDecoder::DecodeInThread() {
    103   QMutexLocker locker(&_mutex);
    104 
    105   // Prepare list of lines with satellite positions in SP3-like format
    106   // -----------------------------------------------------------------
    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 processed
    128   // -----------------------------------
    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.