Changeset 3335 in ntrip
- Timestamp:
- Jul 19, 2011, 4:23:19 PM (14 years ago)
- Location:
- trunk/BNC
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/bncrinex.cpp
r3326 r3335 122 122 123 123 QStringList table; 124 bncTableDlg::getFullTable(_mountPoint.hos t(), _mountPoint.port(),125 table, _reloadTable); 124 bncTableDlg::getFullTable(_ntripVersion, _mountPoint.host(), 125 _mountPoint.port(), table, _reloadTable); 126 126 QString net; 127 127 QStringListIterator it(table); -
trunk/BNC/bnctabledlg.cpp
r3294 r3335 44 44 #include "bncgetthread.h" 45 45 #include "bncnetqueryv1.h" 46 #include "bncnetqueryv2.h" 46 47 #include "bncsettings.h" 47 48 #include "bncmap.h" … … 91 92 92 93 _ntripVersionComboBox = new QComboBox(); 93 _ntripVersionComboBox->addItems(QString("1,2,R,U").split(",")); 94 _ntripVersionComboBox->addItems(QString("1,2,2s,R,U").split(",")); 94 95 int kk = _ntripVersionComboBox->findText(settings.value("ntripVersion").toString()); 95 96 if (kk != -1) { … … 180 181 // Read full caster table (static) 181 182 //////////////////////////////////////////////////////////////////////////// 182 t_irc bncTableDlg::getFullTable(const QString& casterHost, 183 t_irc bncTableDlg::getFullTable(const QString& ntripVersion, 184 const QString& casterHost, 183 185 int casterPort, QStringList& allLines, 184 186 bool alwaysRead) { … … 196 198 allLines.clear(); 197 199 200 bncNetQuery* query = 0; 201 if (ntripVersion == "2" || ntripVersion == "2s") { 202 query = new bncNetQueryV2(); 203 } 204 else { 205 query = new bncNetQueryV1(); 206 } 207 198 208 QUrl url; 199 209 url.setHost(casterHost); 200 210 url.setPort(casterPort); 201 url.setScheme("http");202 211 url.setPath("/"); 203 204 bncNetQueryV1 query; 212 if (ntripVersion == "2s") { 213 url.setScheme("https"); 214 } 215 else { 216 url.setScheme("http"); 217 } 218 205 219 QByteArray outData; 206 query .waitForRequestResult(url, outData);207 if (query .status() == bncNetQuery::finished) {220 query->waitForRequestResult(url, outData); 221 if (query->status() == bncNetQuery::finished) { 208 222 QTextStream in(outData); 209 223 QString line = in.readLine(); … … 213 227 } 214 228 allTables.insert(casterHost, allLines); 229 delete query; 215 230 return success; 216 231 } 217 232 else { 233 delete query; 218 234 return failure; 219 235 } … … 228 244 _buttonCasterTable->setEnabled(false); 229 245 230 if ( getFullTable(_casterHostComboBox->currentText(), 246 if ( getFullTable(_ntripVersionComboBox->currentText(), 247 _casterHostComboBox->currentText(), 231 248 _casterPortLineEdit->text().toInt(), 232 249 _allLines, true) != success ) { … … 362 379 363 380 bncSettings settings; 364 settings.setValue("ntripVersion", _ntripVersionComboBox->currentText()); 381 QString ntripVersion = _ntripVersionComboBox->currentText(); 382 settings.setValue("ntripVersion", ntripVersion); 365 383 QUrl url; 366 url.setScheme("http"); 384 if (ntripVersion == "2s") { 385 url.setScheme("https"); 386 } 387 else { 388 url.setScheme("http"); 389 } 367 390 url.setHost(_casterHostComboBox->currentText()); 368 391 url.setPort(_casterPortLineEdit->text().toInt()); … … 380 403 QString longitude = _table->item(ir,9)->text(); 381 404 QString nmea = _table->item(ir,10)->text(); 382 QString ntripVersion = _ntripVersionComboBox->currentText();383 405 format.replace(" ", "_"); 384 406 if (_table->isItemSelected(item)) { … … 424 446 _buttonSelect->setEnabled(false); 425 447 426 bncCasterTableDlg* dlg = new bncCasterTableDlg(this); 448 bncCasterTableDlg* dlg = 449 new bncCasterTableDlg(_ntripVersionComboBox->currentText(), this); 427 450 dlg->move(this->pos().x()+50, this->pos().y()+50); 428 451 connect(dlg, SIGNAL(newCaster(QString, QString)), … … 504 527 // Caster table 505 528 //////////////////////////////////////////////////////////////////////////// 506 bncCasterTableDlg::bncCasterTableDlg(QWidget* parent) : 529 bncCasterTableDlg::bncCasterTableDlg(const QString& ntripVersion, 530 QWidget* parent) : 507 531 QDialog(parent) { 508 532 … … 517 541 url.setPath("/"); 518 542 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 520 551 QByteArray outData; 521 query .waitForRequestResult(url, outData);552 query->waitForRequestResult(url, outData); 522 553 523 554 QStringList lines; 524 if (query .status() == bncNetQuery::finished) {555 if (query->status() == bncNetQuery::finished) { 525 556 QTextStream in(outData); 526 557 QString line = in.readLine(); … … 535 566 } 536 567 } 568 569 delete query; 537 570 538 571 if (lines.size() > 0) { -
trunk/BNC/bnctabledlg.h
r3293 r3335 36 36 37 37 public: 38 bncCasterTableDlg(QWidget* parent); 38 bncCasterTableDlg(const QString& ntripVersion, QWidget* parent); 39 39 ~bncCasterTableDlg(); 40 40 … … 59 59 bncTableDlg(QWidget* parent); 60 60 ~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, 62 63 QStringList& allLines, bool alwaysRead = true); 63 64
Note:
See TracChangeset
for help on using the changeset viewer.