Changeset 6151 in ntrip


Ignore:
Timestamp:
Sep 14, 2014, 8:24:57 AM (10 years ago)
Author:
mervart
Message:
 
Location:
trunk/BNC/src
Files:
6 edited

Legend:

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

    r6138 r6151  
    146146    parser.GPSTOW = int(secGPS);
    147147  }
    148 
    149   // Get Glonass Slot Numbers from Global Array
    150   // ------------------------------------------
    151   BNC_CORE->getGlonassSlotNums(parser.GLOFreq);
    152148
    153149  // Remaining part decodes the Observations
     
    406402
    407403  if (decoded) {
    408     BNC_CORE->storeGlonassSlotNums(parser.GLOFreq);
    409404    return success;
    410405  }
  • trunk/BNC/src/bnccore.cpp

    r6141 r6151  
    116116#endif
    117117  expandEnvVar(_userName);
    118   _userName = _userName.leftJustified(20, ' ', true);
    119 
    120   _corrs = new QMultiMap<bncTime, t_clkCorr>;
    121 
     118
     119  _userName       = _userName.leftJustified(20, ' ', true);
    122120  _dateAndTimeGPS = 0;
    123 
    124   for (int ii = 0; ii < PRN_GLONASS_NUM; ++ii) {
    125     _GLOFreq[ii] = 0;
    126   }
    127 
    128   _mainWindow = 0;
     121  _mainWindow     = 0;
    129122
    130123  _pppMain = new BNC_PPP::t_pppMain();
     
    158151  }
    159152
    160   delete _corrs;
    161 
    162153  delete _dateAndTimeGPS;
    163 
    164154  delete _rawFile;
    165155
     
    640630////////////////////////////////////////////////////////////////////////////
    641631void t_bncCore::slotNewOrbCorrections(QList<t_orbCorr> orbCorrections) {
     632  QMutexLocker locker(&_mutex);
    642633  emit newOrbCorrections(orbCorrections);
     634  if (_socketsCorr) {
     635    QListIterator<t_orbCorr> it(orbCorrections);
     636    while (it.hasNext()) {
     637      const t_orbCorr& corr = it.next();
     638      QMutableListIterator<QTcpSocket*> is(*_socketsCorr);
     639      while (is.hasNext()) {
     640        QTcpSocket* sock = is.next();
     641        if (sock->state() == QAbstractSocket::ConnectedState) {
     642          if (sock->write(corr.toString().c_str()) == -1) {
     643            delete sock;
     644            is.remove();
     645          }
     646        }
     647        else if (sock->state() != QAbstractSocket::ConnectingState) {
     648          delete sock;
     649          is.remove();
     650        }
     651      }
     652    }
     653  }
    643654}
    644655
     
    647658void t_bncCore::slotNewClkCorrections(QList<t_clkCorr> clkCorrections) {
    648659  QMutexLocker locker(&_mutex);
    649 
    650   if (clkCorrections.size() == 0) {
    651     return;
    652   }
    653   bncTime coTime = clkCorrections[0]._time;
    654   QString staID(clkCorrections[0]._staID.c_str());
    655 
    656   // Combination of Corrections
    657   // --------------------------
    658 #ifdef USE_COMBINATION
    659   if (_bncComb) {
    660     _bncComb->processClkCorrections(clkCorrections);
    661   }
    662 #endif
    663 
    664   bncSettings settings;
    665   _waitCoTime = settings.value("corrTime").toDouble();
    666   if (_waitCoTime < 0.0) {
    667     _waitCoTime = 0.0;
    668   }
    669 
    670   // First time, set the _lastCorrDumpTime
    671   // -------------------------------------
    672   if (!_lastCorrDumpTime[staID].valid()) {
    673     _lastCorrDumpTime[staID] = coTime - 1.0;
    674   }
    675 
    676   // An old correction - throw it away
    677   // ---------------------------------
    678   if (_waitCoTime > 0.0 && coTime <= _lastCorrDumpTime[staID]) {
    679     if (!_bncComb) {
    680       QString line = staID + ": Correction for one sat neglected because overaged by " +
    681                       QString().sprintf(" %f sec",
    682                       _lastCorrDumpTime[staID] - coTime + _waitCoTime);
    683       messagePrivate(line.toAscii());
    684       emit( newMessage(line.toAscii(), true) );
    685     }
    686     return;
    687   }
    688 
    689   for (int ii = 0; ii < clkCorrections.size(); ii++) {
    690     _corrs->insert(coTime, clkCorrections[ii]);
    691   }
    692 
    693   // Dump Corrections
    694   // ----------------
    695   if      (_waitCoTime == 0.0) {
    696     dumpCorrs();
    697   }
    698   else if (coTime - _waitCoTime > _lastCorrDumpTime[staID]) {
    699     dumpCorrs(_lastCorrDumpTime[staID] + 1, coTime - _waitCoTime);
    700     _lastCorrDumpTime[staID] = coTime - _waitCoTime;
    701   }
    702 }
    703 
    704 // Dump Complete Correction Epochs
    705 ////////////////////////////////////////////////////////////////////////////
    706 void t_bncCore::dumpCorrs(bncTime minTime, bncTime maxTime) {
    707   QList<t_clkCorr> allCorrs;
    708   QMutableMapIterator<bncTime, t_clkCorr> it(*_corrs);
    709   while (it.hasNext()) {
    710     it.next();
    711     const bncTime& corrTime = it.key();
    712     if (minTime <= corrTime && corrTime <= maxTime) {
    713       allCorrs << it.value();
    714       it.remove();
    715     }
    716   }
    717   dumpCorrs(allCorrs);
    718 }
    719 
    720 // Dump all corrections
    721 ////////////////////////////////////////////////////////////////////////////
    722 void t_bncCore::dumpCorrs() {
    723   QList<t_clkCorr> allCorrs;
    724   QMutableMapIterator<bncTime, t_clkCorr> it(*_corrs);
    725   while (it.hasNext()) {
    726     allCorrs << it.next().value();
    727     it.remove();
    728   }
    729   dumpCorrs(allCorrs);
    730 }
    731 
    732 // Dump List of Corrections
    733 ////////////////////////////////////////////////////////////////////////////
    734 void t_bncCore::dumpCorrs(const QList<t_clkCorr>& allCorrs) {
    735   emit newClkCorrections(allCorrs);
     660  emit newClkCorrections(clkCorrections);
    736661  if (_socketsCorr) {
    737     QListIterator<t_clkCorr> it(allCorrs);
     662    QListIterator<t_clkCorr> it(clkCorrections);
    738663    while (it.hasNext()) {
    739664      const t_clkCorr& corr = it.next();
     
    790715}
    791716
    792 // Get Glonass Slot Numbers from Global Array
    793 ////////////////////////////////////////////////////////////////////////////
    794 void t_bncCore::getGlonassSlotNums(int GLOFreq[]) {
    795 
    796   QMutexLocker locker(&_mutex);
    797 
    798   for (int ii = 0; ii < PRN_GLONASS_NUM; ++ii) {
    799     if (_GLOFreq[ii] != 0) {
    800       GLOFreq[ii] = _GLOFreq[ii];
    801     }
    802   }
    803 }
    804 
    805 // Store Glonass Slot Numbers to Global Array
    806 ////////////////////////////////////////////////////////////////////////////
    807 void t_bncCore::storeGlonassSlotNums(const int GLOFreq[]) {
    808 
    809   QMutexLocker locker(&_mutex);
    810 
    811   for (int ii = 0; ii < PRN_GLONASS_NUM; ++ii) {
    812     if (GLOFreq[ii] != 0) {
    813       _GLOFreq[ii] = GLOFreq[ii];
    814     }
    815   }
    816 }
    817 
    818717//
    819718////////////////////////////////////////////////////////////////////////////
  • trunk/BNC/src/bnccore.h

    r6141 r6151  
    4646  enum e_mode {interactive, nonInteractive, batchPostProcessing};
    4747  t_bncCore();
    48   virtual ~t_bncCore(); 
     48  ~t_bncCore(); 
    4949  static t_bncCore* instance();
    50   e_mode mode() const {return _mode;}
    51   void setGUIenabled(bool GUIenabled) {_GUIenabled = GUIenabled;}
    52   void setMode(e_mode mode) {_mode = mode;}
    53   void setPort(int port);
    54   void setPortCorr(int port);
    55   void setCaster(bncCaster* caster) {_caster = caster;}
    56   const bncCaster* caster() const {return _caster;}
    57   bool      dateAndTimeGPSSet() const;
    58   QDateTime dateAndTimeGPS() const;
    59   void      setDateAndTimeGPS(QDateTime dateTime);
    60   void setConfFileName(const QString& confFileName);
    61   QString confFileName() const {return _confFileName;}
    62   void writeRawData(const QByteArray& data, const QByteArray& staID,
    63                     const QByteArray& format);
    64   void storeGlonassSlotNums(const int GLOFreq[]);
    65   void getGlonassSlotNums(int GLOFreq[]);
    66   void initCombination();
    67   void stopCombination();
    68   const QString& pgmName() {return _pgmName;}
    69   const QString& userName() {return _userName;}
    70   QWidget* mainWindow() const {return _mainWindow;};
    71   void setMainWindow(QWidget* mainWindow){_mainWindow = mainWindow;}
    72   bool GUIenabled() const {return _GUIenabled;}
    73   void startPPP();
    74   void stopPPP();
     50  e_mode            mode() const {return _mode;}
     51  void              setGUIenabled(bool GUIenabled) {_GUIenabled = GUIenabled;}
     52  void              setMode(e_mode mode) {_mode = mode;}
     53  void              setPort(int port);
     54  void              setPortCorr(int port);
     55  void              setCaster(bncCaster* caster) {_caster = caster;}
     56  const bncCaster*  caster() const {return _caster;}
     57  bool              dateAndTimeGPSSet() const;
     58  QDateTime         dateAndTimeGPS() const;
     59  void              setDateAndTimeGPS(QDateTime dateTime);
     60  void              setConfFileName(const QString& confFileName);
     61  QString           confFileName() const {return _confFileName;}
     62  void              writeRawData(const QByteArray& data, const QByteArray& staID,
     63                                const QByteArray& format);
     64  void             initCombination();
     65  void             stopCombination();
     66  const QString&   pgmName() {return _pgmName;}
     67  const QString&   userName() {return _userName;}
     68  QWidget*         mainWindow() const {return _mainWindow;};
     69  void             setMainWindow(QWidget* mainWindow){_mainWindow = mainWindow;}
     70  bool             GUIenabled() const {return _GUIenabled;}
     71  void             startPPP();
     72  void             stopPPP();
    7573
    7674  QMap<int, bncTableItem*> _uploadTableItems;
     
    111109  void printOutput(bool printFile, QTextStream* stream,
    112110                   const QString& strV2, const QString& strV3);
    113   void dumpCorrs(bncTime minTime, bncTime maxTime);
    114   void dumpCorrs();
    115   void dumpCorrs(const QList<t_clkCorr>& allCorrs);
    116111  void messagePrivate(const QByteArray& msg);
    117112  void checkEphemeris(gpsephemeris* oldEph, gpsephemeris* newEph);
    118113
    119   QSettings::SettingsMap   _settings;
    120   QFile*            _logFile;
    121   QTextStream*      _logStream;
    122   int               _logFileFlag;
    123   QMutex            _mutex;
    124   QMutex            _mutexMessage;
    125   QString           _ephPath;
    126   QString           _ephFileNameGPS;
    127   int               _rinexVers;
    128   QFile*            _ephFileGPS;
    129   QTextStream*      _ephStreamGPS;
    130   QFile*            _ephFileGlonass;
    131   QTextStream*      _ephStreamGlonass;
    132   QFile*            _ephFileGalileo;
    133   QTextStream*      _ephStreamGalileo;
    134   gpsephemeris*     _gpsEph[PRN_GPS_END - PRN_GPS_START + 1];
    135   glonassephemeris* _glonassEph[PRN_GLONASS_END - PRN_GLONASS_START + 1];
    136   galileoephemeris* _galileoEph[PRN_GALILEO_END - PRN_GALILEO_START + 1];
    137   QString           _userName;
    138   QString           _pgmName;
    139   int                 _port;
    140   QTcpServer*         _server;
    141   QList<QTcpSocket*>* _sockets;
    142   int                 _portCorr;
    143   QTcpServer*         _serverCorr;
    144   QList<QTcpSocket*>* _socketsCorr;
    145   int                 _portNMEA;
    146   QTcpServer*         _serverNMEA;
    147   QList<QTcpSocket*>* _socketsNMEA;
    148   bncCaster*          _caster;
    149   QMap<QString, bncTime> _lastCorrDumpTime;
    150   double              _waitCoTime;
    151   QMultiMap<bncTime, t_clkCorr>* _corrs;
    152   QString             _confFileName;
    153   QDate               _fileDate;
    154   bncRawFile*         _rawFile;
    155   int                 _GLOFreq[PRN_GLONASS_NUM];
    156   bncComb*            _bncComb;
    157   e_mode              _mode;
    158   QWidget*            _mainWindow;
    159   bool                _GUIenabled;
    160   QDateTime*          _dateAndTimeGPS;
    161   mutable QMutex      _mutexDateAndTimeGPS;
    162   BNC_PPP::t_pppMain* _pppMain;
     114  QSettings::SettingsMap _settings;
     115  QFile*                 _logFile;
     116  QTextStream*           _logStream;
     117  int                    _logFileFlag;
     118  QMutex                 _mutex;
     119  QMutex                 _mutexMessage;
     120  QString                _ephPath;
     121  QString                _ephFileNameGPS;
     122  int                    _rinexVers;
     123  QFile*                 _ephFileGPS;
     124  QTextStream*           _ephStreamGPS;
     125  QFile*                 _ephFileGlonass;
     126  QTextStream*           _ephStreamGlonass;
     127  QFile*                 _ephFileGalileo;
     128  QTextStream*           _ephStreamGalileo;
     129  gpsephemeris*          _gpsEph[PRN_GPS_END - PRN_GPS_START + 1];
     130  glonassephemeris*      _glonassEph[PRN_GLONASS_END - PRN_GLONASS_START + 1];
     131  galileoephemeris*      _galileoEph[PRN_GALILEO_END - PRN_GALILEO_START + 1];
     132  QString                _userName;
     133  QString                _pgmName;
     134  int                    _port;
     135  QTcpServer*            _server;
     136  QList<QTcpSocket*>*    _sockets;
     137  int                    _portCorr;
     138  QTcpServer*            _serverCorr;
     139  QList<QTcpSocket*>*    _socketsCorr;
     140  int                    _portNMEA;
     141  QTcpServer*            _serverNMEA;
     142  QList<QTcpSocket*>*    _socketsNMEA;
     143  bncCaster*             _caster;
     144  QString                _confFileName;
     145  QDate                  _fileDate;
     146  bncRawFile*            _rawFile;
     147  bncComb*               _bncComb;
     148  e_mode                 _mode;
     149  QWidget*               _mainWindow;
     150  bool                   _GUIenabled;
     151  QDateTime*             _dateAndTimeGPS;
     152  mutable QMutex         _mutexDateAndTimeGPS;
     153  BNC_PPP::t_pppMain*    _pppMain;
    163154};
    164155
  • trunk/BNC/src/bncsettings.cpp

    r5868 r6151  
    100100    setValue_p("corrIntr",            "1 day");
    101101    setValue_p("corrPort",            "");
    102     setValue_p("corrTime",            "5");
    103102    // Feed Engine
    104103    setValue_p("outPort",             "");
  • trunk/BNC/src/bncwindow.cpp

    r5993 r6151  
    247247  }
    248248  _corrPortLineEdit    = new QLineEdit(settings.value("corrPort").toString());
    249   _corrTimeSpinBox   = new QSpinBox();
    250   _corrTimeSpinBox->setMinimum(0);
    251   _corrTimeSpinBox->setMaximum(60);
    252   _corrTimeSpinBox->setSingleStep(1);
    253   _corrTimeSpinBox->setSuffix(" sec");
    254   _corrTimeSpinBox->setValue(settings.value("corrTime").toInt());
    255249
    256250  connect(_corrPathLineEdit, SIGNAL(textChanged(const QString &)),
     
    692686  _corrIntrComboBox->setMaximumWidth(9*ww);
    693687  _corrPortLineEdit->setMaximumWidth(9*ww);
    694   _corrTimeSpinBox->setMaximumWidth(9*ww);
    695688
    696689  cLayout->addWidget(new QLabel("Saving Broadcast Ephemeris correction files and correction output through IP port."),0,0,1,50);
     
    701694  cLayout->addWidget(new QLabel("Port"),                          3, 0);
    702695  cLayout->addWidget(_corrPortLineEdit,                           3, 1);
    703   cLayout->addWidget(new QLabel("  Wait for full corr epoch"),    3, 2, Qt::AlignRight);
    704   cLayout->addWidget(_corrTimeSpinBox,                            3, 3, Qt::AlignLeft);
    705696  cLayout->addWidget(new QLabel(" "),                             4, 0);
    706697  cLayout->addWidget(new QLabel(" "),                             5, 0);
     
    11551146  _outEphPortLineEdit->setWhatsThis(tr("BNC can produce ephemeris data in RINEX ASCII format on your local host through an IP port. Specify a port number here to activate this function."));
    11561147  _corrPortLineEdit->setWhatsThis(tr("BNC can produce Broadcast Ephemeris Corrections on your local host through an IP port. Specify a port number here to activate this function."));
    1157   _corrTimeSpinBox->setWhatsThis(tr("<p>Concerning output through IP port, BNC drops Broadcast Ephemeris Corrections received later than 'Wait for full corr epoch' seconds. A value of 2 to 5 seconds is recommended, depending on the latency of the incoming correction stream(s) and the delay acceptable to your real-time application.</p><p>Specifying a value of '0' means that BNC immediately outputs all incoming Broadcast Epemeris Corrections and does not drop any of them for latency reasons.</p>"));
    11581148  _rnxPathLineEdit->setWhatsThis(tr("Here you specify the path to where the RINEX Observation files will be stored. If the specified directory does not exist, BNC will not create RINEX Observation files."));
    11591149  _ephPathLineEdit->setWhatsThis(tr("Specify the path for saving Broadcast Ephemeris data as RINEX Navigation files. If the specified directory does not exist, BNC will not create RINEX Navigation files."));
     
    15881578  settings.setValue("corrIntr",    _corrIntrComboBox->currentText());
    15891579  settings.setValue("corrPort",    _corrPortLineEdit->text());
    1590   settings.setValue("corrTime",    _corrTimeSpinBox->value());
    15911580// Feed Engine
    15921581  settings.setValue("outPort",     _outPortLineEdit->text());
  • trunk/BNC/src/bncwindow.h

    r6040 r6151  
    165165    QCheckBox* _scanRTCMCheckBox;
    166166    QSpinBox*  _waitTimeSpinBox;
    167     QSpinBox*  _corrTimeSpinBox;
    168167    QComboBox* _obsRateComboBox;
    169168    QSpinBox*  _adviseFailSpinBox;
Note: See TracChangeset for help on using the changeset viewer.