Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to get NMEA sentences out of GPS device?



  • Hi, all,

    how can I get the raw NMEA data out of a GPS device?
    QGeoPositionInfo doesn't provide it...

    Regards
    Joerg


  • Moderators

    Hi,

    You could subclass "QNmeaPositionInfoSource":http://doc.qt.io/qt-5/qnmeapositioninfosource.html and reimplement parsePosInfoFromNmeaData() to capture the raw NMEA sentence:

    @
    bool MySource::parsePosInfoFromNmeaData(const char * data, int size, QGeoPositionInfo * posInfo, bool * hasFix) override
    {
    // Store the raw sentence for later retrieval
    this->sentence += QString(data, size);

    // Call the base implementation to process the sentence
    return QNmeaPositionInfoSource::parsePosInfoFromNmeaData(data, size, posInfo, hasFix);
    

    }
    @



  • Hello,

    that sounds very interesting.

    But as QNmeaPositionInfoSource requires a QIODevice now the goal was to find out what device file is emitting the GPS' data...

    Sorry, I'm absolutely rookie to android development.

    Regards
    Joerg


  • Moderators

    Hmm... reading through the documentation again, I might have misunderstood how QNmeaPositionInfoSource works.

    I have to admit I don't have experience with the Qt Positiioning classes; try asking at the "Interest mailing list":http://lists.qt-project.org/mailman/listinfo/interest where you can find Qt engineers (you'll need to subscribe first)


Log in to reply