Changeset 6770 in ntrip for trunk


Ignore:
Timestamp:
Apr 8, 2015, 2:40:12 PM (9 years ago)
Author:
stuerze
Message:

add initial GGA string for NMEA auto mode

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/bncgetthread.cpp

    r6753 r6770  
    268268      QByteArray _serialHeightNMEA = hlp.toAscii();
    269269      _manualNMEAString = ggaString(_latitude, _longitude, _serialHeightNMEA);
    270 
    271270    }
    272271  }
     
    618617      _query = new bncNetQueryV1();
    619618    }
    620     if (_nmea == "yes" && _serialNMEA == MANUAL_NMEA) {
    621       _query->startRequest(_mountPoint, _manualNMEAString);
    622       _lastManualNMEA = QDateTime::currentDateTime();
     619    if (_nmea == "yes") {
     620      if (_serialNMEA == MANUAL_NMEA) {
     621        _query->startRequest(_mountPoint, _manualNMEAString);
     622        _lastManualNMEA = QDateTime::currentDateTime();
     623      }
     624      else if (_serialNMEA == AUTO_NMEA) {
     625        if (_serialPort) {
     626          int nb = _serialPort->bytesAvailable();
     627          if (nb > 0) {
     628            QByteArray data = _serialPort->read(nb);
     629            int i1 = data.indexOf("$GPGGA");
     630            if (i1 == -1) {
     631              i1 = data.indexOf("$GNGGA");
     632            }
     633            if (i1 != -1) {
     634              int i2 = data.indexOf("*", i1);
     635              if (i2 != -1 && data.size() > i2 + 1) {
     636                QByteArray gga = data.mid(i1, i2 - i1 + 3);
     637                _query->startRequest(_mountPoint, gga);
     638              }
     639            }
     640          }
     641        }
     642      }
    623643    }
    624644    else {
    625645      _query->startRequest(_mountPoint, "");
    626646    }
     647
    627648    if (_query->status() != bncNetQuery::running) {
    628649      return failure;
     
    804825////////////////////////////////////////////////////////////////////////////
    805826void bncGetThread::slotSerialReadyRead() {
     827
    806828  if (_serialPort) {
     829
    807830    int nb = _serialPort->bytesAvailable();
     831
    808832    if (nb > 0) {
    809833      QByteArray data = _serialPort->read(nb);
Note: See TracChangeset for help on using the changeset viewer.