IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

QNmeaSatelliteInfoSource Class

The QNmeaSatelliteInfoSource class provides satellite information using an NMEA data source.

This class was introduced in Qt 6.2.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

QNmeaSatelliteInfoSource Class

  • Header: QNmeaSatelliteInfoSource

  • Since: Qt 6.2

  • CMake:

    find_package(Qt6 REQUIRED COMPONENTS Positioning)

    target_link_libraries(mytarget PRIVATE Qt6::Positioning)

  • qmake: QT += positioning

  • Inherits: QGeoSatelliteInfoSource

  • Group: QNmeaSatelliteInfoSource is part of QtPositioning-positioning

Detailed Description

NMEA is a commonly used protocol for the specification of one's global position at a certain point in time. The QNmeaSatelliteInfoSource class reads NMEA data and uses it to provide information about satellites in view and satellites in use in form of lists of QGeoSatelliteInfo objects.

A QNmeaSatelliteInfoSource instance operates in either RealTimeMode or SimulationMode. These modes allow NMEA data to be read from either a live source of data, or replayed for simulation purposes from previously recorded NMEA data.

The source of NMEA data is set via setDevice().

Use startUpdates() to start receiving regular satellite information updates and stopUpdates() to stop these updates. If you only require updates occasionally, you can call requestUpdate() to request a single update of both satellites in view and satellites in use.

The information about satellites in view is received via the satellitesInViewUpdated() signal.

The information about satellites in use is received via the satellitesInUseUpdated() signal.

Member Type Documentation

 

enum QNmeaSatelliteInfoSource::SatelliteInfoParseStatus

Defines the parse status of satellite information. The satellite information can be split into multiple sentences, and we need to parse all of them.

Constant

Value

Description

QNmeaSatelliteInfoSource::NotParsed

0

The data does not contain information about satellites.

QNmeaSatelliteInfoSource::PartiallyParsed

1

A valid satellite information is received and parsed, but it's not complete, so we need to wait for another NMEA sentence.

QNmeaSatelliteInfoSource::FullyParsed

2

Satellite information was fully collected and parsed.

enum QNmeaSatelliteInfoSource::UpdateMode

Defines the available update modes.

Constant

Value

Description

QNmeaSatelliteInfoSource::UpdateMode::RealTimeMode

1

Satellite information is read and distributed from the data source as it becomes available. Use this mode if you are using a live source of NMEA data (for example a GPS hardware device).

QNmeaSatelliteInfoSource::UpdateMode::SimulationMode

2

Satellite information is read and distributed from the data source at the given rate. The rate is determined by the SimulationUpdateInterval parameter. Use this mode if the data source contains previously recorded NMEA data and you want to replay the data for simulation purposes.

Member Function Documentation

 

[explicit] QNmeaSatelliteInfoSource::QNmeaSatelliteInfoSource(QNmeaSatelliteInfoSource::UpdateMode mode, QObject *parent = nullptr)

Constructs a QNmeaSatelliteInfoSource instance with the given parent and mode.

[override virtual] QNmeaSatelliteInfoSource::~QNmeaSatelliteInfoSource()

Destroys the satellite information source.

[override virtual] QVariant QNmeaSatelliteInfoSource::backendProperty(const QString &name) const

QIODevice *QNmeaSatelliteInfoSource::device() const

Returns the NMEA data source.

See Also

See also setDevice()

[override virtual] QGeoSatelliteInfoSource::Error QNmeaSatelliteInfoSource::error() const

[override virtual] int QNmeaSatelliteInfoSource::minimumUpdateInterval() const

Reimplements an access function for property: QGeoSatelliteInfoSource::minimumUpdateInterval.

[virtual protected] QNmeaSatelliteInfoSource::SatelliteInfoParseStatus QNmeaSatelliteInfoSource::parseSatelliteInfoFromNmea(const char *data, int size, QList<QGeoSatelliteInfo> &infos, QGeoSatelliteInfo::SatelliteSystem &system)

Parses an NMEA sentence string to extract the information about satellites in view.

The default implementation will parse standard NMEA $GPGSV sentences. This method should be reimplemented in a subclass whenever the need to deal with non-standard NMEA sentences arises.

The parser reads size bytes from data and uses that information to fill infos list.

Returns SatelliteInfoParseStatus with parse result. Modifies infos list in case PartiallyParsed or FullyParsed is returned. Also sets the system to correct satellite system type. This is required to determine the system type in case there are no satellites in view.

[virtual protected] QGeoSatelliteInfo::SatelliteSystem QNmeaSatelliteInfoSource::parseSatellitesInUseFromNmea(const char *data, int size, QList<int> &pnrsInUse)

Parses an NMEA sentence string to extract the IDs of satelites in use.

The default implementation will parse standard NMEA $GPGSA sentences. This method should be reimplemented in a subclass whenever the need to deal with non-standard NMEA sentences arises.

The parser reads size bytes from data and uses that information to fill pnrsInUse list.

Returns system type if the sentence was successfully parsed, otherwise returns QGeoSatelliteInfo::Undefined and should not modifiy pnrsInUse.

[override virtual] void QNmeaSatelliteInfoSource::requestUpdate(int msec = 0)

[override virtual] bool QNmeaSatelliteInfoSource::setBackendProperty(const QString &name, const QVariant &value)

void QNmeaSatelliteInfoSource::setDevice(QIODevice *device)

Sets the NMEA data source to device. If the device is not open, it will be opened in QIODevice::ReadOnly mode.

The source device can only be set once and must be set before calling startUpdates() or requestUpdate().

The device must emit QIODevice::readyRead() for the source to be notified when data is available for reading. QNmeaSatelliteInfoSource does not assume the ownership of the device, and hence does not deallocate it upon destruction.

See Also

See also device()

[override virtual] void QNmeaSatelliteInfoSource::setUpdateInterval(int msec)

Reimplements an access function for property: QGeoSatelliteInfoSource::updateInterval.

[override virtual] void QNmeaSatelliteInfoSource::startUpdates()

[override virtual] void QNmeaSatelliteInfoSource::stopUpdates()

QNmeaSatelliteInfoSource::UpdateMode QNmeaSatelliteInfoSource::updateMode() const

Returns the update mode.

Member Variable Documentation

 

QString QNmeaSatelliteInfoSource::SimulationUpdateInterval

This variable holds the backend property name for data read rate in the SimulationMode. The value for this property is the integer number representing the amount of milliseconds between the subsequent reads. Use this parameter in the setBackendProperty() and backendProperty() methods.

This property is different from the interval that can be set via setUpdateInterval(). The value set via setUpdateInterval() denotes an interval for the user notification, while this parameter specifies the internal frequency of reading the data from source file. It means that one can have multiple (or none) reads during the updateInterval() period.

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+