"QNmeaPositionInfoSource: cannot find NMEA sentence with valid date & time".
-
Hi,
I am a newbie to Qt Positioning modules. I tried to parse NMEA messages using QNmeaPositionInfoSource in Qt.
Here is the codeQNmeaPositionInfoSource *nmeaSource = new QNmeaPositionInfoSource(QNmeaPositionInfoSource::SimulationMode); nmeaSource->setDevice(/*logFile*/); nmeaSource->setPreferredPositioningMethods(QGeoPositionInfoSource::AllPositioningMethods); nmeaSource->startUpdates();
And I got this error when running the application
QNmeaPositionInfoSource: cannot find NMEA sentence with valid date & time
What's wrong with the above code(ref:https://doc.qt.io/qt-5/qnmeapositioninfosource.html)?
How to fix it? -
@Renjith-R
https://doc.qt.io/qt-5/qnmeapositioninfosource.html#setDeviceThe source device can only be set once and must be set before calling startUpdates() or requestUpdate().
Note: The device must emit QIODevice::readyRead() for the source to be notified when data is available for reading. QNmeaPositionInfoSource does not assume the ownership of the device, and hence does not deallocate it upon destruction.
/* logfile */
You just yadda yadda'd the most important detail. Example project probably will help: https://doc.qt.io/qt-5/qtpositioning-logfilepositionsource-example.html