- Timestamp:
- Aug 27, 2008, 10:21:47 AM (16 years ago)
- Location:
- trunk/BNS
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNS/bns.cpp
r1056 r1058 57 57 _bnseph = new t_bnseph(parent); 58 58 59 connect(_bnseph, SIGNAL(newEph(t_eph*)), this, SLOT(slotNewEph(t_eph*))); 59 connect(_bnseph, SIGNAL(newEph(t_eph*)), 60 this, SLOT(slotNewEph(t_eph*, int))); 60 61 connect(_bnseph, SIGNAL(newMessage(QByteArray)), 61 62 this, SLOT(slotMessage(const QByteArray))); … … 265 266 // 266 267 //////////////////////////////////////////////////////////////////////////// 267 void t_bns::slotNewEph(t_eph* ep ) {268 void t_bns::slotNewEph(t_eph* ep, int nBytes) { 268 269 269 270 QMutexLocker locker(&_mutex); 271 272 emit(newEphBytes(nBytes)); 270 273 271 274 t_ephPair* pair; … … 334 337 335 338 QByteArray line = _clkSocket->readLine(); 339 340 emit(newClkBytes(line.length())); 336 341 337 342 if (line.indexOf('*') == -1) { … … 417 422 int len = MakeClockOrbit(&co, COTYPE_AUTO, 0, obuffer, sizeof(obuffer)); 418 423 if (len > 0) { 424 emit(newOutBytes(len)); 419 425 if (_outSocket) { 420 426 _outSocket->write(obuffer, len); -
trunk/BNS/bns.h
r986 r1058 40 40 41 41 signals: 42 void newClkBytes(int nBytes); 43 void newEphBytes(int nBytes); 44 void newOutBytes(int nBytes); 42 45 void newMessage(const QByteArray msg); 43 46 void error(const QByteArray msg); … … 45 48 46 49 private slots: 47 void slotNewEph(t_eph* ep );50 void slotNewEph(t_eph* ep, int nBytes); 48 51 void slotNewConnection(); 49 52 void slotMessage(const QByteArray msg); -
trunk/BNS/bnseph.cpp
r978 r1058 82 82 void t_bnseph::readEph() { 83 83 84 int nBytes = 0; 85 84 86 t_eph* eph = 0; 85 87 QByteArray line = waitForLine(_socket); 88 nBytes += line.length(); 86 89 87 90 QTextStream in(line); … … 105 108 for (int ii = 2; ii <= numlines; ii++) { 106 109 QByteArray line = waitForLine(_socket); 110 nBytes += line.length(); 107 111 lines << line; 108 112 } … … 110 114 eph->read(lines); 111 115 112 emit(newEph(eph ));116 emit(newEph(eph, nBytes)); 113 117 } 114 118 -
trunk/BNS/bnseph.h
r926 r1058 108 108 109 109 signals: 110 void newEph(t_eph* eph );110 void newEph(t_eph* eph, int nBytes); 111 111 void newMessage(const QByteArray msg); 112 112 void error(const QByteArray msg); -
trunk/BNS/bnswindow.cpp
r1057 r1058 358 358 _log->setWhatsThis(tr("Records of BNS's activities are shown in the Log section.")); 359 359 360 // Status 361 // ------ 362 _status = new QWidget(); 363 QGridLayout* layout_status = new QGridLayout; 364 365 _statusLbl[0] = new QLabel("0 byte(s)"); _statusCnt[0] = 0; 366 _statusLbl[1] = new QLabel("0 byte(s)"); _statusCnt[1] = 0; 367 _statusLbl[2] = new QLabel("0 byte(s)"); _statusCnt[2] = 0; 368 _statusLbl[3] = new QLabel("Input Ephemeris"); 369 _statusLbl[4] = new QLabel("Input Clock & Orbits"); 370 _statusLbl[5] = new QLabel("Output"); 371 372 layout_status->addWidget(_statusLbl[3], 0, 0); 373 layout_status->addWidget(_statusLbl[0], 0, 1); 374 layout_status->addWidget(_statusLbl[4], 0, 2); 375 layout_status->addWidget(_statusLbl[1], 0, 3); 376 layout_status->addWidget(_statusLbl[5], 1, 2); 377 layout_status->addWidget(_statusLbl[2], 1, 3); 378 _status->setLayout(layout_status); 379 360 380 // Main Layout 361 381 // ----------- … … 363 383 mainLayout->addWidget(tabs); 364 384 mainLayout->addWidget(_log); 385 mainLayout->addWidget(_status); 365 386 366 387 _canvas->setLayout(mainLayout); … … 541 562 this, SLOT(slotError(const QByteArray))); 542 563 564 connect(_bns, SIGNAL(newEphBytes(int)), this, SLOT(slotEphBytes(int))); 565 connect(_bns, SIGNAL(newClkBytes(int)), this, SLOT(slotClkBytes(int))); 566 connect(_bns, SIGNAL(newOutBytes(int)), this, SLOT(slotOutBytes(int))); 567 543 568 _bns->start(); 544 569 } 570 571 // Input and output bytes statistics 572 //////////////////////////////////////////////////////////////////////////// 573 void bnsWindow::slotEphBytes(int nBytes) { 574 updateStatus(0, nBytes); 575 } 576 void bnsWindow::slotClkBytes(int nBytes) { 577 updateStatus(1, nBytes); 578 } 579 void bnsWindow::slotOutBytes(int nBytes) { 580 updateStatus(2, nBytes); 581 } 582 583 void bnsWindow::updateStatus(int ii, int nBytes) { 584 QMutexLocker locker(&_mutex); 585 586 _statusCnt[ii] += nBytes; 587 588 if (_statusCnt[ii] < 1e3) { 589 _statusLbl[ii]->setText(QString("%1 byte(s)").arg((int)_statusCnt[ii])); 590 } 591 else if (_statusCnt[ii] < 1e6) { 592 _statusLbl[ii]->setText(QString("%1 kb").arg(_statusCnt[ii]/1.e3, 5)); 593 } 594 else { 595 _statusLbl[ii]->setText(QString("%1 Mb").arg(_statusCnt[ii]/1.e6, 5)); 596 } 597 } -
trunk/BNS/bnswindow.h
r998 r1058 42 42 void slotStart(); 43 43 void slotStop(); 44 void slotEphBytes(int nBytes); 45 void slotClkBytes(int nBytes); 46 void slotOutBytes(int nBytes); 44 47 45 48 protected: … … 50 53 void AddToolbar(); 51 54 void deleteBns(); 55 void updateStatus(int ii, int nBytes); 52 56 53 57 QMenu* _menuHlp; … … 88 92 QTextEdit* _log; 89 93 94 QWidget* _status; 95 QLabel* _statusLbl[6]; 96 double _statusCnt[3]; 97 QMutex _mutex; 98 90 99 t_bns* _bns; 91 100 };
Note:
See TracChangeset
for help on using the changeset viewer.