Changeset 936 in ntrip


Ignore:
Timestamp:
Jun 8, 2008, 5:40:11 PM (16 years ago)
Author:
mervart
Message:

* empty log message *

Location:
trunk/BNC
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/RTCM3/RTCM3coDecoder.cpp

    r935 r936  
    4545#include "bncutils.h"
    4646#include "bncrinex.h"
     47#include "bncapp.h"
    4748
    4849using namespace std;
     
    6566  _out = 0;
    6667
    67   _port = settings.value("corrPort").toInt();
    68   _server = 0;
    69   _sockets = 0;
     68  connect(this, SIGNAL(newCorrLine(QString)),
     69          (bncApp*) qApp, SLOT(slotNewCorrLine(QString)));
    7070}
    7171
     
    7474RTCM3coDecoder::~RTCM3coDecoder() {
    7575  delete _out;
    76   delete _server;
    77   delete _sockets;
    7876}
    7977
     
    8280void RTCM3coDecoder::reopen() {
    8381
    84   // Socket Server
    85   // -------------
    86   if (_port != 0 && _server == 0) {
    87     _server = new QTcpServer;
    88     _server->listen(QHostAddress::Any, _port);
    89     QObject::connect(_server, SIGNAL(newConnection()), this, SLOT(slotNewConnection()));
    90     _sockets = new QList<QTcpSocket*>;
    91     cout << "new port = " << _port << endl;
    92   }
    93 
    94   // Output File
    95   // -----------
    9682  if (!_fileNameSkl.isEmpty()) {
    9783
     
    117103    _out = new ofstream( _fileName.toAscii().data() );
    118104  }
    119 }
    120 
    121 // New Connection
    122 ////////////////////////////////////////////////////////////////////////////
    123 void RTCM3coDecoder::slotNewConnection() {
    124   cout << "slotNewConnection" << endl;
    125   _sockets->push_back( _server->nextPendingConnection() );
    126105}
    127106
     
    222201////////////////////////////////////////////////////////////////////////////
    223202void RTCM3coDecoder::printLine(const QString& line) {
    224 
    225203  if (_out) {
    226204    *_out << line.toAscii().data();
     
    228206  }
    229207
    230   if (_sockets) {
    231     QMutableListIterator<QTcpSocket*> is(*_sockets);
    232     while (is.hasNext()) {
    233       QTcpSocket* sock = is.next();
    234       if (sock->state() == QAbstractSocket::ConnectedState) {
    235         if (sock->write(line.toAscii()) == -1) {
    236           delete sock;
    237           is.remove();
    238         }
    239       }
    240       else if (sock->state() != QAbstractSocket::ConnectingState) {
    241         delete sock;
    242         is.remove();
    243       }
    244     }
    245   }
    246 }
     208  emit newCorrLine(line);
     209}
  • trunk/BNC/RTCM3/RTCM3coDecoder.h

    r935 r936  
    4444  virtual t_irc Decode(char* buffer = 0, int bufLen = 0);
    4545
    46  private slots:
    47   void slotNewConnection();
     46 signals:
     47  void newCorrLine(QString line);
    4848
    4949 private:
     
    5858  ClockOrbit          _co;
    5959  Bias                _bias;
    60   QTcpServer*         _server;
    61   QList<QTcpSocket*>* _sockets;
    6260};
    6361
  • trunk/BNC/bncapp.cpp

    r934 r936  
    570570
    571571
     572//
     573////////////////////////////////////////////////////////////////////////////
     574void bncApp::slotNewCorrLine(QString line) {
     575  cout << line.toAscii().data() << endl;
     576}
  • trunk/BNC/bncapp.h

    r621 r936  
    4545    void slotNewGPSEph(gpsephemeris* gpseph);
    4646    void slotNewGlonassEph(glonassephemeris* glonasseph);
     47    void slotNewCorrLine(QString line);
    4748    void slotQuit();
    4849   
Note: See TracChangeset for help on using the changeset viewer.