Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions codeless banner

QNmeaWhereabouts Class Reference
[QtLocationModule]

The QNmeaWhereabouts class provides positional information using a NMEA data source. More...

    #include <QNmeaWhereabouts>

Inherits QWhereabouts.

Public Types

Public Functions

Public Slots

Additional Inherited Members


Detailed Description

The QNmeaWhereabouts 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 QNmeaWhereabouts class reads NMEA data and uses it to provide positional data in the form of QWhereaboutsUpdate objects.

A QNmeaWhereabouts 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.

Use setUpdateMode() to define the update mode, and setSourceDevice() to set the source of NMEA data.

Use startUpdates() to receive regular position updates through the updated() signal, and stopUpdates() to stop these updates. If you only require updates occasionally, you can call requestUpdate() as required, instead of startUpdates() and stopUpdates().


Member Type Documentation

enum QNmeaWhereabouts::UpdateMode

Defines the available update modes.

ConstantValueDescription
QNmeaWhereabouts::InvalidMode0Updates cannot be provided in this mode. This is the default mode.
QNmeaWhereabouts::RealTimeMode1Positional 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).
QNmeaWhereabouts::SimulationMode2The 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. if the data source contains previously recorded NMEA data and you want to replay the data for simulation purposes.


Member Function Documentation

QNmeaWhereabouts::QNmeaWhereabouts ( QObject * parent = 0 )

Constructs a QNmeaWhereabouts instance with the given parent with the update mode set to QNmeaWhereabouts::InvalidMode.

QNmeaWhereabouts::QNmeaWhereabouts ( UpdateMode updateMode, QObject * parent = 0 )

Constructs a QNmeaWhereabouts instance with the given parent and updateMode.

QNmeaWhereabouts::~QNmeaWhereabouts ()

Destroys the whereabouts instance.

void QNmeaWhereabouts::newDataAvailable ()   [slot]

Notifies the object that new data is available for reading from the source device.

Usually you do not need to call this function. It is only necessary if the source device does not emit QIODevice::readyRead().

See also setSourceDevice() and QSocketNotifier.

void QNmeaWhereabouts::requestUpdate ()   [virtual slot]

Requests that updated() be emitted with the current whereabouts if possible. This can be called regardless of whether startUpdates() has already been called.

This is useful if you need to retrieve the current whereabouts but you do not need the periodic updates offered by startUpdates(). Calling this method will result in only a single updated() signal.

If the state is currently QWhereabouts::NotAvailable, the object will first be initialized and will then provide an update when it is in the QWhereabouts::PositionFixAcquired state.

Reimplemented from QWhereabouts.

See also startUpdates() and lastUpdate().

void QNmeaWhereabouts::setSourceDevice ( QIODevice * source )

Sets the NMEA data source to source. 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: If source does not emit QIODevice::readyRead() — for example, if it is a QFile object — you must call newDataAvailable() when data is available for reading.

See also sourceDevice().

void QNmeaWhereabouts::setUpdateMode ( UpdateMode mode )

Sets the update mode to mode.

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

See also updateMode().

QIODevice * QNmeaWhereabouts::sourceDevice () const

Returns the NMEA data source.

See also setSourceDevice().

void QNmeaWhereabouts::startUpdates ()   [virtual slot]

Starts emitting updated() with the interval specified by updateInterval(), or less frequently if updates are not available at a particular time. If updateInterval() is 0, updated() is emitted as soon as a valid update becomes available.

If startUpdates() has already been called, this restarts with updateInterval() as the new update interval.

If the state is currently QWhereabouts::NotAvailable, the object will first be initialized and will begin to provide updates once it is in the QWhereabouts::PositionFixAcquired state.

Reimplemented from QWhereabouts.

void QNmeaWhereabouts::stopUpdates ()   [virtual slot]

Stops emitting updated() at regular intervals.

Reimplemented from QWhereabouts.

See also startUpdates().

UpdateMode QNmeaWhereabouts::updateMode () const

Returns the update mode. The default mode is QNmeaWhereabouts::InvalidMode.

See also setUpdateMode().


Copyright © 2009 Trolltech Trademarks
Qt Extended 4.4.3