- class QNmeaSatelliteInfoSource¶
The
QNmeaSatelliteInfoSource
class provides satellite information using an NMEA data source. More…Synopsis¶
Methods¶
def
__init__()
def
device()
def
setDevice()
def
setError()
def
updateMode()
Virtual methods¶
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
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 ofQGeoSatelliteInfo
objects.A
QNmeaSatelliteInfoSource
instance operates in eitherRealTimeMode
orSimulationMode
. 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 andstopUpdates()
to stop these updates. If you only require updates occasionally, you can callrequestUpdate()
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.- class UpdateMode¶
Defines the available update modes.
Constant
Description
QNmeaSatelliteInfoSource.UpdateMode.RealTimeMode
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
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.
- class 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
Description
QNmeaSatelliteInfoSource.NotParsed
The data does not contain information about satellites.
QNmeaSatelliteInfoSource.PartiallyParsed
A valid satellite information is received and parsed, but it’s not complete, so we need to wait for another NMEA sentence.
QNmeaSatelliteInfoSource.FullyParsed
Satellite information was fully collected and parsed.
- PySide6.QtPositioning.QNmeaSatelliteInfoSource.SimulationUpdateInterval¶
- __init__(mode[, parent=None])¶
- Parameters:
mode –
UpdateMode
parent –
QObject
Constructs a
QNmeaSatelliteInfoSource
instance with the givenparent
andmode
.Returns the NMEA data source.
See also
- parseSatelliteInfoFromNmea(data, infos, system)¶
- Parameters:
data –
QByteArrayView
infos – .list of QGeoSatelliteInfo
system –
SatelliteSystem
- Return type:
- parseSatelliteInfoFromNmea(data, size, infos, system)
- Parameters:
data – str
size – int
infos – .list of QGeoSatelliteInfo
system –
SatelliteSystem
- Return type:
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 fromdata
and uses that information to fillinfos
list.Returns
SatelliteInfoParseStatus
with parse result. Modifiesinfos
list in casePartiallyParsed
orFullyParsed
is returned. Also sets thesystem
to correct satellite system type. This is required to determine the system type in case there are no satellites in view.- parseSatellitesInUseFromNmea(data, pnrsInUse)¶
- Parameters:
data –
QByteArrayView
pnrsInUse – .list of int
- Return type:
- parseSatellitesInUseFromNmea(data, size, pnrsInUse)
- Parameters:
data – str
size – int
pnrsInUse – .list of int
- Return type:
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 fromdata
and uses that information to fillpnrsInUse
list.Returns system type if the sentence was successfully parsed, otherwise returns
Undefined
and should not modifiypnrsInUse
.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()
orrequestUpdate()
.Note
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
- updateMode()¶
- Return type:
Returns the update mode.