Changeset 11185 in ntrip for trunk/BNC/src/bncgetthread.cpp
- Timestamp:
- Nov 9, 2026, 12:15:48 PM (6 hours ago)
- File:
-
- 1 edited
-
trunk/BNC/src/bncgetthread.cpp (modified) (22 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/bncgetthread.cpp
r11179 r11185 129 129 setTerminationEnabled(true); 130 130 131 connect(this, SIGNAL(newMessage(QByteArray,bool)), 132 BNC_CORE, SLOT(slotMessage(const QByteArray,bool))); 133 connect(this, SIGNAL(newLogRecord(t_logRecord,bool)), 134 BNC_CORE, SLOT(slotLogRecord(t_logRecord,bool))); 135 t_logRecord::registerStation(_staID); 131 BNC_CORE->connectMessages(this, "stream"); 132 BNC_CORE->connectLogRecords(this, "stream"); 133 t_logRecord::registerStream(_staID); 136 134 137 135 _isToBeDeleted = false; … … 162 160 + QByteArray::number(nmeaPort) + ": " 163 161 + _nmeaServer->errorString(); 164 emit new Message(message.toLatin1(), true);162 emit newLogRecord(t_logRecord::message(t_logRecord::error, message.toLatin1()), true); 165 163 } 166 164 else { … … 264 262 msleep(100); //sleep 0.1 sec 265 263 if (!_serialPort->isOpen()) { 266 emit (newMessage(_staID + ": Cannot open serial port " + portString.toLatin1()267 + ": " + _serialPort->errorString().toLatin1() , true));264 emit newLogRecord(t_logRecord::message(t_logRecord::error, _staID + ": Cannot open serial port " + portString.toLatin1() 265 + ": " + _serialPort->errorString().toLatin1()), true); 268 266 delete _serialPort; 269 267 _serialPort = 0; 270 268 } 271 269 else { 272 emit (newMessage(_staID + ": Serial port " + portString.toLatin1()273 + "is connected: " + _serialPort->errorString().toLatin1() , true));270 emit newLogRecord(t_logRecord::message(t_logRecord::info, _staID + ": Serial port " + portString.toLatin1() 271 + "is connected: " + _serialPort->errorString().toLatin1()), true); 274 272 connect(_serialPort, SIGNAL(readyRead()), this, SLOT(slotSerialReadyRead())); 275 273 } … … 343 341 connect((RTCM3Decoder*) newDecoder, SIGNAL(newMessage(QByteArray,bool)), 344 342 this, SIGNAL(newMessage(QByteArray,bool))); 343 connect((RTCM3Decoder*) newDecoder, SIGNAL(newLogRecord(t_logRecord,bool)), 344 this, SIGNAL(newLogRecord(t_logRecord,bool))); 345 345 } else if (_format == "ZERO") { 346 346 emitFormat(": Forward data in original format", "ZERO"); … … 355 355 _decoder = new bncRtnetDecoder(); 356 356 } else { 357 emit (newMessage(_staID + ": Unknown data format " + _format + ". Please change the format entry to ZERO or ZERO2FILE to forward unchanged data.", true));357 emit newLogRecord(t_logRecord::message(t_logRecord::error, _staID + ": Unknown data format " + _format + ". Please change the format entry to ZERO or ZERO2FILE to forward unchanged data."), true); 358 358 _isToBeDeleted = true; 359 359 return failure; … … 449 449 try { 450 450 if (_isToBeDeleted) { 451 emit (newMessage(_staID + ": is to be deleted", true));451 emit newLogRecord(t_logRecord::message(t_logRecord::info, _staID + ": is to be deleted"), true); 452 452 QThread::exit(4); 453 453 this->deleteLater(); … … 484 484 _format = _rawFile->format(); 485 485 _staID = _rawFile->staID(); 486 t_logRecord::registerSt ation(_staID);486 t_logRecord::registerStream(_staID); 487 487 488 488 QCoreApplication::processEvents(); 489 489 490 490 if (data.isEmpty() || BNC_CORE->sigintReceived) { 491 emit (newMessage("No more data or SIGINT/SIGTERM received", true));491 emit newLogRecord(t_logRecord::message(t_logRecord::info, "No more data or SIGINT/SIGTERM received"), true); 492 492 // pass on data the decoders still hold back (last epoch) 493 493 QMapIterator<QString, GPSDecoder*> itFlush(_decodersRaw); … … 652 652 QString prn(obs._prn.toString().c_str()); 653 653 QString type = QString("%1").arg(obs._type); 654 emit (newMessage(_staID + " (" + prn.toLatin1() + ")" + ": Wrong observation epoch(s)" + "( MT: " + type.toLatin1() + ")", false));654 emit newLogRecord(t_logRecord::message(t_logRecord::warning, _staID + " (" + prn.toLatin1() + ")" + ": Wrong observation epoch(s)" + "( MT: " + type.toLatin1() + ")"), false); 655 655 continue; 656 656 } … … 666 666 bncTime oldTime = it.value(); 667 667 if (obsTime < oldTime) { 668 emit (newMessage(_staID + ": old observation " + prn.toLatin1(), false));668 emit newLogRecord(t_logRecord::message(t_logRecord::warning, _staID + ": old observation " + prn.toLatin1()), false); 669 669 continue; 670 670 } else if (obsTime == oldTime) { 671 emit (newMessage(_staID + ": observation coming more than once " + prn.toLatin1(), false));671 emit newLogRecord(t_logRecord::message(t_logRecord::warning, _staID + ": observation coming more than once " + prn.toLatin1()), false); 672 672 continue; 673 673 } … … 691 691 } 692 692 catch (Exception& exc) { 693 emit (newMessage(_staID + " " + exc.what(), true));693 emit newLogRecord(t_logRecord::message(t_logRecord::error, _staID + " " + exc.what()), true); 694 694 _isToBeDeleted = true; 695 695 } 696 696 catch (std::exception& exc) { 697 emit (newMessage(_staID + " " + exc.what(), true));697 emit newLogRecord(t_logRecord::message(t_logRecord::error, _staID + " " + exc.what()), true); 698 698 _isToBeDeleted = true; 699 699 } 700 700 catch (const string& error) { 701 emit (newMessage(_staID + " ERROR: " + error.c_str(), true));701 emit newLogRecord(t_logRecord::message(t_logRecord::error, _staID + " ERROR: " + error.c_str()), true); 702 702 _isToBeDeleted = true; 703 703 } 704 704 catch (const char* error) { 705 emit (newMessage(_staID + " ERROR: " + error, true));705 emit newLogRecord(t_logRecord::message(t_logRecord::error, _staID + " ERROR: " + error), true); 706 706 _isToBeDeleted = true; 707 707 } 708 708 catch (QString error) { 709 emit (newMessage(_staID + " ERROR: " + error.toStdString().c_str(), true));709 emit newLogRecord(t_logRecord::message(t_logRecord::error, _staID + " ERROR: " + error.toStdString().c_str()), true); 710 710 _isToBeDeleted = true; 711 711 } 712 712 catch (...) { 713 emit (newMessage(_staID + " bncGetThread: unknown exception", true));713 emit newLogRecord(t_logRecord::message(t_logRecord::error, _staID + " bncGetThread: unknown exception"), true); 714 714 _isToBeDeleted = true; 715 715 } … … 838 838 QString type = QString("%1 ").arg(decoder()->_typeList[ii]._type); 839 839 QString size = (decoder()->_typeList[ii]._size) ? QString("(size %1)").arg(decoder()->_typeList[ii]._size) : ""; 840 emit(newMessage(_staID + ": Received message type " + type.toLatin1() + size.toLatin1(), true)); 840 t_logRecord rec(t_logRecord::info, "stream", "stream_content", _staID, 841 _staID + ": Received message type " + type.toLatin1() + size.toLatin1()); 842 rec.add("message_type", int(decoder()->_typeList[ii]._type)); 843 if (decoder()->_typeList[ii]._size) { 844 rec.add("size", int(decoder()->_typeList[ii]._size)); 845 } 846 emit newLogRecord(rec, true); 841 847 } 842 848 … … 908 914 str << " " << rnxTypes[iType]; 909 915 } 910 emit (newMessage(_staID + ": Observation Types: " + msg.toLatin1(), true));916 emitContent(_staID + ": Observation Types: " + msg.toLatin1(), true); 911 917 } 912 918 } … … 916 922 for (int ii = 0; ii < decoder()->_antType.size(); ii++) { 917 923 QString ant1 = QString(": Antenna Descriptor: %1 ").arg(decoder()->_antType[ii]._descriptor); 918 emit (newMessage(_staID + ant1.toLatin1(), true));924 emitContent(_staID + ant1.toLatin1(), true); 919 925 if (strlen(decoder()->_antType[ii]._serialnumber)) { 920 926 QString ant2 = QString(": Antenna Serial Number: %1 ").arg(decoder()->_antType[ii]._serialnumber); 921 emit (newMessage(_staID + ant2.toLatin1(), true));927 emitContent(_staID + ant2.toLatin1(), true); 922 928 } 923 929 } … … 936 942 ant2 = QString("%1 ").arg(decoder()->_antList[ii]._yy, 0, 'f', 4).toLatin1(); 937 943 ant3 = QString("%1 ").arg(decoder()->_antList[ii]._zz, 0, 'f', 4).toLatin1(); 938 emit (newMessage(_staID + ": " + antT + " (ITRF) X " + ant1 + "m", true));939 emit (newMessage(_staID + ": " + antT + " (ITRF) Y " + ant2 + "m", true));940 emit (newMessage(_staID + ": " + antT + " (ITRF) Z " + ant3 + "m", true));944 emitContent(_staID + ": " + antT + " (ITRF) X " + ant1 + "m", true); 945 emitContent(_staID + ": " + antT + " (ITRF) Y " + ant2 + "m", true); 946 emitContent(_staID + ": " + antT + " (ITRF) Z " + ant3 + "m", true); 941 947 double hh = 0.0; 942 948 if (decoder()->_antList[ii]._height_f) { 943 949 hh = decoder()->_antList[ii]._height; 944 950 QByteArray ant4 = QString("%1 ").arg(hh, 0, 'f', 4).toLatin1(); 945 emit (newMessage(946 _staID + ": Antenna height above marker " + ant4 + "m", true) );951 emitContent( 952 _staID + ": Antenna height above marker " + ant4 + "m", true); 947 953 } 948 954 emit(newAntCrd(_staID, decoder()->_antList[ii]._xx, … … 956 962 QString rec2 = QString(": Receiver Firmware Version: %1 ").arg(decoder()->_recType[ii]._firmware); 957 963 QString rec3 = QString(": Receiver Serial Number: %1 ").arg(decoder()->_recType[ii]._serialnumber); 958 emit (newMessage(_staID + rec1.toLatin1(), true));959 emit (newMessage(_staID + rec2.toLatin1(), true));960 emit (newMessage(_staID + rec3.toLatin1(), true));964 emitContent(_staID + rec1.toLatin1(), true); 965 emitContent(_staID + rec2.toLatin1(), true); 966 emitContent(_staID + rec3.toLatin1(), true); 961 967 } 962 968 … … 973 979 if (!allFound) { 974 980 _gloSlots.sort(); 975 emit (newMessage(981 emitContent( 976 982 _staID + ": GLONASS Slot:Freq " + _gloSlots.join(" ").toLatin1(), 977 true) );983 true); 978 984 } 979 985 } … … 983 989 if (decoder()->_gloBiasInfo.changed()) { 984 990 QString gloCodePhaseBiases = decoder()->_gloBiasInfo.toString(); 985 emit (newMessage(_staID + gloCodePhaseBiases.toLatin1(), true));991 emitContent(_staID + gloCodePhaseBiases.toLatin1(), true); 986 992 decoder()->_gloBiasInfo.setChanged(false); 987 993 } … … 995 1001 QString coordinateEpoch = QString(": Service CRS Coordinate Epoch: %1 ").arg(decoder()->_serviceCrs[ii]._coordinateEpoch); 996 1002 //QString ce = QString(": CE: %1 ").arg(decoder()->_serviceCrs[ii]._CE); 997 emit (newMessage(_staID + servicecrsname.toLatin1(), true));998 emit (newMessage(_staID + coordinateEpoch.toLatin1(), true));999 //emit (newMessage(_staID + ce.toLatin1(), true));1003 emitContent(_staID + servicecrsname.toLatin1(), true); 1004 emitContent(_staID + coordinateEpoch.toLatin1(), true); 1005 //emitContent(_staID + ce.toLatin1(), true); 1000 1006 } 1001 1007 // RTCM CRS … … 1004 1010 QString anchor = QString(": RTCM CRS Anchor: %1 ").arg(decoder()->_rtcmCrs[ii]._anchor); 1005 1011 QString platenumber = QString(": RTCM CRS Plate Number: %1 ").arg(decoder()->_rtcmCrs[ii]._plateNumber); 1006 emit (newMessage(_staID + rtcmcrsname.toLatin1(), true));1007 emit (newMessage(_staID + anchor.toLatin1(), true));1008 emit (newMessage(_staID + platenumber.toLatin1(), true));1012 emitContent(_staID + rtcmcrsname.toLatin1(), true); 1013 emitContent(_staID + anchor.toLatin1(), true); 1014 emitContent(_staID + platenumber.toLatin1(), true); 1009 1015 for (int i = 0; i<decoder()->_rtcmCrs[ii]._databaseLinks.size(); i++) { 1010 1016 QString dblink = QString(": Database Link: %1 ").arg(decoder()->_rtcmCrs[ii]._databaseLinks[i]); 1011 emit (newMessage(_staID + dblink.toLatin1(), true));1017 emitContent(_staID + dblink.toLatin1(), true); 1012 1018 } 1013 1019 } … … 1030 1036 .arg(helmertPar._oxr).arg(helmertPar._oyr).arg(helmertPar._ozr); 1031 1037 QString parscale = QString(": MT1301 Helmert Par Scale: sc = %1, scr = %2").arg(helmertPar._sc).arg(helmertPar._scr); 1032 emit (newMessage(_staID + sourcename.toLatin1(), true));1033 emit (newMessage(_staID + targetname.toLatin1(), true));1034 emit (newMessage(_staID + sysidentnum.toLatin1(), true));1035 emit (newMessage(_staID + trafomessageind.toLatin1(), true));1036 emit (newMessage(_staID + epoch.toLatin1(), true));1037 emit (newMessage(_staID + partrans.toLatin1(), true));1038 emit (newMessage(_staID + parrot.toLatin1(), true));1039 emit (newMessage(_staID + parscale.toLatin1(), true));1038 emitContent(_staID + sourcename.toLatin1(), true); 1039 emitContent(_staID + targetname.toLatin1(), true); 1040 emitContent(_staID + sysidentnum.toLatin1(), true); 1041 emitContent(_staID + trafomessageind.toLatin1(), true); 1042 emitContent(_staID + epoch.toLatin1(), true); 1043 emitContent(_staID + partrans.toLatin1(), true); 1044 emitContent(_staID + parrot.toLatin1(), true); 1045 emitContent(_staID + parscale.toLatin1(), true); 1040 1046 } 1041 1047 } … … 1124 1130 void bncGetThread::slotNewNMEAConnection() { 1125 1131 _nmeaSockets->push_back(_nmeaServer->nextPendingConnection()); 1126 emit(newMessage( 1127 QString("New PPP client on port: # %1").arg(_nmeaSockets->size()).toLatin1(), 1128 true)); 1132 emit newLogRecord(t_logRecord::message(t_logRecord::info, QString("New PPP client on port: # %1").arg(_nmeaSockets->size()).toLatin1()), true); 1129 1133 } 1130 1134 … … 1157 1161 emit newLogRecord(rec, true); 1158 1162 } 1163 1164 // Content of the stream found by the RTCM scan (miscScanRTCM) 1165 //////////////////////////////////////////////////////////////////////////// 1166 void bncGetThread::emitContent(const QByteArray& msg, bool showOnScreen) { 1167 emit newLogRecord(t_logRecord(t_logRecord::info, "stream", "stream_content", _staID, msg), 1168 showOnScreen); 1169 }
Note:
See TracChangeset
for help on using the changeset viewer.
