Changeset 1058 in ntrip


Ignore:
Timestamp:
Aug 27, 2008, 10:21:47 AM (16 years ago)
Author:
mervart
Message:

* empty log message *

Location:
trunk/BNS
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNS/bns.cpp

    r1056 r1058  
    5757  _bnseph = new t_bnseph(parent);
    5858
    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)));
    6061  connect(_bnseph, SIGNAL(newMessage(QByteArray)),
    6162          this, SLOT(slotMessage(const QByteArray)));
     
    265266//
    266267////////////////////////////////////////////////////////////////////////////
    267 void t_bns::slotNewEph(t_eph* ep) {
     268void t_bns::slotNewEph(t_eph* ep, int nBytes) {
    268269
    269270  QMutexLocker locker(&_mutex);
     271
     272  emit(newEphBytes(nBytes));
    270273
    271274  t_ephPair* pair;
     
    334337
    335338  QByteArray line = _clkSocket->readLine();
     339
     340  emit(newClkBytes(line.length()));
    336341
    337342  if (line.indexOf('*') == -1) {
     
    417422        int len = MakeClockOrbit(&co, COTYPE_AUTO, 0, obuffer, sizeof(obuffer));
    418423        if (len > 0) {
     424          emit(newOutBytes(len));
    419425          if (_outSocket) {
    420426            _outSocket->write(obuffer, len);
  • trunk/BNS/bns.h

    r986 r1058  
    4040
    4141 signals:
     42  void newClkBytes(int nBytes);
     43  void newEphBytes(int nBytes);
     44  void newOutBytes(int nBytes);
    4245  void newMessage(const QByteArray msg);
    4346  void error(const QByteArray msg);
     
    4548 
    4649 private slots:
    47   void slotNewEph(t_eph* ep);
     50  void slotNewEph(t_eph* ep, int nBytes);
    4851  void slotNewConnection();
    4952  void slotMessage(const QByteArray msg);
  • trunk/BNS/bnseph.cpp

    r978 r1058  
    8282void t_bnseph::readEph() {
    8383
     84  int nBytes = 0;
     85
    8486  t_eph* eph = 0;
    8587  QByteArray line = waitForLine(_socket);
     88  nBytes += line.length();
    8689
    8790  QTextStream in(line);
     
    105108  for (int ii = 2; ii <= numlines; ii++) {
    106109    QByteArray line = waitForLine(_socket);
     110    nBytes += line.length();
    107111    lines << line;
    108112  }
     
    110114  eph->read(lines);
    111115
    112   emit(newEph(eph));
     116  emit(newEph(eph, nBytes));
    113117}
    114118
  • trunk/BNS/bnseph.h

    r926 r1058  
    108108
    109109 signals:
    110   void newEph(t_eph* eph);
     110  void newEph(t_eph* eph, int nBytes);
    111111  void newMessage(const QByteArray msg);
    112112  void error(const QByteArray msg);
  • trunk/BNS/bnswindow.cpp

    r1057 r1058  
    358358  _log->setWhatsThis(tr("Records of BNS's activities are shown in the Log section."));
    359359
     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
    360380  // Main Layout
    361381  // -----------
     
    363383  mainLayout->addWidget(tabs);
    364384  mainLayout->addWidget(_log);
     385  mainLayout->addWidget(_status);
    365386
    366387  _canvas->setLayout(mainLayout);
     
    541562          this, SLOT(slotError(const QByteArray)));
    542563
     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
    543568  _bns->start();
    544569}
     570
     571// Input and output bytes statistics
     572////////////////////////////////////////////////////////////////////////////
     573void bnsWindow::slotEphBytes(int nBytes) {
     574  updateStatus(0, nBytes);
     575}
     576void bnsWindow::slotClkBytes(int nBytes) {
     577  updateStatus(1, nBytes);
     578}
     579void bnsWindow::slotOutBytes(int nBytes) {
     580  updateStatus(2, nBytes);
     581}
     582
     583void 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  
    4242  void slotStart();
    4343  void slotStop();
     44  void slotEphBytes(int nBytes);
     45  void slotClkBytes(int nBytes);
     46  void slotOutBytes(int nBytes);
    4447
    4548 protected:
     
    5053  void AddToolbar();
    5154  void deleteBns();
     55  void updateStatus(int ii, int nBytes);
    5256
    5357  QMenu*     _menuHlp;
     
    8892  QTextEdit*  _log;
    8993
     94  QWidget*    _status;
     95  QLabel*     _statusLbl[6]; 
     96  double      _statusCnt[3];
     97  QMutex      _mutex;
     98
    9099  t_bns*      _bns;
    91100};
Note: See TracChangeset for help on using the changeset viewer.