Changeset 3335 in ntrip


Ignore:
Timestamp:
Jul 19, 2011, 4:23:19 PM (11 years ago)
Author:
mervart
Message:
 
Location:
trunk/BNC
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/bncrinex.cpp

    r3326 r3335  
    122122
    123123  QStringList table;
    124   bncTableDlg::getFullTable(_mountPoint.host(), _mountPoint.port(),
    125                             table, _reloadTable);
     124  bncTableDlg::getFullTable(_ntripVersion, _mountPoint.host(),
     125                            _mountPoint.port(), table, _reloadTable);
    126126  QString net;
    127127  QStringListIterator it(table);
  • trunk/BNC/bnctabledlg.cpp

    r3294 r3335  
    4444#include "bncgetthread.h"
    4545#include "bncnetqueryv1.h"
     46#include "bncnetqueryv2.h"
    4647#include "bncsettings.h"
    4748#include "bncmap.h"
     
    9192
    9293  _ntripVersionComboBox = new QComboBox();
    93   _ntripVersionComboBox->addItems(QString("1,2,R,U").split(","));
     94  _ntripVersionComboBox->addItems(QString("1,2,2s,R,U").split(","));
    9495  int kk = _ntripVersionComboBox->findText(settings.value("ntripVersion").toString());
    9596  if (kk != -1) {
     
    180181// Read full caster table (static)
    181182////////////////////////////////////////////////////////////////////////////
    182 t_irc bncTableDlg::getFullTable(const QString& casterHost,
     183t_irc bncTableDlg::getFullTable(const QString& ntripVersion,
     184                                const QString& casterHost,
    183185                                int casterPort, QStringList& allLines,
    184186                                bool alwaysRead) {
     
    196198  allLines.clear();
    197199
     200  bncNetQuery* query = 0;
     201  if (ntripVersion == "2" || ntripVersion == "2s") {
     202    query = new bncNetQueryV2();
     203  }
     204  else {
     205    query = new bncNetQueryV1();
     206  }
     207
    198208  QUrl url;
    199209  url.setHost(casterHost);
    200210  url.setPort(casterPort);
    201   url.setScheme("http");
    202211  url.setPath("/");
    203 
    204   bncNetQueryV1 query;
     212  if (ntripVersion == "2s") {
     213    url.setScheme("https");
     214  }
     215  else {
     216    url.setScheme("http");
     217  }
     218
    205219  QByteArray outData;
    206   query.waitForRequestResult(url, outData);
    207   if (query.status() == bncNetQuery::finished) {
     220  query->waitForRequestResult(url, outData);
     221  if (query->status() == bncNetQuery::finished) {
    208222    QTextStream in(outData);
    209223    QString line = in.readLine();
     
    213227    }
    214228    allTables.insert(casterHost, allLines);
     229    delete query;
    215230    return success;
    216231  }
    217232  else {
     233    delete query;
    218234    return failure;
    219235  }
     
    228244  _buttonCasterTable->setEnabled(false);
    229245
    230   if ( getFullTable(_casterHostComboBox->currentText(),
     246  if ( getFullTable(_ntripVersionComboBox->currentText(),
     247                    _casterHostComboBox->currentText(),
    231248                    _casterPortLineEdit->text().toInt(),
    232249                    _allLines, true) != success ) {
     
    362379
    363380  bncSettings settings;
    364   settings.setValue("ntripVersion", _ntripVersionComboBox->currentText());
     381  QString ntripVersion = _ntripVersionComboBox->currentText();
     382  settings.setValue("ntripVersion", ntripVersion);
    365383  QUrl url;
    366   url.setScheme("http");
     384  if (ntripVersion == "2s") {
     385    url.setScheme("https");
     386  }
     387  else {
     388    url.setScheme("http");
     389  }
    367390  url.setHost(_casterHostComboBox->currentText());
    368391  url.setPort(_casterPortLineEdit->text().toInt());
     
    380403      QString        longitude = _table->item(ir,9)->text();
    381404      QString             nmea = _table->item(ir,10)->text();
    382       QString     ntripVersion = _ntripVersionComboBox->currentText();
    383405      format.replace(" ", "_");
    384406      if (_table->isItemSelected(item)) {
     
    424446  _buttonSelect->setEnabled(false);
    425447
    426   bncCasterTableDlg* dlg = new bncCasterTableDlg(this);
     448  bncCasterTableDlg* dlg =
     449          new bncCasterTableDlg(_ntripVersionComboBox->currentText(), this);
    427450  dlg->move(this->pos().x()+50, this->pos().y()+50);
    428451  connect(dlg, SIGNAL(newCaster(QString, QString)),
     
    504527// Caster table
    505528////////////////////////////////////////////////////////////////////////////
    506 bncCasterTableDlg::bncCasterTableDlg(QWidget* parent) :
     529bncCasterTableDlg::bncCasterTableDlg(const QString& ntripVersion,
     530                                     QWidget* parent) :
    507531   QDialog(parent) {
    508532
     
    517541  url.setPath("/");
    518542
    519   bncNetQueryV1 query;
     543  bncNetQuery* query = 0;
     544  if (ntripVersion == "2" || ntripVersion == "2s") {
     545    query = new bncNetQueryV2();
     546  }
     547  else {
     548    query = new bncNetQueryV1();
     549  }
     550
    520551  QByteArray outData;
    521   query.waitForRequestResult(url, outData);
     552  query->waitForRequestResult(url, outData);
    522553
    523554  QStringList lines;
    524   if (query.status() == bncNetQuery::finished) {
     555  if (query->status() == bncNetQuery::finished) {
    525556    QTextStream in(outData);
    526557    QString line = in.readLine();
     
    535566    }
    536567  }
     568
     569  delete query;
    537570
    538571  if (lines.size() > 0) {
  • trunk/BNC/bnctabledlg.h

    r3293 r3335  
    3636
    3737  public:
    38     bncCasterTableDlg(QWidget* parent);
     38    bncCasterTableDlg(const QString& ntripVersion, QWidget* parent);
    3939    ~bncCasterTableDlg();
    4040
     
    5959    bncTableDlg(QWidget* parent);
    6060    ~bncTableDlg();
    61     static t_irc getFullTable(const QString& casterHost, int casterPort,
     61    static t_irc getFullTable(const QString& ntripVersion,
     62                              const QString& casterHost, int casterPort,
    6263                              QStringList& allLines, bool alwaysRead = true);
    6364
Note: See TracChangeset for help on using the changeset viewer.