Changeset 760 in ntrip


Ignore:
Timestamp:
Mar 30, 2008, 6:25:06 PM (16 years ago)
Author:
mervart
Message:

* empty log message *

Location:
trunk/BNS
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNS/bns.cpp

    r758 r760  
    2424////////////////////////////////////////////////////////////////////////////
    2525t_bns::t_bns(QObject* parent) : QThread(parent) {
     26
    2627  _bnseph = new t_bnseph(parent);
     28
    2729  connect(_bnseph, SIGNAL(newMessage(QByteArray)),
    2830          this, SLOT(slotMessage(const QByteArray)));
     31
     32  connect(_bnseph, SIGNAL(error(QByteArray)),
     33          this, SLOT(slotError(const QByteArray)));
    2934}
    3035
     
    4247}
    4348
     49// Write a Program Message
     50////////////////////////////////////////////////////////////////////////////
     51void t_bns::slotError(const QByteArray msg) {
     52  cerr << msg.data() << endl;
     53  emit(error(msg));
     54}
     55
    4456// Start
    4557////////////////////////////////////////////////////////////////////////////
  • trunk/BNS/bns.h

    r758 r760  
    1616 signals:
    1717  void newMessage(const QByteArray msg);
     18  void error(const QByteArray msg);
    1819 
    1920 private slots:
    2021  void slotMessage(const QByteArray msg);
     22  void slotError(const QByteArray msg);
    2123
    2224 private:
  • trunk/BNS/bnseph.cpp

    r759 r760  
    4646  _socket->connectToHost(host, port);
    4747
    48   const int timeOut = 10*1000;  // 10 seconds
     48  const int timeOut = 3*1000;  // 3 seconds
    4949  if (!_socket->waitForConnected(timeOut)) {
    50     emit(newMessage("bnseph::run Connect Timeout"));
    51     delete _socket; _socket = 0;
    52     return;
     50    emit(error("bnseph::run Connect Timeout"));
    5351  }
    54 
    55   while (true) {
    56     if (_socket->canReadLine()) {
    57       QByteArray line = _socket->readLine();
    58       emit(newMessage(line));
    59     }
    60     else {
    61       _socket->waitForReadyRead(10);
     52  else {
     53    while (true) {
     54      if (_socket->canReadLine()) {
     55        QByteArray line = _socket->readLine();
     56        emit(newMessage(line));
     57      }
     58      else {
     59        _socket->waitForReadyRead(10);
     60      }
    6261    }
    6362  }
  • trunk/BNS/bnseph.h

    r759 r760  
    1414 signals:
    1515  void newMessage(const QByteArray msg);
     16  void error(const QByteArray msg);
    1617 
    1718 private:
  • trunk/BNS/bnswindow.cpp

    r758 r760  
    280280
    281281
     282// Delete bns
     283////////////////////////////////////////////////////////////////////////////
     284void bnsWindow::deleteBns() {
     285  _actStart->setEnabled(true);
     286  _actStop->setEnabled(false);
     287  delete _bns;
     288  _bns = 0;
     289
     290
     291// Error in bns
     292////////////////////////////////////////////////////////////////////////////
     293void bnsWindow::slotError(const QByteArray msg) {
     294  slotMessage(msg);
     295  deleteBns();
     296
     297
    282298// Stop
    283299////////////////////////////////////////////////////////////////////////////
     
    287303                                   QMessageBox::NoButton);
    288304  if (iRet == QMessageBox::Yes) {
    289     _actStart->setEnabled(true);
    290     _actStop->setEnabled(false);
    291     delete _bns;
    292     _bns = 0;
     305    deleteBns();
    293306  }
    294307}
     
    303316
    304317  _bns = new t_bns(0);
     318
    305319  connect(_bns, SIGNAL(newMessage(QByteArray)),
    306320          this, SLOT(slotMessage(const QByteArray)));
     321
     322  connect(_bns, SIGNAL(error(QByteArray)),
     323          this, SLOT(slotError(const QByteArray)));
     324
    307325  _bns->start();
    308326}
  • trunk/BNS/bnswindow.h

    r758 r760  
    2323 public slots: 
    2424  void slotMessage(const QByteArray msg);
     25  void slotError(const QByteArray msg);
    2526
    2627 private slots:
     
    3940  void CreateMenu();
    4041  void AddToolbar();
     42  void deleteBns();
    4143
    4244  QMenu*     _menuHlp;
Note: See TracChangeset for help on using the changeset viewer.