NmeaLocationDataSource Class

  • NmeaLocationDataSource
  • class Esri::ArcGISRuntime::NmeaLocationDataSource

    A NMEA location data source object. More...

    Header: #include <NmeaLocationDataSource.h>
    Since: Esri::ArcGISRuntime 100.10
    Inherits: Esri::ArcGISRuntime::AbstractLocationDataSource

    Public Functions

    NmeaLocationDataSource(QObject *parent = nullptr)
    NmeaLocationDataSource(const Esri::ArcGISRuntime::SpatialReference &receiverSpatialReference, QObject *parent = nullptr)
    NmeaLocationDataSource(const Esri::ArcGISRuntime::SpatialReference &receiverSpatialReference, const Esri::ArcGISRuntime::SpatialReference &outputSpatialReference, QObject *parent = nullptr)
    NmeaLocationDataSource(const Esri::ArcGISRuntime::SpatialReference &receiverSpatialReference, const Esri::ArcGISRuntime::SpatialReference &outputSpatialReference, Esri::ArcGISRuntime::DatumTransformation *outputDatumTransformation, QObject *parent = nullptr)
    virtual ~NmeaLocationDataSource() override
    Esri::ArcGISRuntime::DatumTransformation *outputDatumTransformation() const
    Esri::ArcGISRuntime::SpatialReference outputSpatialReference() const
    void pushData(const QByteArray &data)
    Esri::ArcGISRuntime::SpatialReference receiverSpatialReference() const

    Protected Slots

    virtual void onStart() override
    virtual void onStop() override

    Detailed Description

    This object will parse specific NMEA messages pushed into it. Valid GGA, GSA, GST, GSV, RMC, VTG messages are parsed and, a AbstractLocationDataSource::locationChanged may be raised. The AbstractLocationDataSource::locationChanged will return a NmeaLocation object. This data source is based on NMEA version 4.11 (November 2018).

    The Apple App Store has guidelines and restrictions for apps that communicate with MFi accessories (for example: an external GPS receiver). Apps that use NMEA data need to satisfy the Apple requirements to be accepted in the store. Apps need to declare support via PPID in their submission and the MFi provider needs to list the bundle ID so Apple can cross reference it. For more information see the site, MFi Program.

    Member Function Documentation

    [explicit] NmeaLocationDataSource::NmeaLocationDataSource(QObject *parent = nullptr)

    Creates an NMEA data source object.

    • parent - The optional parent QObject.

    Locations created from an NMEA data source object instantiated with this constructor will have a SpatialReference of WGS84.

    [explicit] NmeaLocationDataSource::NmeaLocationDataSource(const Esri::ArcGISRuntime::SpatialReference &receiverSpatialReference, QObject *parent = nullptr)

    Creates an NMEA data source object.

    • receiverSpatialReference - The SpatialReference of incoming NMEA receiver data.
    • parent - The optional parent QObject.

    Locations created from an NMEA data source object instantiated with this constructor will have a SpatialReference defined by the receiverSpatialReference parameter. This constructor can be used when a receiver is outputting locations in a SpatialReference other than WGS84, such as when using a reference base station.

    NmeaLocationDataSource::NmeaLocationDataSource(const Esri::ArcGISRuntime::SpatialReference &receiverSpatialReference, const Esri::ArcGISRuntime::SpatialReference &outputSpatialReference, QObject *parent = nullptr)

    Creates an NMEA data source object.

    Locations created from an NMEA data source object instantiated with this constructor will be projected from the SpatialReference defined by the receiverSpatialReference parameter to the SpatialReference defined by the outputSpatialReference parameter. If the outputSpatialReference parameter is empty, the locations will not be projected and the locations will be in the receiverSpatialReference. This constructor can be used when a receiver is outputting locations in a SpatialReference other than WGS84, such as when using a reference base station, and/or the application requires the output locations to be projected to a different SpatialReference.

    NmeaLocationDataSource::NmeaLocationDataSource(const Esri::ArcGISRuntime::SpatialReference &receiverSpatialReference, const Esri::ArcGISRuntime::SpatialReference &outputSpatialReference, Esri::ArcGISRuntime::DatumTransformation *outputDatumTransformation, QObject *parent = nullptr)

    Creates an NMEA data source object.

    Locations created from an NMEA data source object instantiated with this constructor will be projected from the SpatialReference defined by the receiverSpatialReference parameter to the SpatialReference defined by the outputSpatialReference parameter using the outputDatumTransformation. If the outputSpatialReference parameter is nullptr , the locations will not be projected and the locations will be in the receiverSpatialReference; if the outputDatumTransformation parameter is set it will be ignored. This constructor can be used when a receiver is outputting locations in a SpatialReference other than WGS84, such as when using a reference base station, and/or the application requires the output locations to be projected to a different SpatialReference using a DatumTransformation.

    [override virtual] NmeaLocationDataSource::~NmeaLocationDataSource()

    Destructor.

    [override virtual protected slot] void NmeaLocationDataSource::onStart()

    Reimplements: AbstractLocationDataSource::onStart().

    Reacts to start requests by starting the location data source.

    Note: You should not call this method directly - use start instead.

    [override virtual protected slot] void NmeaLocationDataSource::onStop()

    Reimplements: AbstractLocationDataSource::onStop().

    Reacts to stop requests by stopping the location data source.

    Note: You should not call this method directly - use stop instead.

    Esri::ArcGISRuntime::DatumTransformation *NmeaLocationDataSource::outputDatumTransformation() const

    Returns the DatumTransformation to be used in the project operation.

    If set, this property will be used as the DatumTransformation in the call to GeometryEngine::project. For this property to be used, the outputSpatialReference also must be set.

    Esri::ArcGISRuntime::SpatialReference NmeaLocationDataSource::outputSpatialReference() const

    Returns the GeometryEngine::project method to generate the output spatial reference.

    The projected point will be stored in NmeaLocation::position. If this property is nullptr , the NmeaLocation::position will be contain the original incoming x,y,z values from the NMEA data sentence and the receiverSpatialReference.

    void NmeaLocationDataSource::pushData(const QByteArray &data)

    Reads the input NMEA data, with which it creates a NmeaLocation.

    • data - The data buffer that contains NMEA data.

    When pushing data

    • Each sentence needs to begins with a '$'
    • Each sentence needs to end with carriage return/line feed sequence
    • Single or multiple sentences can be pushed at one time. All strings in the buffer will be parsed
    • There is no explicit limit on the amount of data that can pushed at one time
    • If partial sentences are pushed the data source accumulates (and concatenates) the pushed data until a carriage return/line feed sequence is reached
    • The data source parses these messages types: GGA, GSA, GST, GSV, RMC, VTG
    • Each sentence's checksum is validated
    • Unknown/bad/incorrect sentences are ignored (they do not produce any location, satellite updates etc.)
    • Sentences support up to 256 characters (this is beyond the NMEA spec's 82 character limit to support receiver's that output longer sentences)
    • Messages should be of the form: "$XXYYY,[data]*[checksum]\r\n"

    Example: $GPGGA, 092750.000, 5321.6802,N, 00630.3372,W, 1, 8, 1.03, 61.7,M, 55.2,M,,*76 $GPGSA,A, 3, 10, 07, 05, 02, 29, 04, 08, 13,,,,, 1.72, 1.03,1.38*0A $GPGSV, 3, 1, 11, 10, 63, 137, 17, 07, 61, 098, 15, 05, 59, 290, 20, 08, 54, 157,30*70 see https://www.nmea.org/ for more information on the NMEA standard. The QByteArray can be obtained by, for example, converting from a QString; or by connecting to a GPS device, (either via QBluetoothSocket or QSerialPort) using QIODevice::read(qint64 maxSize).

    Esri::ArcGISRuntime::SpatialReference NmeaLocationDataSource::receiverSpatialReference() const

    Returns the SpatialReference to be assigned to the output NmeaLocation, the default is WGS84

    By default this will be WGS84 for its horizontal (WKID=4326) and vertical reference systems (WKID=115700), this can be set to a different SpatialReference if a receiver returns locations in a different reference system.

    Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.