Changeset 7889 in ntrip for trunk/BNC/src/bncwindow.cpp


Ignore:
Timestamp:
Apr 28, 2016, 1:04:18 PM (8 years ago)
Author:
stuerze
Message:

BNC's ephemeris upload is extended to allows an upload of more than one stream and to choose a single satellite system

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/bncwindow.cpp

    r7884 r7889  
    564564  // Upload RTCM3 Ephemeris
    565565  // ----------------------
    566   _uploadEphHostLineEdit       = new QLineEdit(settings.value("uploadEphHost").toString());
    567   _uploadEphPortLineEdit       = new QLineEdit(settings.value("uploadEphPort").toString());
    568   _uploadEphPasswordLineEdit   = new QLineEdit(settings.value("uploadEphPassword").toString());
    569   _uploadEphPasswordLineEdit->setEchoMode(QLineEdit::PasswordEchoOnEdit);
    570   _uploadEphMountpointLineEdit = new QLineEdit(settings.value("uploadEphMountpoint").toString());
    571   _uploadEphSampleSpinBox      = new QSpinBox;
    572   _uploadEphSampleSpinBox->setMinimum(5);
    573   _uploadEphSampleSpinBox->setMaximum(60);
    574   _uploadEphSampleSpinBox->setSingleStep(5);
    575   _uploadEphSampleSpinBox->setMaximumWidth(9*ww);
    576   _uploadEphSampleSpinBox->setValue(settings.value("uploadEphSample").toInt());
    577   _uploadEphSampleSpinBox->setSuffix(" sec");
    578   _uploadEphBytesCounter       = new bncBytesCounter;
     566  _uploadEphTable = new QTableWidget(0,6);
     567  _uploadEphTable->setColumnCount(6);
     568  _uploadEphTable->setRowCount(0);
     569  _uploadEphTable->setHorizontalHeaderLabels(QString("Host, Port, Mount, Password, System, bytes").split(","));
     570  _uploadEphTable->setSelectionMode(QAbstractItemView::ExtendedSelection);
     571  _uploadEphTable->setSelectionBehavior(QAbstractItemView::SelectRows);
     572  _uploadEphTable->horizontalHeader()->resizeSection( 0,13*ww);
     573  _uploadEphTable->horizontalHeader()->resizeSection( 1, 5*ww);
     574  _uploadEphTable->horizontalHeader()->resizeSection( 2, 8*ww);
     575  _uploadEphTable->horizontalHeader()->resizeSection( 3, 8*ww);
     576  _uploadEphTable->horizontalHeader()->resizeSection( 4,10*ww);
     577  _uploadEphTable->horizontalHeader()->resizeSection( 5,12*ww);
     578  _uploadEphTable->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
     579  _uploadEphTable->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft);
     580
     581  connect(_uploadEphTable, SIGNAL(itemSelectionChanged()),
     582          SLOT(slotBncTextChanged()));
     583
     584  QPushButton* addUploadEphRowButton = new QPushButton("Add Row");
     585  addUploadEphRowButton->setMaximumWidth(9*ww);
     586  QPushButton* delUploadEphRowButton = new QPushButton("Del Row");
     587  delUploadEphRowButton->setMaximumWidth(9*ww);
     588
     589  _uploadSamplRtcmEphSpinBox = new QSpinBox;
     590  _uploadSamplRtcmEphSpinBox->setMinimum(0);
     591  _uploadSamplRtcmEphSpinBox->setMaximum(60);
     592  _uploadSamplRtcmEphSpinBox->setSingleStep(5);
     593  _uploadSamplRtcmEphSpinBox->setMaximumWidth(9*ww);
     594  _uploadSamplRtcmEphSpinBox->setValue(settings.value("uploadSamplRtcmEph").toInt());
     595  _uploadSamplRtcmEphSpinBox->setSuffix(" sec");
     596
     597  iRowT = _uploadEphTable->rowCount();
     598  if (iRowT > 0) {
     599    enableWidget(true, _uploadSamplRtcmEphSpinBox);
     600  }
     601  else {
     602    enableWidget(false, _uploadSamplRtcmEphSpinBox);
     603  }
    579604
    580605  // Canvas with Editable Fields
     
    11911216  // Upload Layout (Ephemeris)
    11921217  // -------------------------
    1193   QGridLayout* uploadLayoutEph = new QGridLayout;
    1194 
    1195   uploadLayoutEph->setColumnMinimumWidth(0, 9*ww);
    1196   _uploadEphPortLineEdit->setMaximumWidth(9*ww);
    1197   _uploadEphPasswordLineEdit->setMaximumWidth(9*ww);
    1198   _uploadEphMountpointLineEdit->setMaximumWidth(12*ww);
    1199 
    1200   uploadLayoutEph->addWidget(new QLabel("Upload concatenated RTCMv3 Broadcast Ephemeris to caster.<br>"), 0, 0, 1, 50);
    1201   uploadLayoutEph->addWidget(new QLabel("Host"),                  1, 0);
    1202   uploadLayoutEph->addWidget(_uploadEphHostLineEdit,              1, 1, 1, 3);
    1203   uploadLayoutEph->addWidget(new QLabel("  Port"),                1, 4, Qt::AlignRight);
    1204   uploadLayoutEph->addWidget(_uploadEphPortLineEdit,              1, 5, 1, 1);
    1205   uploadLayoutEph->addWidget(new QLabel("Mountpoint           "), 2, 0);
    1206   uploadLayoutEph->addWidget(_uploadEphMountpointLineEdit,        2, 1);
    1207   uploadLayoutEph->addWidget(new QLabel("          Password"),    2, 2, Qt::AlignRight);
    1208   uploadLayoutEph->addWidget(_uploadEphPasswordLineEdit,          2, 3);
    1209   uploadLayoutEph->addWidget(new QLabel("Sampling"),              3, 0);
    1210   uploadLayoutEph->addWidget(_uploadEphSampleSpinBox,             3, 1);
    1211   uploadLayoutEph->addWidget(new QLabel("Uploaded"),              4, 0);
    1212   uploadLayoutEph->addWidget(_uploadEphBytesCounter,              4, 1);
    1213   uploadLayoutEph->setRowStretch(5, 999);
     1218  QGridLayout* uploadHlpLayoutEph = new QGridLayout();
     1219
     1220  connect(addUploadEphRowButton, SIGNAL(clicked()), this, SLOT(slotAddUploadEphRow()));
     1221  connect(delUploadEphRowButton, SIGNAL(clicked()), this, SLOT(slotDelUploadEphRow()));
     1222
     1223  uploadHlpLayoutEph->addWidget(addUploadEphRowButton,               0, 0);
     1224  uploadHlpLayoutEph->addWidget(delUploadEphRowButton,               0, 1);
     1225  uploadHlpLayoutEph->addWidget(new QLabel("     Sampling"),         0, 2, Qt::AlignRight);
     1226  uploadHlpLayoutEph->addWidget(_uploadSamplRtcmEphSpinBox,          0, 3);
     1227
     1228  QBoxLayout* uploadLayoutEph = new QBoxLayout(QBoxLayout::TopToBottom);
     1229  populateUploadEphTable();
     1230
     1231  uploadLayoutEph->addWidget(new QLabel("Upload concatenated RTCMv3 Broadcast Ephemeris to caster.<br>"));
     1232  uploadLayoutEph->addWidget(_uploadEphTable);
     1233  uploadLayoutEph->addLayout(uploadHlpLayoutEph);
    12141234
    12151235  uploadEphgroup->setLayout(uploadLayoutEph);
    12161236
    1217   connect(_uploadEphHostLineEdit, SIGNAL(textChanged(const QString &)),
    1218           this, SLOT(slotBncTextChanged()));
    12191237
    12201238  // Main Layout
     
    13721390  _uploadTable->setWhatsThis(tr("<p>BNC can upload clock and orbit corrections to Broadcast Ephemeris (Broadcast Corrections) in RTCM Version 3 SSR format. You may have a situation where clocks and orbits come from an external Real-time Network Engine (1) or a situation where clock and orbit corrections are combined within BNC (2).</p><p>(1) BNC identifies a stream as coming from a Real-time Network Engine if its format is specified as 'RTNET' and hence its decoder string in the 'Streams' canvas is 'RTNET'. It encodes and uploads that stream to the specified Ntrip Broadcaster Host and Port</p><p>(2) BNC understands that it is expected to encode and upload combined Broadcast Ephemeris Corrections if you specify correction streams in the 'Combine Corrections' table.</p><p>To fill the 'Upload Corrections' table, hit the 'Add Row' button, double click on the 'Host' field to enter the IP or URL of an Ntrip Broadcaster and hit Enter. Then double click on the 'Port', 'Mount' and 'Password' fields to enter the Ntrip Broadcaster IP port (default is 80), the mountpoint and the stream upload password. An empty 'Host' option field means that you don't want to upload corrections.</p><p>Select a target coordinate reference System (e.g. IGS08) for outgoing clock and orbit corrections.</p><p>By default orbit and clock corrections refer to Antenna Phase Center (APC). Tick 'CoM' to refer uploaded corrections to Center of Mass instead of APC.</p><p>Specify a path for saving generated Broadcast Corrections plus Broadcast Ephemeris as SP3 orbit files. If the specified directory does not exist, BNC will not create such files. The following is a path example for a Linux system: /home/user/BNC${GPSWD}.sp3<br>Note that '${GPSWD}' produces the GPS Week and Day number in the filename.</p><p>Specify a path for saving generated Broadcast Correction clocks plus Broadcast Ephemeris clocks as Clock RINEX files. If the specified directory does not exist, BNC will not create Clock RINEX files. The following is a path example for a Linux system: /home/user/BNC${GPSWD}.clk<br>Note that '${GPSWD}' produces the GPS Week and Day number in the filename.</p><p>Finally, specify a SSR Provider ID (issued by RTCM), SSR Solution ID, and SSR Issue of Data number.</p><p>In case the 'Combine Corrections' table contains only one Broadcast Correction stream, BNC will add that stream content to the Broadcast Ephemeris to save results in files specified via SP3 and/or Clock RINEX file path. You should then define only the SP3 and Clock RINEX file path and no further option in the 'Upload Corrections' table.</p>"));
    13731391  addUploadRowButton->setWhatsThis(tr("<p>Hit 'Add Row' button to add another line to the 'Upload Corrections' table.</p>"));
    1374   delUploadRowButton->setWhatsThis(tr("<p>Hit 'Del Row' button to delete the highlighted line(s) from the Upload Corrections' table.</p>"));
     1392  delUploadRowButton->setWhatsThis(tr("<p>Hit 'Del Row' button to delete the highlighted line(s) from the 'Upload Corrections' table.</p>"));
    13751393  _uploadIntrComboBox->setWhatsThis(tr("<p>Select the length of the SP3 and Clock RINEX files.</p>"));
    13761394  _uploadSamplRtcmEphCorrSpinBox->setWhatsThis(tr("<p>Select a stream's orbit correction sampling interval in seconds.</p><p>A value of zero '0' tells BNC to upload all available orbit and clock correction samples together in combined messages.</p>"));
     
    13821400  // WhatsThis, Upload Ephemeris
    13831401  // ---------------------------
    1384   _uploadEphHostLineEdit->setWhatsThis(tr("<p>BNC can upload a Broadcast Ephemeris stream in RTCM Version 3 format. Specify the IP number or URL of an Ntrip Broadcaster to upload the stream.</p><p>An empty option field means that you don't want to upload Broadcast Ephemeris.</p>"));
    1385   _uploadEphPortLineEdit->setWhatsThis(tr("<p>Specify the IP port of the Ntrip Broadcaster to upload the Broadcast Ephemeris stream. Default is port 80.</p>"));
    1386   _uploadEphMountpointLineEdit->setWhatsThis(tr("<p>Specify a mountpoint for uploading the Broadcast Ephemeris stream.</p>"));
    1387   _uploadEphPasswordLineEdit->setWhatsThis(tr("<p>Specify the stream upload password protecting the mounpoint on the Ntrip Broadcaster.</p>"));
    1388   _uploadEphSampleSpinBox->setWhatsThis(tr("<p>Select the Broadcast Ephemeris sampling interval in seconds.</p><p>Default is '5', meaning that a complete set of Broadcast Ephemeris is uploaded every 5 seconds.</p>"));
    1389   _uploadEphBytesCounter->setWhatsThis(tr("<p>BNC shows the amount of data uploaded via this stream.</p>"));
    1390 // weber
     1402  _uploadEphTable->setWhatsThis(tr("<p>BNC can upload a Broadcast Ephemeris stream in RTCM Version 3 format. Specify the IP number or URL of an Ntrip Broadcaster to upload the respective stream.</p>"));
     1403  addUploadEphRowButton->setWhatsThis(tr("<p>Hit 'Add Row' button to add another line to the 'Upload Ephemeris' table.</p>"));
     1404  delUploadEphRowButton->setWhatsThis(tr("<p>Hit 'Del Row' button to delete the highlighted line(s) from the 'Upload Ephemeris' table.</p>"));
     1405  _uploadSamplRtcmEphSpinBox->setWhatsThis(tr("<p>Select the Broadcast Ephemeris sampling interval in seconds.</p><p>Default is '5', meaning that a complete set of Broadcast Ephemeris is uploaded every 5 seconds.</p>"));
    13911406
    13921407  // WhatsThis, Streams Canvas
     
    14941509  _mountPointsTable->deleteLater();
    14951510  delete _log;
     1511  delete _loggroup;
    14961512  _cmbTable->deleteLater();
    14971513  delete _cmbMaxresLineEdit;
    14981514  delete _cmbUseGlonass;
    14991515  delete _cmbSamplSpinBox;
    1500   delete _cmbMethodComboBox;
     1516  delete _cmbMethodComboBox;;
     1517  _uploadEphTable->deleteLater();
     1518  delete _uploadSamplRtcmEphCorrSpinBox;
    15011519  _uploadTable->deleteLater();
    15021520  delete _uploadIntrComboBox;
    15031521  delete _uploadAntexFile;
    1504   delete _uploadSamplRtcmEphCorrSpinBox;
     1522  delete _uploadSamplRtcmEphSpinBox;
    15051523  delete _uploadSamplSp3SpinBox;
    15061524  delete _uploadSamplClkRnxSpinBox;
    1507   delete _uploadEphHostLineEdit;
    1508   delete _uploadEphPortLineEdit;
    1509   delete _uploadEphPasswordLineEdit;
    1510   delete _uploadEphMountpointLineEdit;
    1511   delete _uploadEphSampleSpinBox;
    1512   delete _uploadEphBytesCounter;
    1513   delete _loggroup;
    15141525  delete _reqcActionComboBox;
    15151526  delete _reqcObsFileChooser;
     
    18471858    if (!hlp.isEmpty()) {
    18481859      uploadMountpointsOut << hlp;
     1860    }
     1861  }
     1862
     1863  QStringList uploadEphMountpointsOut;
     1864  for (int iRow = 0; iRow < _uploadEphTable->rowCount(); iRow++) {
     1865    QString hlp;
     1866    for (int iCol = 0; iCol < _uploadEphTable->columnCount(); iCol++) {
     1867      if (_uploadEphTable->cellWidget(iRow, iCol) &&
     1868          (iCol == 3 || iCol == 4 || iCol == 5)) {
     1869        if      (iCol == 3) {
     1870          QLineEdit* passwd = (QLineEdit*)(_uploadEphTable->cellWidget(iRow, iCol));
     1871          hlp += passwd->text() + ",";
     1872        }
     1873        else if (iCol == 4) {
     1874          QComboBox* system = (QComboBox*)(_uploadEphTable->cellWidget(iRow, iCol));
     1875          hlp += system->currentText() + ",";
     1876        }
     1877      }
     1878      else if (_uploadEphTable->item(iRow, iCol)) {
     1879        hlp += _uploadEphTable->item(iRow, iCol)->text() + ",";
     1880      }
     1881    }
     1882    if (!hlp.isEmpty()) {
     1883      uploadEphMountpointsOut << hlp;
    18491884    }
    18501885  }
     
    19561991  settings.setValue("uploadAntexFile",        _uploadAntexFile->fileName());
    19571992// Upload Ephemeris
    1958   settings.setValue("uploadEphHost",      _uploadEphHostLineEdit->text());
    1959   settings.setValue("uploadEphPort",      _uploadEphPortLineEdit->text());
    1960   settings.setValue("uploadEphMountpoint",_uploadEphMountpointLineEdit->text());
    1961   settings.setValue("uploadEphPassword",  _uploadEphPasswordLineEdit->text());
    1962   settings.setValue("uploadEphSample",    _uploadEphSampleSpinBox->value());
     1993  if (!uploadEphMountpointsOut.isEmpty()) {
     1994    settings.setValue("uploadEphMountpointsOut", uploadEphMountpointsOut);
     1995  }
     1996  else {
     1997    settings.setValue("uploadEphMountpointsOut", "");
     1998  }
     1999  settings.setValue("uploadSamplRtcmEph", _uploadSamplRtcmEphSpinBox->value());
    19632000
    19642001  if (_caster) {
     
    20682105  if (_uploadTable->rowCount() > 0)
    20692106      BNC_CORE->slotMessage("Panel 'Upload Corrections' active", true);
    2070   if (!_uploadEphHostLineEdit->text().isEmpty())
     2107  if (_uploadEphTable->rowCount() > 0)
    20712108      BNC_CORE->slotMessage("Panel 'UploadEphemeris' active", true);
    20722109
     
    20952132
    20962133  _casterEph = new bncEphUploadCaster();
    2097   connect(_casterEph, SIGNAL(newBytes(QByteArray,double)),
    2098           _uploadEphBytesCounter, SLOT(slotNewBytes(QByteArray,double)));
    20992134}
    21002135
     
    24512486  }
    24522487
    2453   // Enable/disable Broadcast Ephemerides
    2454   // ------------------------------------
    2455   if (sender() == 0 || sender() == _uploadEphHostLineEdit) {
    2456     enable = !_uploadEphHostLineEdit->text().isEmpty();
    2457     enableWidget(enable, _uploadEphPortLineEdit);
    2458     enableWidget(enable, _uploadEphMountpointLineEdit);
    2459     enableWidget(enable, _uploadEphPasswordLineEdit);
    2460     enableWidget(enable, _uploadEphSampleSpinBox);
    2461   }
    2462 
    24632488  // Combine Corrections
    24642489  // -------------------
     
    24952520    enableWidget(false, _uploadSamplSp3SpinBox);
    24962521    enableWidget(false, _uploadAntexFile);
     2522  }
     2523
     2524  // Upload(eph)
     2525  // -----------
     2526  iRow = _uploadEphTable->rowCount();
     2527  if (iRow > 0) {
     2528    enableWidget(true, _uploadSamplRtcmEphSpinBox);
     2529  }
     2530  else {
     2531    enableWidget(false, _uploadSamplRtcmEphSpinBox);
    24972532  }
    24982533
     
    27202755}
    27212756
     2757//
     2758////////////////////////////////////////////////////////////////////////////
     2759void bncWindow::slotAddUploadEphRow() {
     2760  int iRow = _uploadEphTable->rowCount();
     2761  _uploadEphTable->insertRow(iRow);
     2762  for (int iCol = 0; iCol < _uploadEphTable->columnCount(); iCol++) {
     2763    if      (iCol == 3) {
     2764      QLineEdit* passwd = new QLineEdit();
     2765      passwd->setFrame(false);
     2766      passwd->setEchoMode(QLineEdit::PasswordEchoOnEdit);
     2767      _uploadEphTable->setCellWidget(iRow, iCol, passwd);
     2768    }
     2769    else if (iCol == 4) {
     2770      QComboBox* system = new QComboBox();
     2771      system->setEditable(false);
     2772      system->addItems(QString("ALL,GPS,GLONASS,Galileo,BDS,QZSS,SBAS").split(","));
     2773      system->setFrame(false);
     2774      _uploadEphTable->setCellWidget(iRow, iCol, system);
     2775    }
     2776    else if (iCol == 5) {
     2777      bncTableItem* bncIt = new bncTableItem();
     2778      bncIt->setFlags(bncIt->flags() & ~Qt::ItemIsEditable);
     2779      _uploadEphTable->setItem(iRow, iCol, bncIt);
     2780      BNC_CORE->_uploadTableItems[iRow] = bncIt;
     2781    }
     2782    else {
     2783      _uploadEphTable->setItem(iRow, iCol, new QTableWidgetItem(""));
     2784    }
     2785  }
     2786}
     2787
     2788//
     2789////////////////////////////////////////////////////////////////////////////
     2790void bncWindow::slotDelUploadEphRow() {
     2791  BNC_CORE->_uploadTableItems.clear();
     2792  int nRows = _uploadEphTable->rowCount();
     2793  bool flg[nRows];
     2794  for (int iRow = 0; iRow < nRows; iRow++) {
     2795    if (_uploadEphTable->isItemSelected(_uploadEphTable->item(iRow,1))) {
     2796      flg[iRow] = true;
     2797    }
     2798    else {
     2799      flg[iRow] = false;
     2800    }
     2801  }
     2802  for (int iRow = nRows-1; iRow >= 0; iRow--) {
     2803    if (flg[iRow]) {
     2804      _uploadEphTable->removeRow(iRow);
     2805    }
     2806  }
     2807  for (int iRow = 0; iRow < _uploadTable->rowCount(); iRow++) {
     2808    BNC_CORE->_uploadTableItems[iRow] =
     2809                                (bncTableItem*) _uploadEphTable->item(iRow, 5);
     2810  }
     2811  nRows = _uploadEphTable->rowCount();
     2812  if (nRows < 1) {
     2813    enableWidget(false, _uploadSamplRtcmEphSpinBox);
     2814  }
     2815}
     2816
     2817//
     2818////////////////////////////////////////////////////////////////////////////
     2819void bncWindow::populateUploadEphTable() {
     2820  for (int iRow = _uploadEphTable->rowCount()-1; iRow >=0; iRow--) {
     2821    _uploadEphTable->removeRow(iRow);
     2822  }
     2823
     2824  bncSettings settings;
     2825
     2826  int iRow = -1;
     2827  QListIterator<QString> it(settings.value("uploadEphMountpointsOut").toStringList());
     2828  while (it.hasNext()) {
     2829    QStringList hlp = it.next().split(",");
     2830    if (hlp.size() > 4) {
     2831      ++iRow;
     2832      _uploadEphTable->insertRow(iRow);
     2833    }
     2834    for (int iCol = 0; iCol < hlp.size(); iCol++) {
     2835      if      (iCol == 3) {
     2836        QLineEdit* passwd = new QLineEdit();
     2837        passwd->setFrame(false);
     2838        passwd->setEchoMode(QLineEdit::PasswordEchoOnEdit);
     2839        passwd->setText(hlp[iCol]);
     2840        _uploadEphTable->setCellWidget(iRow, iCol, passwd);
     2841      }
     2842      else if (iCol == 4) {
     2843        QComboBox* system = new QComboBox();
     2844        system->setEditable(false);
     2845        system->addItems(QString("ALL,GPS,GLONASS,Galileo,BDS,QZSS,SBAS").split(","));
     2846        system->setFrame(false);
     2847        system->setCurrentIndex(system->findText(hlp[iCol]));
     2848        _uploadEphTable->setCellWidget(iRow, iCol, system);
     2849      }
     2850      else if (iCol == 5) {
     2851        bncTableItem* bncIt = new bncTableItem();
     2852        bncIt->setFlags(bncIt->flags() & ~Qt::ItemIsEditable);
     2853        _uploadEphTable->setItem(iRow, iCol, bncIt);
     2854        BNC_CORE->_uploadTableItems[iRow] = bncIt;
     2855      }
     2856      else {
     2857        _uploadEphTable->setItem(iRow, iCol, new QTableWidgetItem(hlp[iCol]));
     2858      }
     2859    }
     2860  }
     2861}
     2862
     2863
    27222864// Progress Bar Change
    27232865////////////////////////////////////////////////////////////////////////////
Note: See TracChangeset for help on using the changeset viewer.