GNSS

Principle

The GNSS Foundation Library.

Functional Description

Interactions with the GNSS API goes through a GNSS manager. This manager works around a state machine. To perform read operations to retrieve GNSS data, the machine must be in a STARTED state. Transitions between the states are controlled by the user. The following graph: details the different states, their function and transitions.

GNSS state machine.

GNSS State Machine.

After each operations, the method getState() can be called on the GNSS manager instance to check weither or not the state has been successfully changed.

Turning the GNSS Engine ON

// Retrieve the GNSS instance
GnssManager gnssManager = GnssManager.getInstance();

// Initialize the manager and native components
gnssManager.initializeManager();

// Switch the GNSS Engine ON
gnssManager.switchOn();

Retrieving GNSS data

// Read data
gnssManager.readPosition();

// Check timestamp of latest data read to confirm a fix was found.
long timestamp = gnssManager.getTime();

// Retrieve alitude data from engine
gnssManager.getAltitude()

Turning the GNSS Engine OFF

// Retrieve the GNSS instance
GnssManager gnssManager = GnssManager.getInstance();

// Switch the GNSS Engine OFF
gnssManager.switchOff();

// Close every native components and the manager.
gnssManager.closeManager();

Note

readPosition() call will throw an IOException if an error occured during data reading, however, timestamp will still be updated.

Use

The GNSS Library is provided as a Foundation Library.

To use the GNSS API Module, add the following line to the project build file:

implementation("ej.api:gnss:2.0.0")

Building or running an Application which uses the GNSS Library requires a SDK6 VEE Port that provides the GNSS Pack.