Changeset 6455 in ntrip


Ignore:
Timestamp:
Dec 27, 2014, 3:58:55 PM (9 years ago)
Author:
mervart
Message:
 
Location:
trunk/BNC/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/RTCM3/RTCM3coDecoder.cpp

    r6454 r6455  
    262262void RTCM3coDecoder::sendResults() {
    263263
    264   QList<t_orbCorr> orbCorrections;
    265   QList<t_clkCorr> clkCorrections;
    266 
    267   // Loop over all satellites (GPS and Glonass)
    268   // ------------------------------------------
     264  QList<t_orbCorr>& orbCorrections = _orbCorrections[_lastTime];
     265  QList<t_clkCorr>& clkCorrections = _clkCorrections[_lastTime];
     266
     267  // Orbit and clock corrections of all satellites
     268  // ---------------------------------------------
    269269  for (unsigned ii = 0; ii < CLOCKORBIT_NUMGPS + _clkOrb.NumberOfSat[CLOCKORBIT_SATGLONASS]; ii++) {
    270270    char sysCh = ' ';
     
    304304    }
    305305
     306    // Clock Corrections
     307    // -----------------
    306308    if ( _clkOrb.messageType == COTYPE_GPSCOMBINED     ||
    307309         _clkOrb.messageType == COTYPE_GLONASSCOMBINED ||
     
    331333  }
    332334
    333   // Loop over all satellites (GPS and Glonass)
    334   // ------------------------------------------
     335  // Code Biases
     336  // -----------
    335337  QList<t_satBias> satBiases;
    336338  for (unsigned ii = 0; ii < CLOCKORBIT_NUMGPS + _codeBias.NumberOfSat[CLOCKORBIT_SATGLONASS]; ii++) {
     
    354356  }
    355357
    356   if (orbCorrections.size() > 0) {
    357     emit newOrbCorrections(orbCorrections);
    358   }
    359   if (clkCorrections.size() > 0) {
    360     emit newClkCorrections(clkCorrections);
    361   }
     358  // Dump all older epochs
     359  // ---------------------
     360  QMutableMapIterator<bncTime, QList<t_orbCorr> > itOrb(_orbCorrections);
     361  while (itOrb.hasNext()) {
     362    itOrb.next();
     363    if (itOrb.key() < _lastTime) {
     364      emit newOrbCorrections(itOrb.value());
     365      if (_out) {
     366        t_orbCorr::writeEpoch(_out, itOrb.value());
     367      }
     368      itOrb.remove();
     369    }
     370  }
     371  QMutableMapIterator<bncTime, QList<t_clkCorr> > itClk(_clkCorrections);
     372  while (itClk.hasNext()) {
     373    itClk.next();
     374    if (itClk.key() < _lastTime) {
     375      emit newClkCorrections(itClk.value());
     376      if (_out) {
     377        t_clkCorr::writeEpoch(_out, itClk.value());
     378      }
     379      itClk.remove();
     380    }
     381  }
     382
    362383  if (_out) {
    363     QListIterator<t_orbCorr> itOrb(orbCorrections);
    364     while (itOrb.hasNext()) {
    365       const t_orbCorr& orbCorr = itOrb.next();
    366       *_out << orbCorr.toLine();
    367     }
    368     QListIterator<t_clkCorr> itClk(clkCorrections);
    369     while (itClk.hasNext()) {
    370       const t_clkCorr& clkCorr = itClk.next();
    371       *_out << clkCorr.toLine();
    372     }
    373384    _out->flush();
    374385  }
  • trunk/BNC/src/RTCM3/RTCM3coDecoder.h

    r6454 r6455  
    4444
    4545 signals:
    46   void newOrbCorrections(QList<t_orbCorr> orbCorr);
    47   void newClkCorrections(QList<t_clkCorr> clkCorr);
    48   void newBiases(QList<t_satBias> biases);
     46  void newOrbCorrections(QList<t_orbCorr>);
     47  void newClkCorrections(QList<t_clkCorr>);
    4948  void newMessage(QByteArray msg, bool showOnScreen);
    5049  void providerIDChanged(QString staID);
     
    6665  bncTime        _lastTime;
    6766  QMap<std::string, unsigned short> _IODs;
     67  QMap<bncTime, QList<t_orbCorr> >  _orbCorrections;
     68  QMap<bncTime, QList<t_clkCorr> >  _clkCorrections;
    6869};
    6970
  • trunk/BNC/src/bnccore.cpp

    r6451 r6455  
    534534  emit newOrbCorrections(orbCorrections);
    535535  if (_socketsCorr) {
    536     QListIterator<t_orbCorr> it(orbCorrections);
    537     while (it.hasNext()) {
    538       const t_orbCorr& corr = it.next();
    539       QMutableListIterator<QTcpSocket*> is(*_socketsCorr);
    540       while (is.hasNext()) {
    541         QTcpSocket* sock = is.next();
    542         if (sock->state() == QAbstractSocket::ConnectedState) {
    543           if (sock->write(corr.toLine().c_str()) == -1) {
    544             delete sock;
    545             is.remove();
    546           }
    547         }
    548         else if (sock->state() != QAbstractSocket::ConnectingState) {
     536    ostringstream out;
     537    t_orbCorr::writeEpoch(&out, orbCorrections);   
     538    QMutableListIterator<QTcpSocket*> is(*_socketsCorr);
     539    while (is.hasNext()) {
     540      QTcpSocket* sock = is.next();
     541      if (sock->state() == QAbstractSocket::ConnectedState) {
     542        if (sock->write(out.str().c_str()) == -1) {
    549543          delete sock;
    550544          is.remove();
    551545        }
     546      }
     547      else if (sock->state() != QAbstractSocket::ConnectingState) {
     548        delete sock;
     549        is.remove();
    552550      }
    553551    }
     
    561559  emit newClkCorrections(clkCorrections);
    562560  if (_socketsCorr) {
    563     QListIterator<t_clkCorr> it(clkCorrections);
    564     while (it.hasNext()) {
    565       const t_clkCorr& corr = it.next();
    566       QMutableListIterator<QTcpSocket*> is(*_socketsCorr);
    567       while (is.hasNext()) {
    568         QTcpSocket* sock = is.next();
    569         if (sock->state() == QAbstractSocket::ConnectedState) {
    570           if (sock->write(corr.toLine().c_str()) == -1) {
    571             delete sock;
    572             is.remove();
    573           }
    574         }
    575         else if (sock->state() != QAbstractSocket::ConnectingState) {
     561    ostringstream out;
     562    t_clkCorr::writeEpoch(&out, clkCorrections);   
     563    QMutableListIterator<QTcpSocket*> is(*_socketsCorr);
     564    while (is.hasNext()) {
     565      QTcpSocket* sock = is.next();
     566      if (sock->state() == QAbstractSocket::ConnectedState) {
     567        if (sock->write(out.str().c_str()) == -1) {
    576568          delete sock;
    577569          is.remove();
    578570        }
     571      }
     572      else if (sock->state() != QAbstractSocket::ConnectingState) {
     573        delete sock;
     574        is.remove();
    579575      }
    580576    }
  • trunk/BNC/src/rinex/corrfile.cpp

    r6187 r6455  
    5050t_corrFile::t_corrFile(QString fileName) {
    5151  expandEnvVar(fileName);
    52   _file   = new QFile(fileName);
    53   _file->open(QIODevice::ReadOnly | QIODevice::Text);
    54   _stream = new QTextStream();
    55   _stream->setDevice(_file);
    56   _lastOrbCorr = 0;
    57   _lastClkCorr = 0;
     52  _stream.open(fileName.toAscii().data());
    5853}
    5954
     
    6156////////////////////////////////////////////////////////////////////////////
    6257t_corrFile::~t_corrFile() {
    63   delete _stream;
    64   delete _file;
    6558}
    6659
     
    7265  _clkCorr.clear();
    7366
    74   while (!stopRead(tt) && _stream->status() == QTextStream::Ok && !_stream->atEnd()) {
    75     QString line = _stream->readLine().trimmed();
    76     if (line.isEmpty() || line[0] == '!') {
    77       continue;
    78     }
    79     if      (line[0] == 'O') {
    80       delete _lastOrbCorr; _lastOrbCorr = new t_orbCorr(line.toAscii().data());
    81     }
    82     else if (line[0] == 'C') {
    83       delete _lastClkCorr; _lastClkCorr = new t_clkCorr(line.toAscii().data());
    84     }
     67  while (!stopRead(tt) && _stream.good()) {
    8568    if (stopRead(tt)) {
    8669      break;
     
    10184////////////////////////////////////////////////////////////////////////////
    10285bool t_corrFile::stopRead(const bncTime& tt) {
    103   if (_lastOrbCorr) {
    104     if (_lastOrbCorr->_time > tt) {
    105       return true;
    106     }
    107     else {
    108       _orbCorr.push_back(*_lastOrbCorr);
    109       _corrIODs[QString(_lastOrbCorr->_prn.toString().c_str())] = _lastOrbCorr->_iod;
    110       delete _lastOrbCorr; _lastOrbCorr = 0;
    111     }
    112   }
    113   if (_lastClkCorr) {
    114     if (_lastClkCorr->_time > tt) {
    115       return true;
    116     }
    117     else {
    118       _clkCorr.push_back(*_lastClkCorr);
    119       _corrIODs[QString(_lastClkCorr->_prn.toString().c_str())] = _lastClkCorr->_iod;
    120       delete _lastClkCorr; _lastClkCorr = 0;
    121     }
    122   }
    123   return false;
     86  return true;
    12487}
  • trunk/BNC/src/rinex/corrfile.h

    r6183 r6455  
    2626#define CORRFILE_H
    2727
     28#include <fstream>
    2829#include <QtCore>
    2930#include "bncconst.h"
     
    4647 private:
    4748  bool stopRead(const bncTime& tt);
    48   QFile*             _file;
    49   QTextStream*       _stream;
     49  std::fstream       _stream;
    5050  QList<t_orbCorr>   _orbCorr;
    5151  QList<t_clkCorr>   _clkCorr;
    52   t_orbCorr*         _lastOrbCorr;
    53   t_clkCorr*         _lastClkCorr;
    5452  QMap<QString, int> _corrIODs;
    5553};
  • trunk/BNC/src/satObs.cpp

    r6453 r6455  
    66
    77using namespace std;
    8 
    9 //
    10 ////////////////////////////////////////////////////////////////////////////
    11 t_clkCorr::t_clkCorr(const string& line) {
    12   reset();
    13   istringstream in(line);
    14   char ch; in >> ch; if (ch != 'C') return;
    15   int    gpsw;
    16   double gpssec;
    17   in >> gpsw >> gpssec >> _prn >> _iod >> _dClk >> _dotDClk >> _dotDotDClk;
    18   _time.set(gpsw, gpssec);
    19   _dClk       /= t_CST::c;
    20   _dotDClk    /= t_CST::c;
    21   _dotDotDClk /= t_CST::c;
    22 }
    238
    249//
     
    3621//
    3722////////////////////////////////////////////////////////////////////////////
    38 string t_clkCorr::toLine() const {
    39   ostringstream str;
    40   str.setf(ios::showpoint | ios::fixed);
    41   str << "C " << _time.gpsw() << ' ' << setprecision(2) << _time.gpssec() << ' '
    42       << _prn.toString() << ' ' << setw(3) << _iod << ' '
    43       << setw(10) << setprecision(4) << _dClk       * t_CST::c << ' '
    44       << setw(10) << setprecision(4) << _dotDClk    * t_CST::c << ' '
    45       << setw(10) << setprecision(4) << _dotDotDClk * t_CST::c << endl;
    46   return str.str();
     23void t_clkCorr::writeEpoch(std::ostream* out, const QList<t_clkCorr>& corrList) {
     24  *out << "CLOCK CORRECTIONS: " << corrList.size() << endl;
    4725}
    4826
    4927//
    5028////////////////////////////////////////////////////////////////////////////
    51 t_orbCorr::t_orbCorr(const string& line) {
    52   reset();
    53   istringstream in(line);
    54   char ch; in >> ch; if (ch != 'O') return;
    55   int    gpsw;
    56   double gpssec;
    57   in >> gpsw >> gpssec >> _prn >> _iod
    58      >> _xr[0]    >> _xr[1]    >> _xr[2]
    59      >> _dotXr[0] >> _dotXr[1] >> _dotXr[2];
    60   _time.set(gpsw, gpssec);
     29void t_clkCorr::readEpoch(std::istream* in, QList<t_clkCorr>& corrList) {
    6130}
    6231
     
    7443//
    7544////////////////////////////////////////////////////////////////////////////
    76 string t_orbCorr::toLine() const {
    77   ostringstream str;
    78   str.setf(ios::showpoint | ios::fixed);
    79   str << "O " << _time.gpsw() << ' ' << setprecision(2) << _time.gpssec() << ' '
    80       << _prn.toString() << ' ' << setw(3) << _iod << ' '
    81       << setw(10) << setprecision(4) << _xr[0]     << ' '
    82       << setw(10) << setprecision(4) << _xr[1]     << ' '
    83       << setw(10) << setprecision(4) << _xr[2]     << "    "
    84       << setw(10) << setprecision(4) << _dotXr[0]  << ' '
    85       << setw(10) << setprecision(4) << _dotXr[1]  << ' '
    86       << setw(10) << setprecision(4) << _dotXr[2]  << endl;
    87   return str.str();
     45void t_orbCorr::writeEpoch(std::ostream* out, const QList<t_orbCorr>& corrList) {
     46  *out << "ORB CORRECTIONS: " << corrList.size() << endl;
    8847}
    8948
     49//
     50////////////////////////////////////////////////////////////////////////////
     51void t_orbCorr::readEpoch(std::istream* in, QList<t_orbCorr>& corrList) {
     52}
  • trunk/BNC/src/satObs.h

    r6180 r6455  
    55#include <vector>
    66#include <newmat.h>
     7
     8#include <QtCore>
    79
    810#include "bncconst.h"
     
    6062 public:
    6163  t_orbCorr() {reset();}
    62   t_orbCorr(const std::string& line);
     64  static void writeEpoch(std::ostream* out, const QList<t_orbCorr>& corrList);
     65  static void readEpoch(std::istream* in, QList<t_orbCorr>& corrList);
    6366  void           reset();
    6467  t_prn          prn() const {return _prn;}
    6568  unsigned short IOD() const {return _iod;}
    66   std::string    toLine() const;
    6769  std::string    _staID;
    6870  t_prn          _prn;
     
    7779 public:
    7880  t_clkCorr() {reset();}
    79   t_clkCorr(const std::string& line);
     81  static void writeEpoch(std::ostream* out, const QList<t_clkCorr>& corrList);
     82  static void readEpoch(std::istream* in, QList<t_clkCorr>& corrList);
    8083  void           reset();
    8184  t_prn          prn() const {return _prn;}
    8285  unsigned short IOD() const {return _iod;}
    83   std::string    toLine() const;
    8486  std::string    _staID;
    8587  t_prn          _prn;
Note: See TracChangeset for help on using the changeset viewer.