source: ntrip/trunk/BNC/src/bncgetthread.cpp@ 5900

Last change on this file since 5900 was 5900, checked in by mervart, 10 years ago
File size: 21.5 KB
Line 
1// Part of BNC, a utility for retrieving decoding and
2// converting GNSS data streams from NTRIP broadcasters.
3//
4// Copyright (C) 2007
5// German Federal Agency for Cartography and Geodesy (BKG)
6// http://www.bkg.bund.de
7// Czech Technical University Prague, Department of Geodesy
8// http://www.fsv.cvut.cz
9//
10// Email: euref-ip@bkg.bund.de
11//
12// This program is free software; you can redistribute it and/or
13// modify it under the terms of the GNU General Public License
14// as published by the Free Software Foundation, version 2.
15//
16// This program is distributed in the hope that it will be useful,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19// GNU General Public License for more details.
20//
21// You should have received a copy of the GNU General Public License
22// along with this program; if not, write to the Free Software
23// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24
25/* -------------------------------------------------------------------------
26 * BKG NTRIP Client
27 * -------------------------------------------------------------------------
28 *
29 * Class: bncGetThread
30 *
31 * Purpose: Thread that retrieves data from NTRIP caster
32 *
33 * Author: L. Mervart
34 *
35 * Created: 24-Dec-2005
36 *
37 * Changes:
38 *
39 * -----------------------------------------------------------------------*/
40
41#include <stdlib.h>
42#include <iomanip>
43#include <sstream>
44
45#include <QFile>
46#include <QTextStream>
47#include <QMutex>
48#include <QtNetwork>
49#include <QTime>
50
51#include "bncgetthread.h"
52#include "bnctabledlg.h"
53#include "bnccore.h"
54#include "bncutils.h"
55#include "bnczerodecoder.h"
56#include "bncnetqueryv0.h"
57#include "bncnetqueryv1.h"
58#include "bncnetqueryv2.h"
59#include "bncnetqueryrtp.h"
60#include "bncnetqueryudp.h"
61#include "bncnetqueryudp0.h"
62#include "bncnetquerys.h"
63#include "bncsettings.h"
64#include "latencychecker.h"
65#include "upload/bncrtnetdecoder.h"
66#include "RTCM/RTCM2Decoder.h"
67#include "RTCM3/RTCM3Decoder.h"
68#include "serial/qextserialport.h"
69
70using namespace std;
71
72// Constructor 1
73////////////////////////////////////////////////////////////////////////////
74bncGetThread::bncGetThread(bncRawFile* rawFile) {
75
76 _rawFile = rawFile;
77 _format = rawFile->format();
78 _staID = rawFile->staID();
79 _rawOutput = false;
80 _ntripVersion = "N";
81
82 initialize();
83}
84
85// Constructor 2
86////////////////////////////////////////////////////////////////////////////
87bncGetThread::bncGetThread(const QUrl& mountPoint,
88 const QByteArray& format,
89 const QByteArray& latitude,
90 const QByteArray& longitude,
91 const QByteArray& nmea,
92 const QByteArray& ntripVersion) {
93 _rawFile = 0;
94 _mountPoint = mountPoint;
95 _staID = mountPoint.path().mid(1).toAscii();
96 _format = format;
97 _latitude = latitude;
98 _longitude = longitude;
99 _nmea = nmea;
100 _ntripVersion = ntripVersion;
101
102 bncSettings settings;
103 if (!settings.value("rawOutFile").toString().isEmpty()) {
104 _rawOutput = true;
105 } else {
106 _rawOutput = false;
107 }
108
109 initialize();
110 initDecoder();
111}
112
113// Initialization (common part of the constructor)
114////////////////////////////////////////////////////////////////////////////
115void bncGetThread::initialize() {
116
117 bncSettings settings;
118
119 setTerminationEnabled(true);
120
121 connect(this, SIGNAL(newMessage(QByteArray,bool)),
122 BNC_CORE, SLOT(slotMessage(const QByteArray,bool)));
123
124 _isToBeDeleted = false;
125 _query = 0;
126 _nextSleep = 0;
127 _miscMount = settings.value("miscMount").toString();
128 _decoder = 0;
129
130 // Serial Port
131 // -----------
132 _serialNMEA = NO_NMEA;
133 _serialOutFile = 0;
134 _serialPort = 0;
135
136 if (!_staID.isEmpty() &&
137 settings.value("serialMountPoint").toString() == _staID) {
138 _serialPort = new QextSerialPort(settings.value("serialPortName").toString() );
139 _serialPort->setTimeout(0,100);
140
141 // Baud Rate
142 // ---------
143 QString hlp = settings.value("serialBaudRate").toString();
144 if (hlp == "110") {
145 _serialPort->setBaudRate(BAUD110);
146 }
147 else if (hlp == "300") {
148 _serialPort->setBaudRate(BAUD300);
149 }
150 else if (hlp == "600") {
151 _serialPort->setBaudRate(BAUD600);
152 }
153 else if (hlp == "1200") {
154 _serialPort->setBaudRate(BAUD1200);
155 }
156 else if (hlp == "2400") {
157 _serialPort->setBaudRate(BAUD2400);
158 }
159 else if (hlp == "4800") {
160 _serialPort->setBaudRate(BAUD4800);
161 }
162 else if (hlp == "9600") {
163 _serialPort->setBaudRate(BAUD9600);
164 }
165 else if (hlp == "19200") {
166 _serialPort->setBaudRate(BAUD19200);
167 }
168 else if (hlp == "38400") {
169 _serialPort->setBaudRate(BAUD38400);
170 }
171 else if (hlp == "57600") {
172 _serialPort->setBaudRate(BAUD57600);
173 }
174 else if (hlp == "115200") {
175 _serialPort->setBaudRate(BAUD115200);
176 }
177
178 // Parity
179 // ------
180 hlp = settings.value("serialParity").toString();
181 if (hlp == "NONE") {
182 _serialPort->setParity(PAR_NONE);
183 }
184 else if (hlp == "ODD") {
185 _serialPort->setParity(PAR_ODD);
186 }
187 else if (hlp == "EVEN") {
188 _serialPort->setParity(PAR_EVEN);
189 }
190 else if (hlp == "SPACE") {
191 _serialPort->setParity(PAR_SPACE);
192 }
193
194 // Data Bits
195 // ---------
196 hlp = settings.value("serialDataBits").toString();
197 if (hlp == "5") {
198 _serialPort->setDataBits(DATA_5);
199 }
200 else if (hlp == "6") {
201 _serialPort->setDataBits(DATA_6);
202 }
203 else if (hlp == "7") {
204 _serialPort->setDataBits(DATA_7);
205 }
206 else if (hlp == "8") {
207 _serialPort->setDataBits(DATA_8);
208 }
209 hlp = settings.value("serialStopBits").toString();
210 if (hlp == "1") {
211 _serialPort->setStopBits(STOP_1);
212 }
213 else if (hlp == "2") {
214 _serialPort->setStopBits(STOP_2);
215 }
216
217 // Flow Control
218 // ------------
219 hlp = settings.value("serialFlowControl").toString();
220 if (hlp == "XONXOFF") {
221 _serialPort->setFlowControl(FLOW_XONXOFF);
222 }
223 else if (hlp == "HARDWARE") {
224 _serialPort->setFlowControl(FLOW_HARDWARE);
225 }
226 else {
227 _serialPort->setFlowControl(FLOW_OFF);
228 }
229
230 // Open Serial Port
231 // ----------------
232 _serialPort->open(QIODevice::ReadWrite|QIODevice::Unbuffered);
233 if (!_serialPort->isOpen()) {
234 delete _serialPort;
235 _serialPort = 0;
236 emit(newMessage((_staID + ": Cannot open serial port\n"), true));
237 }
238 connect(_serialPort, SIGNAL(readyRead()),
239 this, SLOT(slotSerialReadyRead()));
240
241 // Automatic NMEA
242 // --------------
243 if (settings.value("serialAutoNMEA").toString() == "Auto") {
244 _serialNMEA = AUTO_NMEA;
245
246 QString fName = settings.value("serialFileNMEA").toString();
247 if (!fName.isEmpty()) {
248 _serialOutFile = new QFile(fName);
249 if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked) {
250 _serialOutFile->open(QIODevice::WriteOnly | QIODevice::Append);
251 }
252 else {
253 _serialOutFile->open(QIODevice::WriteOnly);
254 }
255 }
256 }
257
258 // Manual NMEA
259 // -----------
260 else {
261 _serialNMEA = MANUAL_NMEA;
262 }
263 }
264
265 if (!_staID.isEmpty()) {
266 _latencyChecker = new latencyChecker(_staID);
267 }
268 else {
269 _latencyChecker = 0;
270 }
271}
272
273// Instantiate the decoder
274//////////////////////////////////////////////////////////////////////////////
275t_irc bncGetThread::initDecoder() {
276
277 _decoder = 0;
278
279 if (_format.indexOf("RTCM_2") != -1 || _format.indexOf("RTCM2") != -1 ||
280 _format.indexOf("RTCM 2") != -1 ) {
281 emit(newMessage(_staID + ": Get data in RTCM 2.x format", true));
282 _decoder = new RTCM2Decoder(_staID.data());
283 }
284 else if (_format.indexOf("RTCM_3") != -1 || _format.indexOf("RTCM3") != -1 ||
285 _format.indexOf("RTCM 3") != -1 ) {
286 emit(newMessage(_staID + ": Get data in RTCM 3.x format", true));
287 RTCM3Decoder* newDecoder = new RTCM3Decoder(_staID, _rawFile);
288 _decoder = newDecoder;
289 connect((RTCM3Decoder*) newDecoder, SIGNAL(newMessage(QByteArray,bool)),
290 this, SIGNAL(newMessage(QByteArray,bool)));
291 }
292 else if (_format.indexOf("ZERO") != -1) {
293 emit(newMessage(_staID + ": Get data in original format", true));
294 _decoder = new bncZeroDecoder(_staID);
295 }
296 else if (_format.indexOf("RTNET") != -1) {
297 emit(newMessage(_staID + ": Get data in RTNet format", true));
298 _decoder = new bncRtnetDecoder();
299 }
300 else {
301 emit(newMessage(_staID + ": Unknown data format " + _format, true));
302 _isToBeDeleted = true;
303 return failure;
304 }
305
306 msleep(100); //sleep 0.1 sec
307
308 _decoder->initRinex(_staID, _mountPoint, _latitude, _longitude,
309 _nmea, _ntripVersion);
310
311 if (_rawFile) {
312 _decodersRaw[_staID] = _decoder;
313 }
314
315 return success;
316}
317
318// Current decoder in use
319////////////////////////////////////////////////////////////////////////////
320GPSDecoder* bncGetThread::decoder() {
321 if (!_rawFile) {
322 return _decoder;
323 }
324 else {
325 if (_decodersRaw.contains(_staID) || initDecoder() == success) {
326 return _decodersRaw[_staID];
327 }
328 }
329 return 0;
330}
331
332// Destructor
333////////////////////////////////////////////////////////////////////////////
334bncGetThread::~bncGetThread() {
335 if (isRunning()) {
336 wait();
337 }
338 if (_query) {
339 _query->stop();
340 _query->deleteLater();
341 }
342 if (_rawFile) {
343 QMapIterator<QString, GPSDecoder*> it(_decodersRaw);
344 while (it.hasNext()) {
345 it.next();
346 delete it.value();
347 }
348 }
349 else {
350 delete _decoder;
351 }
352 delete _rawFile;
353 delete _serialOutFile;
354 delete _serialPort;
355 delete _latencyChecker;
356 emit getThreadFinished(_staID);
357}
358
359//
360////////////////////////////////////////////////////////////////////////////
361void bncGetThread::terminate() {
362 _isToBeDeleted = true;
363 if (!isRunning()) {
364 delete this;
365 }
366}
367
368// Run
369////////////////////////////////////////////////////////////////////////////
370void bncGetThread::run() {
371
372 while (true) {
373 try {
374 if (_isToBeDeleted) {
375 QThread::exit(0);
376 this->deleteLater();
377 return;
378 }
379
380 if (tryReconnect() != success) {
381 if (_latencyChecker) {
382 _latencyChecker->checkReconnect();
383 }
384 continue;
385 }
386
387 // Delete old observations
388 // -----------------------
389 if (_rawFile) {
390 QMapIterator<QString, GPSDecoder*> itDec(_decodersRaw);
391 while (itDec.hasNext()) {
392 itDec.next();
393 GPSDecoder* decoder = itDec.value();
394 decoder->_obsList.clear();
395 }
396 }
397 else {
398 _decoder->_obsList.clear();
399 }
400
401 // Read Data
402 // ---------
403 QByteArray data;
404 if (_query) {
405 _query->waitForReadyRead(data);
406 }
407 else if (_rawFile) {
408 data = _rawFile->readChunk();
409 _format = _rawFile->format();
410 _staID = _rawFile->staID();
411
412 if (data.isEmpty()) {
413 cout << "no more data" << endl;
414 BNC_CORE->stopCombination();
415 BNC_CORE->stopPPP();
416 emit finished();
417 this->deleteLater();
418 return;
419 }
420 }
421 qint64 nBytes = data.size();
422
423 // Timeout, reconnect
424 // ------------------
425 if (nBytes == 0) {
426 if (_latencyChecker) {
427 _latencyChecker->checkReconnect();
428 }
429 emit(newMessage(_staID + ": Data timeout, reconnecting", true));
430 msleep(10000); //sleep 10 sec, G. Weber
431 continue;
432 }
433 else {
434 emit newBytes(_staID, nBytes);
435 emit newRawData(_staID, data);
436 }
437
438 // Output Data
439 // -----------
440 if (_rawOutput) {
441 BNC_CORE->writeRawData(data, _staID, _format);
442 }
443
444 if (_serialPort) {
445 slotSerialReadyRead();
446 _serialPort->write(data);
447 }
448
449 // Decode Data
450 // -----------
451 vector<string> errmsg;
452 if (!decoder()) {
453 _isToBeDeleted = true;
454 continue;
455 }
456 decoder()->_obsList.clear();
457 t_irc irc = decoder()->Decode(data.data(), data.size(), errmsg);
458
459 // Perform various scans and checks
460 // --------------------------------
461 if (_latencyChecker) {
462 _latencyChecker->checkOutage(irc == success);
463 _latencyChecker->checkObsLatency(decoder()->_obsList);
464 _latencyChecker->checkCorrLatency(decoder()->corrGPSEpochTime());
465
466 emit newLatency(_staID, _latencyChecker->currentLatency());
467 }
468
469 scanRTCM();
470
471 // Loop over all observations (observations output)
472 // ------------------------------------------------
473 QListIterator<t_obs> it(decoder()->_obsList);
474
475 QList<t_obs> obsListHlp;
476
477 while (it.hasNext()) {
478 const t_obs& obs = it.next();
479
480 QString prn = QString("%1%2").arg(obs.satSys)
481 .arg(obs.satNum, 2, 10, QChar('0'));
482 long iSec = long(floor(obs.GPSWeeks+0.5));
483 long obsTime = obs.GPSWeek * 7*24*3600 + iSec;
484
485 // Check observation epoch
486 // -----------------------
487 if (!_rawFile) {
488 int week;
489 double sec;
490 currentGPSWeeks(week, sec);
491 long currTime = week * 7*24*3600 + long(sec);
492 const double maxDt = 600.0;
493 if (fabs(currTime - obsTime) > maxDt) {
494 emit( newMessage(_staID + ": Wrong observation epoch(s)", false) );
495 continue;
496 }
497 }
498
499 // Check observations coming twice (e.g. KOUR0 Problem)
500 // ----------------------------------------------------
501 if (!_rawFile) {
502 QMap<QString, long>::const_iterator it = _prnLastEpo.find(prn);
503 if (it != _prnLastEpo.end()) {
504 long oldTime = it.value();
505 if (obsTime < oldTime) {
506 emit( newMessage(_staID +
507 ": old observation " + prn.toAscii(), false));
508 continue;
509 }
510 else if (obsTime == oldTime) {
511 emit( newMessage(_staID +
512 ": observation coming more than once " + prn.toAscii(), false));
513 continue;
514 }
515 }
516 _prnLastEpo[prn] = obsTime;
517 }
518
519 decoder()->dumpRinexEpoch(obs, _format);
520
521 // Save observations
522 // -----------------
523 obsListHlp.append(obs);
524 }
525
526 // Emit signal
527 // -----------
528 if (!_isToBeDeleted && obsListHlp.size() > 0) {
529 emit newObs(_staID, obsListHlp);
530 }
531
532 decoder()->_obsList.clear();
533 }
534 catch (Exception& exc) {
535 emit(newMessage(_staID + " " + exc.what(), true));
536 _isToBeDeleted = true;
537 }
538 catch (...) {
539 emit(newMessage(_staID + " bncGetThread exception", true));
540 _isToBeDeleted = true;
541 }
542 }
543}
544
545// Try Re-Connect
546////////////////////////////////////////////////////////////////////////////
547t_irc bncGetThread::tryReconnect() {
548
549 // Easy Return
550 // -----------
551 if (_query && _query->status() == bncNetQuery::running) {
552 _nextSleep = 0;
553 if (_rawFile) {
554 QMapIterator<QString, GPSDecoder*> itDec(_decodersRaw);
555 while (itDec.hasNext()) {
556 itDec.next();
557 GPSDecoder* decoder = itDec.value();
558 decoder->setRinexReconnectFlag(false);
559 }
560 }
561 else {
562 _decoder->setRinexReconnectFlag(false);
563 }
564 return success;
565 }
566
567 // Start a new query
568 // -----------------
569 if (!_rawFile) {
570
571 sleep(_nextSleep);
572 if (_nextSleep == 0) {
573 _nextSleep = 1;
574 }
575 else {
576 _nextSleep = 2 * _nextSleep;
577 if (_nextSleep > 256) {
578 _nextSleep = 256;
579 }
580#ifdef MLS_SOFTWARE
581 if (_nextSleep > 4) {
582 _nextSleep = 4;
583 }
584#endif
585 }
586
587 delete _query;
588 if (_ntripVersion == "U") {
589 _query = new bncNetQueryUdp();
590 }
591 else if (_ntripVersion == "R") {
592 _query = new bncNetQueryRtp();
593 }
594 else if (_ntripVersion == "S") {
595 _query = new bncNetQueryS();
596 }
597 else if (_ntripVersion == "N") {
598 _query = new bncNetQueryV0();
599 }
600 else if (_ntripVersion == "UN") {
601 _query = new bncNetQueryUdp0();
602 }
603 else if (_ntripVersion == "2") {
604 _query = new bncNetQueryV2(false);
605 }
606 else if (_ntripVersion == "2s") {
607 _query = new bncNetQueryV2(true);
608 }
609 else {
610 _query = new bncNetQueryV1();
611 }
612 if (_nmea == "yes" && _serialNMEA != AUTO_NMEA) {
613 QByteArray gga = ggaString(_latitude, _longitude, "100.0");
614 _query->startRequest(_mountPoint, gga);
615 }
616 else {
617 _query->startRequest(_mountPoint, "");
618 }
619 if (_query->status() != bncNetQuery::running) {
620 return failure;
621 }
622 }
623
624 if (_rawFile) {
625 QMapIterator<QString, GPSDecoder*> itDec(_decodersRaw);
626 while (itDec.hasNext()) {
627 itDec.next();
628 GPSDecoder* decoder = itDec.value();
629 decoder->setRinexReconnectFlag(false);
630 }
631 }
632 else {
633 _decoder->setRinexReconnectFlag(false);
634 }
635
636 return success;
637}
638
639// RTCM scan output
640//////////////////////////////////////////////////////////////////////////////
641void bncGetThread::scanRTCM() {
642
643 if ( !decoder() ) {
644 return;
645 }
646
647 bncSettings settings;
648 if ( Qt::CheckState(settings.value("scanRTCM").toInt()) == Qt::Checked ) {
649
650 if ( _miscMount == _staID || _miscMount == "ALL" ) {
651
652 // RTCM message types
653 // ------------------
654 for (int ii = 0; ii < decoder()->_typeList.size(); ii++) {
655 QString type = QString("%1 ").arg(decoder()->_typeList[ii]);
656 emit(newMessage(_staID + ": Received message type " + type.toAscii(), true));
657 }
658
659 // Check Observation Types
660 // -----------------------
661 for (int ii = 0; ii < decoder()->_obsList.size(); ii++) {
662 t_obs& obs = decoder()->_obsList[ii];
663 QVector<QString>& rnxTypes = _rnxTypes[obs.satSys];
664 bool allFound = true;
665 for (int iEntry = 0; iEntry < GNSSENTRY_NUMBER; iEntry++) {
666 if (obs._measdata[iEntry] != 0.0) {
667 if (rnxTypes.indexOf(obs.rnxStr(iEntry)) == -1) {
668 allFound = false;
669 rnxTypes << obs.rnxStr(iEntry);
670 }
671 }
672 }
673 if (!allFound) {
674 QString msg;
675 QTextStream str(&msg);
676 str << obs.satSys << " " << rnxTypes.size() << " ";
677 for (int iType = 0; iType < rnxTypes.size(); iType++) {
678 str << " " << rnxTypes[iType];
679 }
680 emit(newMessage(_staID + ": Observation Types: " + msg.toAscii(), true));
681 }
682 }
683
684 // RTCMv3 antenna descriptor
685 // -------------------------
686 for (int ii = 0; ii < decoder()->_antType.size(); ii++) {
687 QString ant1 = QString("%1 ").arg(decoder()->_antType[ii]);
688 emit(newMessage(_staID + ": Antenna descriptor " + ant1.toAscii(), true));
689 }
690
691 // RTCM Antenna Coordinates
692 // ------------------------
693 for (int ii=0; ii < decoder()->_antList.size(); ii++) {
694 QByteArray antT;
695 if (decoder()->_antList[ii].type == GPSDecoder::t_antInfo::ARP) {
696 antT = "ARP";
697 }
698 else if (decoder()->_antList[ii].type == GPSDecoder::t_antInfo::APC) {
699 antT = "APC";
700 }
701 QByteArray ant1, ant2, ant3;
702 ant1 = QString("%1 ").arg(decoder()->_antList[ii].xx,0,'f',4).toAscii();
703 ant2 = QString("%1 ").arg(decoder()->_antList[ii].yy,0,'f',4).toAscii();
704 ant3 = QString("%1 ").arg(decoder()->_antList[ii].zz,0,'f',4).toAscii();
705 emit(newMessage(_staID + ": " + antT + " (ITRF) X " + ant1 + "m", true));
706 emit(newMessage(_staID + ": " + antT + " (ITRF) Y " + ant2 + "m", true));
707 emit(newMessage(_staID + ": " + antT + " (ITRF) Z " + ant3 + "m", true));
708 double hh = 0.0;
709 if (decoder()->_antList[ii].height_f) {
710 hh = decoder()->_antList[ii].height;
711 QByteArray ant4 = QString("%1 ").arg(hh,0,'f',4).toAscii();
712 emit(newMessage(_staID + ": Antenna height above marker " + ant4 + "m", true));
713 }
714 emit(newAntCrd(_staID, decoder()->_antList[ii].xx,
715 decoder()->_antList[ii].yy, decoder()->_antList[ii].zz,
716 hh, antT));
717 }
718 }
719 }
720
721#ifdef MLS_SOFTWARE
722 for (int ii=0; ii <decoder()->_antList.size(); ii++) {
723 QByteArray antT;
724 if (decoder()->_antList[ii].type == GPSDecoder::t_antInfo::ARP) {
725 antT = "ARP";
726 }
727 else if (decoder()->_antList[ii].type == GPSDecoder::t_antInfo::APC) {
728 antT = "APC";
729 }
730 double hh = 0.0;
731 if (decoder()->_antList[ii].height_f) {
732 hh = decoder()->_antList[ii].height;
733 }
734 emit(newAntCrd(_staID, decoder()->_antList[ii].xx,
735 decoder()->_antList[ii].yy, decoder()->_antList[ii].zz,
736 hh, antT));
737 }
738
739 for (int ii = 0; ii <decoder()->_typeList.size(); ii++) {
740 emit(newRTCMMessage(_staID, decoder()->_typeList[ii]));
741 }
742#endif
743
744 decoder()->_typeList.clear();
745 decoder()->_antType.clear();
746 decoder()->_antList.clear();
747}
748
749// Handle Data from Serial Port
750////////////////////////////////////////////////////////////////////////////
751void bncGetThread::slotSerialReadyRead() {
752 if (_serialPort) {
753 int nb = _serialPort->bytesAvailable();
754 if (nb > 0) {
755 QByteArray data = _serialPort->read(nb);
756
757 if (_serialNMEA == AUTO_NMEA) {
758 int i1 = data.indexOf("$GPGGA");
759 if (i1 != -1) {
760 int i2 = data.indexOf("*", i1);
761 if (i2 != -1 && data.size() > i2 + 1) {
762 QByteArray gga = data.mid(i1,i2-i1+3);
763 _query->sendNMEA(gga);
764 }
765 }
766 }
767
768 if (_serialOutFile) {
769 _serialOutFile->write(data);
770 _serialOutFile->flush();
771 }
772 }
773 }
774}
Note: See TracBrowser for help on using the repository browser.