Changeset 5647 in ntrip
- Timestamp:
- Feb 23, 2014, 5:53:18 PM (11 years ago)
- Location:
- trunk/BNC/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/bnccaster.cpp
r5528 r5647 129 129 } 130 130 #endif 131 132 // Miscellaneous output port // Georg 133 // ------------------------- 134 _miscMount = settings.value("miscMount").toString(); 135 _miscPort = settings.value("miscPort").toInt(); 136 if (!_miscMount.isEmpty() && _miscPort != 0) { 137 _miscServer = new QTcpServer; 138 if ( !_miscServer->listen(QHostAddress::Any, _miscPort) ) { 139 emit newMessage("bncCaster: Cannot listen on Miscellaneous Output Port", true); 140 } 141 connect(_miscServer, SIGNAL(newConnection()), this, SLOT(slotNewMiscConnection())); 142 _miscSockets = new QList<QTcpSocket*>; 143 } 144 else { 145 _miscServer = 0; 146 _miscSockets = 0; 147 } 131 148 } 132 149 … … 157 174 } 158 175 #endif 176 delete _miscServer; 177 delete _miscSockets; 159 178 } 160 179 … … 579 598 } 580 599 600 // // Output into the Miscellaneous socket // Georg 601 // // ------------------------------------ 602 // if (_miscSockets && _miscMount != "ALL") { 603 // QMutableListIterator<QTcpSocket*> is(*_miscSockets); 604 // while (is.hasNext()) { 605 // QTcpSocket* sock = is.next(); 606 // if (sock->state() == QAbstractSocket::ConnectedState) { 607 // if (myMiscWrite(sock, data, nBytes) != nBytes) { 608 // delete sock; 609 // is.remove(); 610 // } 611 // } 612 // else if (sock->state() != QAbstractSocket::ConnectingState) { 613 // delete sock; 614 // is.remove(); 615 // } 616 // } 617 // } 618 619 620 // New Connection // Georg 621 //////////////////////////////////////////////////////////////////////////// 622 void bncCaster::slotNewMiscConnection() { 623 _miscSockets->push_back( _miscServer->nextPendingConnection() ); 624 emit( newMessage(QString("New client connection on Miscellaneous Output Port: # %1") 625 .arg(_miscSockets->size()).toAscii(), true) ); 626 } 627 628 // Write buffer // Georg 629 //////////////////////////////////////////////////////////////////////////// 630 int bncCaster::myMiscWrite(QTcpSocket* sock, const char* buf, int bufLen) { 631 sock->write(buf, bufLen); 632 for (int ii = 1; ii <= 10; ii++) { 633 if (sock->waitForBytesWritten(10)) { // wait 10 ms 634 return bufLen; 635 } 636 } 637 return -1; 638 } 639 -
trunk/BNC/src/bnccaster.h
r5528 r5647 50 50 void slotNewObs(QByteArray staID, QList<t_obs> obsList); 51 51 void slotNewNMEAstr(QByteArray str); 52 void slotNewMiscConnection(); 52 53 53 54 signals: … … 66 67 void dumpEpochs(long minTime, long maxTime); 67 68 static int myWrite(QTcpSocket* sock, const char* buf, int bufLen); 69 static int myMiscWrite(QTcpSocket* sock, const char* buf, int bufLen); 68 70 void reopenOutFile(); 69 71 … … 85 87 QMutex _mutex; 86 88 int _confInterval; 89 QString _miscMount; 90 int _miscPort; 91 QTcpServer* _miscServer; 92 QList<QTcpSocket*>* _miscSockets; 87 93 #ifdef RTROVER_INTERFACE 88 94 t_bncRtrover* _bncRtrover; -
trunk/BNC/src/bncgetthread.cpp
r5646 r5647 104 104 105 105 bncSettings settings; 106 107 106 if (!settings.value("rawOutFile").toString().isEmpty()) { 108 107 _rawOutput = true; … … 132 131 _miscMount = settings.value("miscMount").toString(); 133 132 _decoder = 0; 134 135 // Miscellaneous output port // Georg136 // -------------------------137 _miscPort = settings.value("miscPort").toInt();138 if (_miscPort != 0) {139 _miscServer = new QTcpServer;140 if ( !_miscServer->listen(QHostAddress::Any, _miscPort) ) {141 emit newMessage("bncgetthread: Cannot listen on Miscellaneous Output Port", true);142 }143 connect(_miscServer, SIGNAL(newConnection()), this, SLOT(slotNewMiscConnection()));144 _miscSockets = new QList<QTcpSocket*>;145 }146 else {147 _miscServer = 0;148 _miscSockets = 0;149 }150 133 151 134 // Serial Port … … 400 383 delete _serialPort; 401 384 delete _latencyChecker; 402 delete _miscServer;403 delete _miscSockets;404 385 emit getThreadFinished(_staID); 405 386 } … … 492 473 _serialPort->write(data); 493 474 } 494 495 // Output into the Miscellaneous socket // Georg 496 // ------------------------------------ 497 if (_miscSockets && _miscMount != "ALL") { 498 QMutableListIterator<QTcpSocket*> is(*_miscSockets); 499 while (is.hasNext()) { 500 QTcpSocket* sock = is.next(); 501 if (sock->state() == QAbstractSocket::ConnectedState) { 502 if (myMiscWrite(sock, data, nBytes) != nBytes) { 503 delete sock; 504 is.remove(); 505 } 506 } 507 else if (sock->state() != QAbstractSocket::ConnectingState) { 508 delete sock; 509 is.remove(); 510 } 511 } 512 } 513 475 514 476 // Decode Data 515 477 // ----------- … … 709 671 } 710 672 711 // New Connection // Georg712 ////////////////////////////////////////////////////////////////////////////713 void bncGetThread::slotNewMiscConnection() {714 _miscSockets->push_back( _miscServer->nextPendingConnection() );715 emit( newMessage(QString("New client connection on Miscellaneous Output Port: # %1")716 .arg(_miscSockets->size()).toAscii(), true) );717 }718 719 // Write buffer // Georg720 ////////////////////////////////////////////////////////////////////////////721 int bncGetThread::myMiscWrite(QTcpSocket* sock, const char* buf, int bufLen) {722 sock->write(buf, bufLen);723 for (int ii = 1; ii <= 10; ii++) {724 if (sock->waitForBytesWritten(10)) { // wait 10 ms725 return bufLen;726 }727 }728 return -1;729 }730 731 673 // RTCM scan output 732 674 ////////////////////////////////////////////////////////////////////////////// … … 865 807 } 866 808 } 867 -
trunk/BNC/src/bncgetthread.h
r5643 r5647 92 92 private slots: 93 93 void slotSerialReadyRead(); 94 void slotNewMiscConnection();95 94 96 95 private: 97 static int myMiscWrite(QTcpSocket* sock, const char* buf, int bufLen);98 96 enum t_serialNMEA {NO_NMEA, MANUAL_NMEA, AUTO_NMEA}; 99 97 t_irc initDecoder(); … … 117 115 int _nextSleep; 118 116 int _iMount; 119 int _miscPort;120 117 bncRawFile* _rawFile; 121 118 QextSerialPort* _serialPort; … … 129 126 QMap<QString, long> _prnLastEpo; 130 127 QMap<char, QVector<QString> > _rnxTypes; 131 QTcpServer* _miscServer;132 QList<QTcpSocket*>* _miscSockets;133 128 }; 134 129
Note:
See TracChangeset
for help on using the changeset viewer.