Changeset 838 in ntrip


Ignore:
Timestamp:
Apr 16, 2008, 1:28:38 PM (16 years ago)
Author:
mervart
Message:

* empty log message *

Location:
trunk/BNS
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNS/bnseph.cpp

    r830 r838  
    3535}
    3636
    37 // Start
     37// Connect the Socket
    3838////////////////////////////////////////////////////////////////////////////
    39 void t_bnseph::run() {
     39void t_bnseph::reconnect() {
    4040
    41   emit(newMessage("bnseph::run Start"));
     41  delete _socket;
    4242
    43   // Connect the Socket
    44   // ------------------
    4543  QSettings settings;
    4644  QString host = "localhost";
     
    5048  _socket->connectToHost(host, port);
    5149
    52   const int timeOut = 3*1000;  // 3 seconds
     50  const int timeOut = 10*1000;  // 10 seconds
    5351  if (!_socket->waitForConnected(timeOut)) {
    54     emit(error("bnseph::run Connect Timeout"));
     52    emit(newMessage("bnseph::run Connect Timeout"));
    5553  }
    56   else {
    57     while (true) {
    58       if (_socket->state() != QAbstractSocket::ConnectedState) {
    59         emit(error("bnseph::not connected"));
    60         break;
    61       }
     54}
     55
     56// Start
     57////////////////////////////////////////////////////////////////////////////
     58void t_bnseph::run() {
     59
     60  emit(newMessage("bnseph::run Start"));
     61
     62  while (true) {
     63    if (_socket == 0 || _socket->state() != QAbstractSocket::ConnectedState) {
     64      reconnect();
     65    }
     66    if (_socket && _socket->state() == QAbstractSocket::ConnectedState) {
    6267      if (_socket->canReadLine()) {
    6368        readEph();
     
    6671        _socket->waitForReadyRead(10);
    6772      }
     73    }
     74    else {
     75      msleep(10);
    6876    }
    6977  }
  • trunk/BNS/bnseph.h

    r800 r838  
    5151 
    5252 private:
     53  void reconnect();
    5354  void readEph();
    5455  QTcpSocket* _socket;
Note: See TracChangeset for help on using the changeset viewer.