Get NMEA sentences from the GNSS sub-system
Device (from impOS™ 43)
Only available on imps with cellular modems
The information delivery callback
The format for returned sentences
This method retrieves NMEA sentence data from the GNSS sub-system, which must be enabled before this call can be made. Additionally, the GNSS sub-system must have been configured to output NMEA sentences — see gnss-session.configure(). This is the default but if you have changed the value of the NMEA setting key nmeasrc to 0, you must set it to 1 before calling gnss-session.readnmea().
Note It is also possible to disable sentence output by passing the value of 0 for any of the following NMEA settings:
In this case, it is still possible to retrieve NMEA sentence data, but you will only receive the most recently acquired data and then only if sentences have been acquired in this session.
The value passed into the optional parameter sentenceType is a string which specifies the format of the sentences to be returned. The possible values are:
For more information on the meaning of these values, please see NMEA Revealed: Standard Sentences.
The data is returned in a table which is passed to the supplied infoCallback function. The table contains at least two keys: status and nmea. The value of status will be zero if no error occurred, or an error code (see gnss-session for details).
The value of the key nmea will be an array containing the strings returned by the modem.
The following code retrieves sentences of the GSV type — they describe the sky positions of GNSS satellites the modem can see. Each sentence has the following field structure:
The fields are:
<TID>— Talker ID: the source of the information, eg.