Skip to main content

gnss-session.enable(gnssMode, fixMaxTime, fixMaxDist, fixCount, fixRate)

Turn the GNSS sub-system on

Availability

Device (from impOS™ 44)
Only available on imps with cellular modems

Parameters

Name Type Description
gnssMode Integer The GNSS working mode
fixMaxTime Integer The maximum positioning time in seconds
fixMaxDist Integer The positioning accuracy threshold in meters
fixCount Integer The number of position determination attempts
fixRate Integer The interval between the first and second time positioning in seconds

Returns

Table — see below

Description

This documentation covers a feature not yet available in a production version of impOS and has been provided for early testers only. It is preliminary and subject to change

This method activates and configures the GNSS sub-system. The five optional parameters take integer values in fixed ranges as follows:

Parameter Value Range Description
gnssMode 1-4 The GNSS working mode:
1 — standalone (default)
2 — MS-based
3 — MS-assisted
4 — speed-optimal
fixMaxTime 1-255 The maximum positioning time, ie. the response time of the GNSS receiver while measuring the GNSS pseudo range, and the upper time limit of GNSS satellite searching. It also includes the time for demodulating the ephemeris data and calculating the position. Default: 30
fixMaxDist 1-1000 The positioning accuracy threshold in meters. Default: 50
fixCount 0-1000 The number of position determination attempts. The value 0 represents continuous positioning. Default: 0
fixRate 1-65535 The interval between the first and second time positioning in seconds. Default: 1

The returned table contains the key status. Its value will be zero if no error occurred, or an error code (see gnss-session for details).

Example Code

The following example shows the basic steps required to get a device’s location fix by GNSS on a cellular imp006. It uses a sequence of API calls to open a GNSS session then to use that session first to enable GNSS and then to determine the device’s location. The code makes recursive calls to enableGNSS() until the modem is ready to read the device’s location, then recursive calls to getLocation() until a fix is achieved or an error occurred.