Changeset 10776 in ntrip
- Timestamp:
- Nov 5, 2025, 1:33:06 PM (12 days ago)
- Location:
- trunk/BNC/src
- Files:
-
- 6 edited
-
bncgetthread.cpp (modified) (7 diffs)
-
bncgetthread.h (modified) (2 diffs)
-
bncnetquerys.cpp (modified) (7 diffs)
-
bncserialport.cpp (modified) (1 diff)
-
bncwindow.cpp (modified) (3 diffs)
-
src.pri (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/bncgetthread.cpp
r10772 r10776 52 52 #include <QTableWidget> 53 53 #include <QTime> 54 #include <QtSerialPort/QSerialPort>55 54 56 55 #include "bncgetthread.h" … … 72 71 #include "RTCM/RTCM2Decoder.h" 73 72 #include "RTCM3/RTCM3Decoder.h" 73 #include "serial/qextserialport.h" 74 74 75 75 using namespace std; … … 178 178 if (!_staID.isEmpty() 179 179 && settings.value("serialMountPoint").toString() == _staID) { 180 _serialPort = new QSerialPort(portString); 180 _serialPort = new QextSerialPort(portString); 181 _serialPort->setTimeout(0, 100); 181 182 182 183 // Baud Rate 183 184 // --------- 184 185 QString hlp = settings.value("serialBaudRate").toString(); 185 if (hlp == "1200") { 186 _serialPort->setBaudRate(QSerialPort::Baud1200); 186 if (hlp == "110") { 187 _serialPort->setBaudRate(BAUD110); 188 } else if (hlp == "300") { 189 _serialPort->setBaudRate(BAUD300); 190 } else if (hlp == "600") { 191 _serialPort->setBaudRate(BAUD600); 192 } else if (hlp == "1200") { 193 _serialPort->setBaudRate(BAUD1200); 187 194 } else if (hlp == "2400") { 188 _serialPort->setBaudRate( QSerialPort::Baud2400);195 _serialPort->setBaudRate(BAUD2400); 189 196 } else if (hlp == "4800") { 190 _serialPort->setBaudRate( QSerialPort::Baud4800);197 _serialPort->setBaudRate(BAUD4800); 191 198 } else if (hlp == "9600") { 192 _serialPort->setBaudRate( QSerialPort::Baud9600);199 _serialPort->setBaudRate(BAUD9600); 193 200 } else if (hlp == "19200") { 194 _serialPort->setBaudRate( QSerialPort::Baud19200);201 _serialPort->setBaudRate(BAUD19200); 195 202 } else if (hlp == "38400") { 196 _serialPort->setBaudRate( QSerialPort::Baud38400);203 _serialPort->setBaudRate(BAUD38400); 197 204 } else if (hlp == "57600") { 198 _serialPort->setBaudRate( QSerialPort::Baud57600);205 _serialPort->setBaudRate(BAUD57600); 199 206 } else if (hlp == "115200") { 200 _serialPort->setBaudRate( QSerialPort::Baud115200);207 _serialPort->setBaudRate(BAUD115200); 201 208 } 202 209 … … 205 212 hlp = settings.value("serialParity").toString(); 206 213 if (hlp == "NONE") { 207 _serialPort->setParity( QSerialPort::NoParity);214 _serialPort->setParity(PAR_NONE); 208 215 } else if (hlp == "ODD") { 209 _serialPort->setParity( QSerialPort::OddParity);216 _serialPort->setParity(PAR_ODD); 210 217 } else if (hlp == "EVEN") { 211 _serialPort->setParity( QSerialPort::EvenParity);218 _serialPort->setParity(PAR_EVEN); 212 219 } else if (hlp == "SPACE") { 213 _serialPort->setParity(QSerialPort::SpaceParity); 214 } else if (hlp == "MARK") { 215 _serialPort->setParity( QSerialPort::MarkParity); 220 _serialPort->setParity(PAR_SPACE); 216 221 } 217 222 … … 220 225 hlp = settings.value("serialDataBits").toString(); 221 226 if (hlp == "5") { 222 _serialPort->setDataBits( QSerialPort::Data5);227 _serialPort->setDataBits(DATA_5); 223 228 } else if (hlp == "6") { 224 _serialPort->setDataBits( QSerialPort::Data6);229 _serialPort->setDataBits(DATA_6); 225 230 } else if (hlp == "7") { 226 _serialPort->setDataBits( QSerialPort::Data7);231 _serialPort->setDataBits(DATA_7); 227 232 } else if (hlp == "8") { 228 _serialPort->setDataBits( QSerialPort::Data8);233 _serialPort->setDataBits(DATA_8); 229 234 } 230 235 // Stop Bits … … 232 237 hlp = settings.value("serialStopBits").toString(); 233 238 if (hlp == "1") { 234 _serialPort->setStopBits(QSerialPort::OneStop); 235 } else if (hlp == "1.5") { 236 _serialPort->setStopBits(QSerialPort::OneAndHalfStop); 239 _serialPort->setStopBits(STOP_1); 237 240 } else if (hlp == "2") { 238 _serialPort->setStopBits( QSerialPort::TwoStop);241 _serialPort->setStopBits(STOP_2); 239 242 } 240 243 … … 243 246 hlp = settings.value("serialFlowControl").toString(); 244 247 if (hlp == "XONXOFF") { 245 _serialPort->setFlowControl( QSerialPort::SoftwareControl);248 _serialPort->setFlowControl(FLOW_XONXOFF); 246 249 } else if (hlp == "HARDWARE") { 247 _serialPort->setFlowControl( QSerialPort::HardwareControl);250 _serialPort->setFlowControl(FLOW_HARDWARE); 248 251 } else { 249 _serialPort->setFlowControl( QSerialPort::NoFlowControl);252 _serialPort->setFlowControl(FLOW_OFF); 250 253 } 251 254 252 255 // Open Serial Port 253 256 // ---------------- 254 //_serialPort->open(QIODevice::ReadWrite | QIODevice::Unbuffered); 255 _serialPort->open(QIODevice::ReadWrite); 257 _serialPort->open(QIODevice::ReadWrite | QIODevice::Unbuffered); 256 258 msleep(100); //sleep 0.1 sec 257 259 if (!_serialPort->isOpen()) { -
trunk/BNC/src/bncgetthread.h
r10766 r10776 40 40 41 41 class GPSDecoder; 42 class QSerialPort; 42 class QextSerialPort; 43 43 class latencyChecker; 44 44 … … 124 124 int _ssrEpoch; 125 125 bncRawFile* _rawFile; 126 QSerialPort* _serialPort;126 QextSerialPort* _serialPort; 127 127 bool _isToBeDeleted; 128 128 bool _rtcmObs; -
trunk/BNC/src/bncnetquerys.cpp
r10766 r10776 92 92 } 93 93 94 _serialPort = new QSerialPort(_portString); 95 94 _serialPort = new QextSerialPort(_portString); cout << "_portString: " << _portString.toStdString().c_str() << endl; 96 95 97 96 // Baud Rate … … 100 99 hlpL = hlp.split(" "); 101 100 hlp = hlpL[hlpL.size()-1]; 102 if (hlp == "1200") { 103 _serialPort->setBaudRate(QSerialPort::Baud1200); 101 if (hlp == "110") { 102 _serialPort->setBaudRate(BAUD110); 103 } 104 else if (hlp == "300") { 105 _serialPort->setBaudRate(BAUD300); 106 } 107 else if (hlp == "600") { 108 _serialPort->setBaudRate(BAUD600); 109 } 110 else if (hlp == "1200") { 111 _serialPort->setBaudRate(BAUD1200); 104 112 } 105 113 else if (hlp == "2400") { 106 _serialPort->setBaudRate( QSerialPort::Baud2400);114 _serialPort->setBaudRate(BAUD2400); 107 115 } 108 116 else if (hlp == "4800") { 109 _serialPort->setBaudRate( QSerialPort::Baud4800);117 _serialPort->setBaudRate(BAUD4800); 110 118 } 111 119 else if (hlp == "9600") { 112 _serialPort->setBaudRate( QSerialPort::Baud9600);120 _serialPort->setBaudRate(BAUD9600); 113 121 } 114 122 else if (hlp == "19200") { 115 _serialPort->setBaudRate( QSerialPort::Baud19200);123 _serialPort->setBaudRate(BAUD19200); 116 124 } 117 125 else if (hlp == "38400") { 118 _serialPort->setBaudRate( QSerialPort::Baud38400);126 _serialPort->setBaudRate(BAUD38400); 119 127 } 120 128 else if (hlp == "57600") { 121 _serialPort->setBaudRate( QSerialPort::Baud57600);129 _serialPort->setBaudRate(BAUD57600); 122 130 } 123 131 else if (hlp == "115200") { 124 _serialPort->setBaudRate( QSerialPort::Baud115200);132 _serialPort->setBaudRate(BAUD115200); 125 133 } 126 134 … … 129 137 hlp = hlpL[hlpL.size()-4].toUpper(); 130 138 if (hlp == "NONE") { 131 _serialPort->setParity( QSerialPort::NoParity);139 _serialPort->setParity(PAR_NONE); 132 140 } 133 141 else if (hlp == "ODD") { 134 _serialPort->setParity( QSerialPort::OddParity);142 _serialPort->setParity(PAR_ODD); 135 143 } 136 144 else if (hlp == "EVEN") { 137 _serialPort->setParity( QSerialPort::EvenParity);145 _serialPort->setParity(PAR_EVEN); 138 146 } 139 147 else if (hlp == "SPACE") { 140 _serialPort->setParity(QSerialPort::SpaceParity); 141 } 142 else if (hlp == "MARK") { 143 _serialPort->setParity(QSerialPort::MarkParity); 144 } 145 148 _serialPort->setParity(PAR_SPACE); 149 } 146 150 147 151 // Data Bits … … 149 153 hlp = hlpL[hlpL.size()-5]; 150 154 if (hlp == "5") { 151 _serialPort->setDataBits( QSerialPort::Data5);155 _serialPort->setDataBits(DATA_5); 152 156 } 153 157 else if (hlp == "6") { 154 _serialPort->setDataBits( QSerialPort::Data6);158 _serialPort->setDataBits(DATA_6); 155 159 } 156 160 else if (hlp == "7") { 157 _serialPort->setDataBits( QSerialPort::Data6);161 _serialPort->setDataBits(DATA_7); 158 162 } 159 163 else if (hlp == "8") { 160 _serialPort->setDataBits( QSerialPort::Data7);164 _serialPort->setDataBits(DATA_8); 161 165 } 162 166 … … 165 169 hlp = hlpL[hlpL.size()-3]; 166 170 if (hlp == "1") { 167 _serialPort->setStopBits(QSerialPort::OneStop); 168 } 169 else if (hlp == "1.5") { 170 _serialPort->setStopBits(QSerialPort::OneAndHalfStop); 171 _serialPort->setStopBits(STOP_1); 171 172 } 172 173 else if (hlp == "2") { 173 _serialPort->setStopBits( QSerialPort::TwoStop);174 _serialPort->setStopBits(STOP_2); 174 175 } 175 176 … … 178 179 hlp = hlpL[hlpL.size()-2].toUpper(); 179 180 if (hlp == "XONXOFF") { 180 _serialPort->setFlowControl( QSerialPort::SoftwareControl);181 _serialPort->setFlowControl(FLOW_XONXOFF); 181 182 } 182 183 else if (hlp == "HARDWARE") { 183 _serialPort->setFlowControl( QSerialPort::HardwareControl);184 _serialPort->setFlowControl(FLOW_HARDWARE); 184 185 } 185 186 else { 186 _serialPort->setFlowControl(QSerialPort::NoFlowControl); 187 } 188 189 _status = running; 190 191 //_serialPort->open(QIODevice::ReadWrite|QIODevice::Unbuffered); 192 _serialPort->open(QIODevice::ReadWrite); 187 _serialPort->setFlowControl(FLOW_OFF); 188 } 189 190 _serialPort->open(QIODevice::ReadWrite|QIODevice::Unbuffered); 193 191 194 192 if (!_serialPort->isOpen()) { 195 193 emit newMessage(_url.path().toLatin1().replace(0,1,"") + ": Cannot open serial port " + _portString.toLatin1() 196 + ": " +_serialPort->errorString().toLatin1(), true); 194 + ": " + _serialPort->errorString().toLatin1(), true); 197 195 delete _serialPort; 198 196 _serialPort = 0; … … 200 198 return; 201 199 } 200 else { 201 emit(newMessage(_url.path().toLatin1().replace(0,1,"") + ": Serial port " + _portString.toLatin1() 202 + " is connected: " , true)); 203 _status = running; 204 } 202 205 } 203 206 -
trunk/BNC/src/bncserialport.cpp
r10766 r10776 74 74 _serialCountryLineEdit = new QLineEdit(); 75 75 76 _serialBaudRateComboBox->addItems(QString("1200,2400,4800,9600,19200,38400,57600,115200").split(",")); 76 _serialBaudRateComboBox->addItems(QString("110,300,600," 77 "1200,2400,4800,9600,19200,38400,57600,115200").split(",")); 77 78 _serialFlowControlComboBox->addItems(QString("OFF,XONXOFF,HARDWARE").split(",")); 78 79 _serialDataBitsComboBox->addItems(QString("5,6,7,8").split(",")); 79 _serialParityComboBox->addItems(QString("NONE,ODD,EVEN,SPACE ,MARK").split(","));80 _serialStopBitsComboBox->addItems(QString("1, 1.5,2").split(","));80 _serialParityComboBox->addItems(QString("NONE,ODD,EVEN,SPACE").split(",")); 81 _serialStopBitsComboBox->addItems(QString("1,2").split(",")); 81 82 82 83 _serialBaudRateComboBox->setCurrentIndex(7); -
trunk/BNC/src/bncwindow.cpp
r10773 r10776 341 341 _serialPortNameLineEdit = new QLineEdit(settings.value("serialPortName").toString()); 342 342 _serialBaudRateComboBox = new QComboBox(); 343 _serialBaudRateComboBox->addItems(QString("1200,2400,4800,9600,19200,38400,57600,115200").split(",")); 343 _serialBaudRateComboBox->addItems(QString("110,300,600," 344 "1200,2400,4800,9600,19200,38400,57600,115200").split(",")); 344 345 int kk = _serialBaudRateComboBox->findText(settings.value("serialBaudRate").toString()); 345 346 if (kk != -1) { … … 359 360 } 360 361 _serialParityComboBox = new QComboBox(); 361 _serialParityComboBox->addItems(QString("NONE,ODD,EVEN,SPACE ,MARK").split(","));362 _serialParityComboBox->addItems(QString("NONE,ODD,EVEN,SPACE").split(",")); 362 363 kk = _serialParityComboBox->findText(settings.value("serialParity").toString()); 363 364 if (kk != -1) { … … 365 366 } 366 367 _serialStopBitsComboBox = new QComboBox(); 367 _serialStopBitsComboBox->addItems(QString("1, 1.5,2").split(","));368 _serialStopBitsComboBox->addItems(QString("1,2").split(",")); 368 369 kk = _serialStopBitsComboBox->findText(settings.value("serialStopBits").toString()); 369 370 if (kk != -1) { -
trunk/BNC/src/src.pri
r10766 r10776 9 9 QT += widgets 10 10 QT += core 11 QT += serialport12 11 13 12 unix:QMAKE_CFLAGS_RELEASE -= -O2 … … 79 78 combination/bnccomb.h combination/bncbiassnx.h 80 79 80 HEADERS += serial/qextserialbase.h serial/qextserialport.h 81 unix:HEADERS += serial/posix_qextserialport.h 82 win32:HEADERS += serial/win_qextserialport.h 81 83 82 84 SOURCES = bncgetthread.cpp bncwindow.cpp bnctabledlg.cpp \ … … 119 121 combination/bnccomb.cpp combination/bncbiassnx.cpp 120 122 123 SOURCES += serial/qextserialbase.cpp serial/qextserialport.cpp 124 unix:SOURCES += serial/posix_qextserialport.cpp 125 win32:SOURCES += serial/win_qextserialport.cpp 126 121 127 RC_FILE = bnc.rc 122 128
Note:
See TracChangeset
for help on using the changeset viewer.
