QGeoSatelliteInfoSource Class
The QGeoSatelliteInfoSource class is an abstract base class for the distribution of satellite information updates. More...
| Header: | #include <QGeoSatelliteInfoSource> |
| qmake: | QT += positioning |
| Since: | Qt 5.2 |
| Inherits: | QObject |
This class was introduced in Qt 5.2.
Public Types
| enum | Error { AccessError, ClosedError, NoError, UnknownSourceError } |
Properties
- minimumUpdateInterval : const int
- updateInterval : int
Public Functions
| virtual int | minimumUpdateInterval() const = 0 |
| virtual void | setUpdateInterval(int msec) |
| int | updateInterval() const |
Detailed Description
The static function QGeoSatelliteInfoSource::createDefaultSource() creates a default satellite data source that is appropriate for the platform, if one is available. Otherwise, available QGeoPositionInfoSourceFactory plugins will be checked for one that has a satellite data source available.
Call startUpdates() and stopUpdates() to start and stop regular updates, or requestUpdate() to request a single update. When an update is available, satellitesInViewUpdated() and/or satellitesInUseUpdated() will be emitted.
If regular satellite updates are required, setUpdateInterval() can be used to specify how often these updates should be emitted. If no interval is specified, updates are simply provided whenever they are available. For example:
// Emit updates every 10 seconds if available QGeoSatelliteInfoSource *source = QGeoSatelliteInfoSource::createDefaultSource(0); if (source) source->setUpdateInterval(10000);
To remove an update interval that was previously set, call setUpdateInterval() with a value of 0.
Note that the satellite source may have a minimum value requirement for update intervals, as returned by minimumUpdateInterval().
Member Type Documentation
enum QGeoSatelliteInfoSource::Error
The Error enumeration represents the errors which can occur.
| Constant | Value | Description |
|---|---|---|
QGeoSatelliteInfoSource::AccessError | 0 | The connection setup to the satellite backend failed because the application lacked the required privileges. |
QGeoSatelliteInfoSource::ClosedError | 1 | The satellite backend closed the connection, which happens for example in case the user is switching location services to off. This object becomes invalid and should be deleted. A new satellite source can be created by calling createDefaultSource() later on. |
QGeoSatelliteInfoSource::NoError | 2 | No error has occurred. |
QGeoSatelliteInfoSource::UnknownSourceError | -1 | An unidentified error occurred. |
Property Documentation
minimumUpdateInterval : const int
This property holds the minimum time (in milliseconds) required to retrieve a satellite update.
This is the minimum value accepted by setUpdateInterval() and requestUpdate().
Access functions:
| virtual int | minimumUpdateInterval() const = 0 |
updateInterval : int
This property holds the requested interval in milliseconds between each update.
If the update interval is not set (or is set to 0) the source will provide updates as often as necessary.
If the update interval is set, the source will provide updates at an interval as close to the requested interval as possible. If the requested interval is less than the minimumUpdateInterval(), the minimum interval is used instead.
Changes to the update interval will happen as soon as is practical, however the time the change takes may vary between implementations. Whether or not the elapsed time from the previous interval is counted as part of the new interval is also implementation dependent.
The default value for this property is 0.
Note: Subclass implementations must call the base implementation of setUpdateInterval() so that updateInterval() returns the correct value.
Access functions:
| int | updateInterval() const |
| virtual void | setUpdateInterval(int msec) |