Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-81644

Missing support for gpsd as socket nmeasource in PositionSource QML component

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Reported
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 5.13.2
    • Fix Version/s: None
    • Component/s: Positioning
    • Labels:
      None
    • Platform/s:
      All
    • Technical Risk:
      Normal

      Description

      gpsd is a widespread daemon that provides a mechanism to interact with a GPS device from a program. Although gpsd suffers from a few issues, it can be convenient to use it from a QML program.

      The PositionSource QML component has an nmeasource property that allows specifying a file or a socket as a source of NMEA position data to use as the position source. The nmeasource property takes a URL. If the URL scheme is socket, it will establish a socket to the hostname and port specified in the URL (e.g. nmeasource: "socket://hostname:port"). Setting the property to connect to a gpsd-provided socket, however, does not work because gpsd only starts sending data when asked to do so by writing a cryptic command on the socket.

      A solution to this would be to support a new gpsd scheme for the nmeasource property that would open a read-write socket and would issue the gpsd initiation command to it right after opening it, and then listen for the incoming NMEA data. For example, a gpsd socket could be specified as follows: nmeasource: "gpsd://hostname:port" 

      This could be achieved very simply by modifying the QDeclarativePositionSource::setNmeaSource method to recognize the gpsd scheme, which would cause it to open the socket as read-write instead of the current read-only and issue the gpsd command to initiate the NMEA data stream.

      The gpsd stream could also be stopped/started based on the active property of the PositionSource component.

      I posted a workaround to this limitation that requires no code change and a crude but working implementation of this proposed change here: https://stackoverflow.com/questions/59482703/getting-positions-from-gpsd-in-a-qt-quick-program

      I would be happy to contribute the code to do this more cleanly but would welcome comments and suggestions.

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            ablasche Alex Blasche
            Reporter:
            charlesv Charles Vaillancourt
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes