The QNmeaPositionInfoSource class provides positional information using a NMEA data source. More...
#include <QNmeaPositionInfoSource>
Inherits: QGeoPositionInfoSource.
This class was introduced in Qt Mobility 1.0.
enum | UpdateMode { RealTimeMode, SimulationMode } |
QNmeaPositionInfoSource ( UpdateMode updateMode, QObject * parent = 0 ) | |
~QNmeaPositionInfoSource () | |
QIODevice * | device () const |
void | setDevice ( QIODevice * device ) |
UpdateMode | updateMode () const |
virtual QGeoPositionInfo | lastKnownPosition ( bool fromSatellitePositioningMethodsOnly = false ) const |
virtual int | minimumUpdateInterval () const |
virtual void | setUpdateInterval ( int msec ) |
virtual PositioningMethods | supportedPositioningMethods () const |
virtual void | requestUpdate ( int msec = 0 ) |
virtual void | startUpdates () |
virtual void | stopUpdates () |
virtual bool | parsePosInfoFromNmeaData ( const char * data, int size, QGeoPositionInfo * posInfo, bool * hasFix ) |
The QNmeaPositionInfoSource class provides positional information using a NMEA data source.
NMEA is a commonly used protocol for the specification of one's global position at a certain point in time. The QNmeaPositionInfoSource class reads NMEA data and uses it to provide positional data in the form of QGeoPositionInfo objects.
A QNmeaPositionInfoSource instance operates in either RealTimeMode or SimulationMode. These modes allow NMEA data to be read from either a live source of positional data, or replayed for simulation purposes from previously recorded NMEA data.
The source of NMEA data is set with setDevice().
Use startUpdates() to start receiving regular position updates and stopUpdates() to stop these updates. If you only require updates occasionally, you can call requestUpdate() to request a single update.
In both cases the position information is received via the positionUpdated() signal and the last known position can be accessed with lastKnownPosition().
Defines the available update modes.
Constant | Value | Description |
---|---|---|
QNmeaPositionInfoSource::RealTimeMode | 1 | Positional data is read and distributed from the data source as it becomes available. Use this mode if you are using a live source of positional data (for example, a GPS hardware device). |
QNmeaPositionInfoSource::SimulationMode | 2 | The data and time information in the NMEA source data is used to provide positional updates at the rate at which the data was originally recorded. Use this mode if the data source contains previously recorded NMEA data and you want to replay the data for simulation purposes. |
Constructs a QNmeaPositionInfoSource instance with the given parent and updateMode.
This function was introduced in Qt Mobility 1.0.
Destroys the position source.
Returns the NMEA data source.
This function was introduced in Qt Mobility 1.0.
See also setDevice().
Reimplemented from QGeoPositionInfoSource::lastKnownPosition().
This function was introduced in Qt Mobility 1.0.
Reimplemented from QGeoPositionInfoSource::minimumUpdateInterval().
This function was introduced in Qt Mobility 1.0.
Parses an NMEA sentence string into a QGeoPositionInfo.
The default implementation will parse standard NMEA 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 setup posInfo and hasFix. If hasFix is set to false then posInfo may contain only the time or the date and the time.
Returns true if the sentence was succsesfully parsed, otherwise returns false and should not modifiy posInfo or hasFix.
This function was introduced in Qt Mobility 1.0.
Reimplemented from QGeoPositionInfoSource::requestUpdate().
This function was introduced in Qt Mobility 1.0.
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().
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.
This function was introduced in Qt Mobility 1.0.
See also device().
Reimplemented from QGeoPositionInfoSource::setUpdateInterval().
This function was introduced in Qt Mobility 1.0.
Reimplemented from QGeoPositionInfoSource::startUpdates().
This function was introduced in Qt Mobility 1.0.
Reimplemented from QGeoPositionInfoSource::stopUpdates().
This function was introduced in Qt Mobility 1.0.
Reimplemented from QGeoPositionInfoSource::supportedPositioningMethods().
This function was introduced in Qt Mobility 1.0.
Returns the update mode.
This function was introduced in Qt Mobility 1.0.