Changeset 7180 in ntrip
- Timestamp:
- Aug 14, 2015, 10:57:56 AM (9 years ago)
- Location:
- trunk/BNC/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/bnccaster.cpp
r7176 r7180 96 96 } 97 97 98 int nmeaPort = settings.value("PPP/nmeaPort").toInt();99 if (nmeaPort != 0) {100 _nmeaServer = new QTcpServer;101 if ( !_nmeaServer->listen(QHostAddress::Any, nmeaPort) ) {102 emit newMessage("bncCaster: Cannot listen on port", true);103 }104 connect(_nmeaServer, SIGNAL(newConnection()), this, SLOT(slotNewNMEAConnection()));105 connect(BNC_CORE, SIGNAL(newNMEAstr(QByteArray, QByteArray)),106 this, SLOT(slotNewNMEAstr(QByteArray, QByteArray)));107 _nmeaSockets = new QList<QTcpSocket*>;108 }109 else {110 _nmeaServer = 0;111 _nmeaSockets = 0;112 }113 114 98 _samplingRate = settings.value("binSampl").toInt(); 115 99 _waitTime = settings.value("waitTime").toDouble(); … … 154 138 delete _uServer; 155 139 delete _uSockets; 156 delete _nmeaServer;157 delete _nmeaSockets;158 140 delete _miscServer; 159 141 delete _miscSockets; … … 254 236 emit( newMessage(QString("New client connection on usync port: # %1") 255 237 .arg(_uSockets->size()).toAscii(), true) ); 256 }257 258 void bncCaster::slotNewNMEAConnection() {259 _nmeaSockets->push_back( _nmeaServer->nextPendingConnection() );260 emit( newMessage(QString("New PPP client on port: # %1")261 .arg(_nmeaSockets->size()).toAscii(), true) );262 238 } 263 239 … … 337 313 firstObs = false; 338 314 oStr << "> " << obs._time.gpsw() << ' ' 339 << setprecision(7) << obs._time.gpssec() << endl; ;315 << setprecision(7) << obs._time.gpssec() << endl; 340 316 } 341 317 oStr << obs._staID << ' ' << bncRinex::asciiSatLine(obs) << endl; … … 436 412 longitude, nmea, ntripVersion); 437 413 addGetThread(getThread); 414 438 415 } 439 416 } … … 519 496 } 520 497 return -1; 521 }522 523 //524 ////////////////////////////////////////////////////////////////////////////525 void bncCaster::slotNewNMEAstr(QByteArray /* staID */, QByteArray str) {526 if (_nmeaSockets) {527 QMutableListIterator<QTcpSocket*> is(*_nmeaSockets);528 while (is.hasNext()) {529 QTcpSocket* sock = is.next();530 if (sock->state() == QAbstractSocket::ConnectedState) {531 sock->write(str);532 }533 else if (sock->state() != QAbstractSocket::ConnectingState) {534 delete sock;535 is.remove();536 }537 }538 }539 498 } 540 499 -
trunk/BNC/src/bnccaster.h
r6449 r7180 46 46 void slotNewObs(QByteArray staID, QList<t_satObs> obsList); 47 47 void slotNewRawData(QByteArray staID, QByteArray data); 48 void slotNewNMEAstr(QByteArray staID, QByteArray str);49 48 void slotNewMiscConnection(); 50 49 … … 55 54 void newObs(QByteArray staID, QList<t_satObs> obsList); 56 55 57 private slots:56 private slots: 58 57 void slotReadMountPoints(); 59 58 void slotNewConnection(); 60 59 void slotNewUConnection(); 61 void slotNewNMEAConnection();62 60 void slotGetThreadFinished(QByteArray staID); 63 61 … … 67 65 void reopenOutFile(); 68 66 69 QFile* _outFile; 70 QTextStream* _out; 71 QMap<bncTime, QList<t_satObs> > _epochs; 72 bncTime _lastDumpTime; 73 QTcpServer* _server; 74 QTcpServer* _uServer; 75 QTcpServer* _nmeaServer; 76 QList<QTcpSocket*>* _sockets; 77 QList<QTcpSocket*>* _uSockets; 78 QList<QTcpSocket*>* _nmeaSockets; 79 QList<QByteArray> _staIDs; 80 QList<bncGetThread*> _threads; 81 int _samplingRate; 82 double _waitTime; 83 QMutex _mutex; 84 int _confInterval; 85 QString _miscMount; 86 int _miscPort; 87 QTcpServer* _miscServer; 88 QList<QTcpSocket*>* _miscSockets; 67 QFile* _outFile; 68 QTextStream* _out; 69 QMap<bncTime, QList<t_satObs> > _epochs; 70 bncTime _lastDumpTime; 71 QTcpServer* _server; 72 QTcpServer* _uServer; 73 QList<QTcpSocket*>* _sockets; 74 QList<QTcpSocket*>* _uSockets; 75 QList<QByteArray> _staIDs; 76 QList<bncGetThread*> _threads; 77 int _samplingRate; 78 double _waitTime; 79 QMutex _mutex; 80 int _confInterval; 81 QString _miscMount; 82 int _miscPort; 83 QTcpServer* _miscServer; 84 QList<QTcpSocket*>* _miscSockets; 89 85 }; 90 86 -
trunk/BNC/src/bncgetthread.cpp
r7153 r7180 128 128 _decoder = 0; 129 129 130 // NMEA Port 131 // ----------- 132 QListIterator<QString> iSta(settings.value("PPP/staTable").toStringList()); 133 int nmeaPort = 0; 134 while (iSta.hasNext()) { 135 QStringList hlp = iSta.next().split(","); 136 if (hlp.size() < 10) {continue;} 137 QByteArray mp = hlp[0].toAscii(); 138 if (_staID == mp) { 139 nmeaPort = hlp[9].toInt(); 140 } 141 } 142 if (nmeaPort != 0) { 143 _nmeaServer = new QTcpServer; 144 if ( !_nmeaServer->listen(QHostAddress::Any, nmeaPort) ) { 145 emit newMessage("bncCaster: Cannot listen on port", true); 146 } 147 else { 148 connect(_nmeaServer, SIGNAL(newConnection()), this, SLOT(slotNewNMEAConnection())); 149 connect(BNC_CORE, SIGNAL(newNMEAstr(QByteArray, QByteArray)), 150 this, SLOT(slotNewNMEAstr(QByteArray, QByteArray))); 151 _nmeaSockets = new QList<QTcpSocket*>; 152 _nmeaPortsMap[_staID] = nmeaPort; 153 } 154 } else { 155 _nmeaServer = 0; 156 _nmeaSockets = 0; 157 } 158 130 159 // Serial Port 131 160 // ----------- … … 371 400 delete this; 372 401 } 402 _nmeaPortsMap.remove(_staID); 403 delete _nmeaServer; 404 delete _nmeaSockets; 373 405 } 374 406 … … 879 911 } 880 912 } 913 914 void bncGetThread::slotNewNMEAConnection() { 915 _nmeaSockets->push_back(_nmeaServer->nextPendingConnection()); 916 emit( newMessage(QString("New PPP client on port: # %1") 917 .arg(_nmeaSockets->size()).toAscii(), true) ); 918 } 919 920 // 921 //////////////////////////////////////////////////////////////////////////// 922 void bncGetThread::slotNewNMEAstr(QByteArray staID, QByteArray str) { 923 if (_nmeaPortsMap.contains(staID)) { 924 int nmeaPort = _nmeaPortsMap.value(staID); 925 QMutableListIterator<QTcpSocket*> is(*_nmeaSockets); 926 while (is.hasNext()) { 927 QTcpSocket* sock = is.next(); 928 if (sock->localPort() == nmeaPort) { 929 if (sock->state() == QAbstractSocket::ConnectedState) { 930 sock->write(str); 931 } 932 else if (sock->state() != QAbstractSocket::ConnectingState) { 933 delete sock; 934 is.remove(); 935 } 936 } 937 } 938 } 939 } -
trunk/BNC/src/bncgetthread.h
r6864 r7180 89 89 virtual void run(); 90 90 91 public slots: 92 void slotNewNMEAstr(QByteArray staID, QByteArray str); 93 91 94 private slots: 92 95 void slotSerialReadyRead(); 96 void slotNewNMEAConnection(); 93 97 94 98 private: … … 128 132 QMap<char, QVector<QString> > _rnxTypes; 129 133 QStringList _gloSlots; 134 QList<QTcpSocket*>* _nmeaSockets; 135 QMap<QByteArray, int> _nmeaPortsMap; 136 QTcpServer* _nmeaServer; 130 137 }; 131 138 -
trunk/BNC/src/pppWidgets.cpp
r7076 r7180 431 431 if (iCol == 7) _staTable->setItem(iRow, iCol, new QTableWidgetItem("0.1")); 432 432 if (iCol == 8) _staTable->setItem(iRow, iCol, new QTableWidgetItem("3e-6")); 433 if (iCol == 9) _staTable->setItem(iRow, iCol, new QTableWidgetItem(" "));433 if (iCol == 9) _staTable->setItem(iRow, iCol, new QTableWidgetItem("0")); 434 434 } 435 435 }
Note:
See TracChangeset
for help on using the changeset viewer.