Changeset 1170 in ntrip
- Timestamp:
- Oct 27, 2008, 3:35:54 PM (17 years ago)
- Location:
- trunk/BNC
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/BNC/bnccaster.cpp ¶
r740 r1170 44 44 45 45 #include "bnccaster.h" 46 #include "bncapp.h" 46 47 #include "bncgetthread.h" 47 48 #include "bncutils.h" … … 90 91 _lastDumpSec = 0; 91 92 92 _samplingRate = settings.value("binSampl").toInt(); 93 _waitTime = settings.value("waitTime").toInt(); 94 if (_waitTime < 1) { 95 _waitTime = 1; 96 } 93 _confTimer = 0; 97 94 } 98 95 … … 191 188 _staIDs.push_back(getThread->staID()); 192 189 _threads.push_back(getThread); 190 191 getThread->start(); 193 192 } 194 193 … … 308 307 } 309 308 } 309 310 // Reread configuration 311 //////////////////////////////////////////////////////////////////////////// 312 void bncCaster::slotReadMountpoints() { 313 314 QSettings settings; 315 316 // Reread several options 317 // ---------------------- 318 _samplingRate = settings.value("binSampl").toInt(); 319 _waitTime = settings.value("waitTime").toInt(); 320 if (_waitTime < 1) { 321 _waitTime = 1; 322 } 323 324 // Add new mountpoints 325 // ------------------- 326 int iMount = -1; 327 QListIterator<QString> it(settings.value("mountPoints").toStringList()); 328 while (it.hasNext()) { 329 ++iMount; 330 QStringList hlp = it.next().split(" "); 331 if (hlp.size() <= 1) continue; 332 QUrl url(hlp[0]); 333 334 // Does it already exist? 335 // ---------------------- 336 bool existFlg = false; 337 QListIterator<bncGetThread*> iTh(_threads); 338 while (iTh.hasNext()) { 339 bncGetThread* thread = iTh.next(); 340 if (thread->mountPoint() == url) { 341 existFlg = true; 342 break; 343 } 344 } 345 346 // New bncGetThread 347 // ---------------- 348 if (!existFlg) { 349 QByteArray format = hlp[1].toAscii(); 350 QByteArray latitude = hlp[2].toAscii(); 351 QByteArray longitude = hlp[3].toAscii(); 352 QByteArray nmea = hlp[4].toAscii(); 353 354 bncGetThread* getThread = new bncGetThread(url, format, latitude, 355 longitude, nmea, iMount); 356 357 bncApp* app = (bncApp*) qApp; 358 app->connect(getThread, SIGNAL(newMessage(QByteArray)), 359 app, SLOT(slotMessage(const QByteArray))); 360 361 std::cout << "newThread " << getThread->staID().data() << std::endl; 362 363 addGetThread(getThread); 364 } 365 } 366 367 // Remove mountpoints 368 // ------------------ 369 QListIterator<bncGetThread*> iTh(_threads); 370 while (iTh.hasNext()) { 371 bncGetThread* thread = iTh.next(); 372 373 bool existFlg = false; 374 QListIterator<QString> it(settings.value("mountPoints").toStringList()); 375 while (it.hasNext()) { 376 QStringList hlp = it.next().split(" "); 377 if (hlp.size() <= 1) continue; 378 QUrl url(hlp[0]); 379 380 if (thread->mountPoint() == url) { 381 existFlg = true; 382 break; 383 } 384 } 385 386 if (!existFlg) { 387 std::cout << "old Thread " << thread->staID().data() << std::endl; 388 disconnect(thread, 0, 0, 0); 389 _staIDs.removeAll(thread->staID()); 390 _threads.removeAll(thread); 391 thread->terminate(); 392 thread->wait(); 393 delete thread; 394 } 395 } 396 397 // (Re-) Start the configuration timer 398 // ----------------------------------- 399 int ms = 0; 400 401 if (_confTimer) { 402 ms = 1000 * _confInterval; 403 } 404 else { 405 _confTimer = new QTimer(); 406 connect(_confTimer, SIGNAL(timeout()), this, SLOT(slotReadMountpoints())); 407 408 QTime currTime = currentDateAndTimeGPS().time(); 409 QTime nextShotTime; 410 411 if (settings.value("onTheFlyInterval").toString() == "1 min") { 412 _confInterval = 60; 413 nextShotTime = QTime(currTime.hour(), currTime.minute()+1, 0); 414 } 415 else if (settings.value("onTheFlyInterval").toString() == "1 hour") { 416 _confInterval = 3600; 417 nextShotTime = QTime(currTime.hour()+1, 0, 0); 418 } 419 else { 420 _confInterval = 86400; 421 nextShotTime = QTime(23, 59, 59, 999); 422 } 423 424 ms = currTime.msecsTo(nextShotTime); 425 } 426 427 _confTimer->start(ms); 428 } -
TabularUnified trunk/BNC/bnccaster.h ¶
r628 r1170 45 45 public slots: 46 46 void newObs(QByteArray staID, bool firstObs, p_obs obs); 47 void slotReadMountpoints(); 47 48 48 49 signals: … … 69 70 long _waitTime; 70 71 QMutex _mutex; 72 QTimer* _confTimer; 73 int _confInterval; 71 74 }; 72 75 -
TabularUnified trunk/BNC/bncmain.cpp ¶
r1166 r1170 169 169 ((bncApp*)qApp)->slotMessage("============ Start BNC ============"); 170 170 171 if (fileInput) { 171 // Normal case - data from Internet 172 // -------------------------------- 173 if (!fileInput) { 174 caster->slotReadMountpoints(); 175 if (caster->numStations() == 0) { 176 return 0; 177 } 178 } 179 180 // Special case - data from file 181 // ----------------------------- 182 else { 172 183 if ( fileName.isEmpty() || format.isEmpty() || 173 184 dateString.isEmpty() || timeString.isEmpty() ) { … … 187 198 188 199 caster->addGetThread(getThread); 189 190 getThread->start();191 }192 else {193 int iMount = -1;194 QListIterator<QString> it(settings.value("mountPoints").toStringList());195 while (it.hasNext()) {196 ++iMount;197 QStringList hlp = it.next().split(" ");198 if (hlp.size() <= 1) continue;199 QUrl url(hlp[0]);200 QByteArray format = hlp[1].toAscii();201 QByteArray latitude = hlp[2].toAscii();202 QByteArray longitude = hlp[3].toAscii();203 QByteArray nmea = hlp[4].toAscii();204 205 bncGetThread* getThread = new bncGetThread(url, format, latitude, longitude, nmea, iMount);206 207 app.connect(getThread, SIGNAL(newMessage(QByteArray)),208 &app, SLOT(slotMessage(const QByteArray)));209 210 caster->addGetThread(getThread);211 212 getThread->start();213 }214 if (caster->numStations() == 0) {215 return 0;216 }217 200 } 218 201 } -
TabularUnified trunk/BNC/bncwindow.cpp ¶
r1168 r1170 145 145 if (ii != -1) { 146 146 _rnxIntrComboBox->setCurrentIndex(ii); 147 } 148 _onTheFlyComboBox = new QComboBox(); 149 _onTheFlyComboBox->setMaximumWidth(9*ww); 150 _onTheFlyComboBox->setEditable(false); 151 _onTheFlyComboBox->addItems(QString("1 min,1 hour,1 day").split(",")); 152 ii = _onTheFlyComboBox->findText(settings.value("onTheFlyInterval").toString()); 153 if (ii != -1) { 154 _onTheFlyComboBox->setCurrentIndex(ii); 147 155 } 148 156 _ephIntrComboBox = new QComboBox(); … … 372 380 gLayout->addWidget(new QLabel("Append files") ,1,0 ); 373 381 gLayout->addWidget(_rnxAppendCheckBox, 1,1 ); 374 gLayout->addWidget(new QLabel("General settings for logfile and file handling."),2, 0, 1, 2, Qt::AlignLeft); 375 gLayout->addWidget(new QLabel(" "),3,0); 382 gLayout->addWidget(new QLabel("Reread Configuration every") ,2,0 ); 383 gLayout->addWidget(_onTheFlyComboBox, 2,1 ); 384 gLayout->addWidget(new QLabel("General settings for logfile and file handling."),3, 0, 1, 2, Qt::AlignLeft); 376 385 gLayout->addWidget(new QLabel(" "),4,0); 377 386 gLayout->addWidget(new QLabel(" "),5,0); 387 gLayout->addWidget(new QLabel(" "),6,0); 378 388 ggroup->setLayout(gLayout); 379 389 … … 613 623 settings.setValue("rnxScript", _rnxScrpLineEdit->text()); 614 624 settings.setValue("rnxIntr", _rnxIntrComboBox->currentText()); 625 settings.setValue("onTheFlyInterval", _onTheFlyComboBox->currentText()); 615 626 settings.setValue("ephIntr", _ephIntrComboBox->currentText()); 616 627 settings.setValue("corrIntr", _corrIntrComboBox->currentText()); … … 675 686 this, SLOT(slotMessage(QByteArray))); 676 687 677 slotMessage("============ Start BNC ============"); 688 _caster->slotReadMountpoints(); 689 690 slotMessage ("============ Start BNC ============"); 678 691 ((bncApp*)qApp)->slotMessage("============ Start BNC ============"); 679 680 for (int iRow = 0; iRow < _mountPointsTable->rowCount(); iRow++) {681 QUrl url( "//" + _mountPointsTable->item(iRow, 0)->text() +682 "@" + _mountPointsTable->item(iRow, 1)->text() );683 684 QByteArray format = _mountPointsTable->item(iRow, 2)->text().toAscii();685 686 QByteArray latitude = _mountPointsTable->item(iRow, 3)->text().toAscii();687 QByteArray longitude = _mountPointsTable->item(iRow, 4)->text().toAscii();688 QByteArray nmea = _mountPointsTable->item(iRow, 5)->text().toAscii();689 690 bncGetThread* getThread = new bncGetThread(url, format, latitude, longitude, nmea, iRow);691 692 connect(getThread, SIGNAL(newMessage(QByteArray)),693 this, SLOT(slotMessage(QByteArray)));694 connect(getThread, SIGNAL(newMessage(QByteArray)),695 (bncApp*)qApp, SLOT(slotMessage(QByteArray)));696 697 connect(getThread, SIGNAL(newBytes(QByteArray, double)),698 (bncTableItem*) _mountPointsTable->item(iRow, 6),699 SLOT(slotNewBytes(QByteArray, double)));700 701 _caster->addGetThread(getThread);702 703 getThread->start();704 }705 692 } 706 693 -
TabularUnified trunk/BNC/bncwindow.h ¶
r1095 r1170 129 129 QLineEdit* _LonLineEdit; 130 130 131 QComboBox* _onTheFlyComboBox; 132 131 133 QTextEdit* _log; 132 134
Note:
See TracChangeset
for help on using the changeset viewer.