Changeset 936 in ntrip for trunk/BNC/RTCM3/RTCM3coDecoder.cpp
- Timestamp:
- Jun 8, 2008, 5:40:11 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/RTCM3/RTCM3coDecoder.cpp
r935 r936 45 45 #include "bncutils.h" 46 46 #include "bncrinex.h" 47 #include "bncapp.h" 47 48 48 49 using namespace std; … … 65 66 _out = 0; 66 67 67 _port = settings.value("corrPort").toInt(); 68 _server = 0; 69 _sockets = 0; 68 connect(this, SIGNAL(newCorrLine(QString)), 69 (bncApp*) qApp, SLOT(slotNewCorrLine(QString))); 70 70 } 71 71 … … 74 74 RTCM3coDecoder::~RTCM3coDecoder() { 75 75 delete _out; 76 delete _server;77 delete _sockets;78 76 } 79 77 … … 82 80 void RTCM3coDecoder::reopen() { 83 81 84 // Socket Server85 // -------------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 File95 // -----------96 82 if (!_fileNameSkl.isEmpty()) { 97 83 … … 117 103 _out = new ofstream( _fileName.toAscii().data() ); 118 104 } 119 }120 121 // New Connection122 ////////////////////////////////////////////////////////////////////////////123 void RTCM3coDecoder::slotNewConnection() {124 cout << "slotNewConnection" << endl;125 _sockets->push_back( _server->nextPendingConnection() );126 105 } 127 106 … … 222 201 //////////////////////////////////////////////////////////////////////////// 223 202 void RTCM3coDecoder::printLine(const QString& line) { 224 225 203 if (_out) { 226 204 *_out << line.toAscii().data(); … … 228 206 } 229 207 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 }
Note:
See TracChangeset
for help on using the changeset viewer.