Skip to main content





You do not instantiate gnss-session objects yourself: you request a reference to one by calling While at least one gnss-session object reference is in scope, the cellular modem’s GNSS sub-system will remain available for use and further calls to will throw an exception. You will only receive a reference to a new gnss-session object if all the previously received references have gone out of scope, or been manually set to null.

All interactions between your code and the GNSS sub-system are made by calling gnss-session member methods. The majority of these methods return data synchronously and in the form of a table of standard structure. Every table provided by a gnss-session object member method synchronously or asynchronously will contain the key status; its value will be one of the following:

Value Meaning
0 Success
Any integer > 0 A CME error code issued by the modem
Any integer < 0 An error code issued by impOS

impOS Error Codes

impOS Error Code Description
Error Code Description
-1 Timeout. The modem took too long to respond. Issue the command again
-2 The modem is not ready. Back off and try again shortly
-3 A modem command is already in flight. Back off and try again shortly
-4 An invalid parameter was passed to modem
-5 A transmission failure. The modem has stopped reading its UART. This usually indicates a hardware error

Common CME Error Codes

CME Error Code Description
501 Invalid parameter value
502 Operation not supported
503 GNSS sub-system busy
504 Session already active
505 Session not active
506 Operation timed out
507 Function not enabled
508 Time information error
509 BG96 XTRA function not enabled
512 Validity time is out of range
513 Internal modem resource error
514 GNSS locked
515 End by E911
516 GNSS not yet fixed
517 Geofence ID does not exist
549 Unknown error

The returned table may contain other keys in addition to status. These will depend on the specific method called, so please see the individual methods’ own documentation for details.

Member Entities

The gnss-session object has the following member methods: