Changeset 936 in ntrip
- Timestamp:
- Jun 8, 2008, 5:40:11 PM (16 years ago)
- Location:
- trunk/BNC
- Files:
-
- 4 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 } -
trunk/BNC/RTCM3/RTCM3coDecoder.h
r935 r936 44 44 virtual t_irc Decode(char* buffer = 0, int bufLen = 0); 45 45 46 private slots:47 void slotNewConnection();46 signals: 47 void newCorrLine(QString line); 48 48 49 49 private: … … 58 58 ClockOrbit _co; 59 59 Bias _bias; 60 QTcpServer* _server;61 QList<QTcpSocket*>* _sockets;62 60 }; 63 61 -
trunk/BNC/bncapp.cpp
r934 r936 570 570 571 571 572 // 573 //////////////////////////////////////////////////////////////////////////// 574 void bncApp::slotNewCorrLine(QString line) { 575 cout << line.toAscii().data() << endl; 576 } -
trunk/BNC/bncapp.h
r621 r936 45 45 void slotNewGPSEph(gpsephemeris* gpseph); 46 46 void slotNewGlonassEph(glonassephemeris* glonasseph); 47 void slotNewCorrLine(QString line); 47 48 void slotQuit(); 48 49
Note:
See TracChangeset
for help on using the changeset viewer.