NEQTO Docs
  • Languages iconEnglish
    • 日本語
  • Docs
  • API
  • FAQ

›neqto.js

Getting Started

  • NEQTO Hello World!
  • Tutorial Step 1. NEQTO Console Setting
  • Tutorial Step 2. Device Settings & Launching Service (NEQTO Bridge)
  • Tutorial Step 2. Device Settings & Launching Service (STM32 Discovery)
  • Tutorial Step 2. Device Settings & Launching Service (SPRESENSE)
  • Tutorial Step 3. Application development using scripts

NEQTO

  • NEQTO Account Registration
  • Sub-accounts
  • API Usage
  • NEQTO CloudSync for GCP
  • NEQTO Engine Firmware List
  • Support Guidelines

NEQTO Console

  • Introduction
  • Fundamentals
  • Administrative Actions
  • Device Management
  • Linux-based Device Management
  • Batch Registration
  • Scripts
  • Actions and Contacts
  • View Data from the Console
  • NEQTO Apps

    • About NEQTO Apps
    • NEQTO Infinitypool
    • NEQTO Insights
    • NEQTO Custodia
    • NEQTO Flow
  • Machine Driver
  • Recommended Browsers
  • Billing Information

SPRESENSE

    Hardware Specifications

    • 01. About Spresense

    Software Specifications

    • 01. Operational Flow
    • 02. Initial Installation
    • 03. Spresense Wi-Fi Initial Setup
    • 04. Spresense LTE-M Initial Setup
    • 05. Debug Log Acquisition
    • 06. System LED Indications
    • 07. Event Messages
    • 08. Updating Firmware

    neqto.js

    • 01. About neqto.js
    • 02. Log
    • 03. Timers
    • 04. HTTP
    • 05. HTTPS
    • 06. MQTT
    • 07. Secure
    • 08. Storage
    • 09. Sleep
    • 10. RTC
    • 11. GPIO
    • 12. UART
    • 13. SPI
    • 14. I2C
    • 15. ADC
    • 16. GNSS
    • 17. Camera
    • 18. Utils
    • 19. nqSpresense
    • 20. nqService
    • 21. nqMqtt
    • 22. nqFOTA
    • 23. nqWiFi
    • 24. nqLte

STM32 Discovery

    Hardware Specifications

    • 01. About STM32 Discovery Kit (B-L4S5I-IOT01A)

    Software Specifications

    • 01. Operational Flow
    • 02. Initial Installation
    • 03. STM32 Discovery Wi-Fi Initial Setup
    • 04. Debug Log Acquisition
    • 05. System LED Indications
    • 06. Event Messages
    • 07. Updating Firmware

    neqto.js

    • 01. About neqto.js
    • 02. Log
    • 03. Timers
    • 04. HTTP
    • 05. HTTPS
    • 06. MQTT
    • 07. Secure
    • 08. Storage
    • 09. Sleep
    • 10. RTC
    • 11. UserSW
    • 12. GPIO
    • 13. UART
    • 14. SPI
    • 15. I2C
    • 16. ADC
    • 18. Utils
    • 19. nqDiscovery
    • 20. nqService
    • 21. nqMqtt
    • 22. nqFOTA
    • 23. nqWiFi

NEQTO Bridge

    Hardware Specifications

    • 01. NEQTO Bridge Module
    • 02. NEQTO Bridge Wi-Fi Module
    • 03. NEQTO Bridge LTE-1 Module
    • 04. NEQTO Bridge LTE-M/NB Module
    • 05. NEQTO Bridge IO Board
    • 06. NEQTO Bridge Digital IO Board
    • 07. NEQTO Bridge Connector Board

    Software Specifications

    • 01. Operational Flow
    • 02. NEQTO Bridge Wi-Fi Module Initial Setup
    • 03. NEQTO Bridge LTE Module Initial Setup
    • 04. Debug Log Acquisition
    • 05. System LED Indications
    • 06. Event Messages
    • 07. Updating Firmware

    neqto.js

    • 01. About neqto.js
    • 02. Log
    • 03. Timers
    • 04. HTTP
    • 05. HTTPS
    • 06. MQTT
    • 07. Secure
    • 08. Storage
    • 09. Sleep
    • 10. RTC
    • 11. UserSW
    • 12. GPIO
    • 13. UART
    • 14. SPI
    • 15. I2C
    • 16. ADC
    • 17. BLE
    • 18. Utils
    • 19. nqBridge
    • 20. nqService
    • 21. nqMqtt
    • 22. nqFOTA
    • 23. nqWiFi
    • 24. nqLte
    • 25. nqLAN
    • 26. nqEx

Linux-based device

    Software Specifications

    • 01. System Requirements
    • 02. Installation
    • 03. Software Configurations
    • 04. Operational Flow
    • 05. Debug Log Acquisition
    • 06. Event Messages
    • 07. Updating Software

    neqto.js

    • 01. About neqto.js
    • 02. Log
    • 03. Timers
    • 04. HTTP
    • 05. HTTPS
    • 06. MQTT
    • 07. Secure
    • 08. Storage
    • 09. RTC
    • 10. UNIXSocket
    • 11. FileSystem
    • 12. SubProcess
    • 13. Utils
    • 14. nqLinux
    • 15. nqService
    • 16. nqMqtt
    • 17. nqFOTA
    • 18. nqLAN

neqto.js Libraries

  • About neqto.js Libraries
  • UART

    • GM65 Barcode Reader
    • SRF Ultrasonic Range Finder - Serial Mode

    I2C

    • HTS221 v2 Temperature and Humidity Sensor
    • LIS2DW12 v2 Accelerometer
    • SRF Ultrasonic Range Finder - I2C Mode
    • [Archive] HTS221 Temperature and Humidity Sensor
    • [Archive] LIS2DW12 Accelerometer

    Utils

    • RTC Alarm Synchronized Scheduler

    Integration

    • AWS S3 v2
    • AWS IoT Core v2
    • Azure IoT v2
    • GCP IoT Core
    • [Archive] AWS S3
    • [Archive] AWS IoT Core

neqto.js Snippets

  • About neqto.js Snippets
  • DataDog
  • Dropbox
  • Google Sheets
  • InfluxDB
  • Oracle Cloud Object Storage
  • Salesforce
  • SAP Cloud Platform Internet of Things
  • Splunk
  • Niagara

Release Notes

  • NEQTO Console Updates
  • NEQTO Firmware (Bridge Wi-Fi/LTE Module) Releases
  • NEQTO Firmware (STM32 Discovery Wi-Fi) Releases
  • NEQTO Firmware (Spresense Wi-Fi/LTE-M) Releases
  • NEQTO Engine for Linux Releases

16. GNSS

The gnss object is a built-in object that provides GNSS functionality.

Functional overview:

  • Provides an interface to acquire positioning information using the Spresense GNSS function.



GNSS Global Object

Methods()/PropertiesSummaryVersionNote
gnss.start()Starts GNSS positioning.02.00.00+
gnss.stop()Stops GNSS positioning.02.00.00+



Details

gnss.start(callback[,cycle[,startMode[,satellite]]])

Starts GNSS positioning.

The first GNSS positioning callback is made immediately after the start of positioning, and the callbacks start at the specified cycle based on the timing of the first callback. After that, an immediate callback occurs at the timing when the positioning is fixed for the first time, and thereafter, the callback is made at the specified cycle based on that timing. Once the position is fixed, the timing of the callback is maintained even if the position is lost and re-fixed.

NameTypeM/OSummary                             Note
callback(pos)functionmandatoryGNSS positioning callback
Executes callback processing at the specified positioning cycle.
pos : {Position}
GNSS positioning information
cyclenumberoptionalPositioning cycle [s]
Range: 1 - 86400
The default value is 1.
startModenumberoptionalStart mode
0: Cold Start
1: Warm Start
2: Hot Start
The default value is 0.
If "Warm Start" or "Hot Start" is performed without the recent positioning data, time, or valid satellite orbit information, it will start with a satellite search operation as same as "Cold Start". For more information, refer to here.
satellitenumberoptionalSpecifies the satellite systems to be used for positioning in bits.
Range: 0 - 255
bit 0: GPS
bit 1: GLONASS
bit 2: SBAS
bit 3: QZSS-L1C/A
bit 4: IMES
bit 5: QZSS-L1S
bit 6: BeiDou
bit 7: Galileo
The default value is 3 (GPS+GLONASS).
If 0 is specified, it will be forced to be the default value.
For more information and restrictions on combinations, refer to here.
returnboolean-true: Success
false: Failure

{Position}

NameTypeSummary                           Note
.pos_fixmodenumberFix mode for position
1: Invalid
2: 2D
3: 3D
If fix mode is 2 or more, it indicates that position information is valid.
.vel_fixmodenumberFix mode for speed
1: Invalid
2: 2D VZ
3: 2D Offset
4: 3D
5: 1D
6: PRED
If the fix mode is 2 or more, it indicates that the speed information is valid.
.svtypenumberSatellite systems in use
bit 0: GPS
bit 1: GLONASS
bit 2: SBAS
bit 3: QZSS-L1C/A
bit 4: IMES
bit 5: QZSS-L1S
bit 6: BeiDou
bit 7: Galileo
.numsvnumberNumber of visible satellites
.numsv_trackingnumberNumber of tracking satellites
.numsv_calcposnumberNumber of satellites used for position calculation
.numsv_calcvelnumberNumber of satellites used for speed calculation
.datetimenumberGPS time (Unixtime) [ms]
.latitudenumberLatitude [degree]
.longitudenumberLongitude [degree]
.altitudenumberAltitude [m]
.geoidnumberGeoid height [m]
.velocitynumberVelocity [m/s]
.directionnumberDirection [degree]

gnss.stop([backup])

Stops GNSS positioning.
Note that it is not possible to execute this method from within a GNSS positioning callback.

Even if GNSS positioning is stopped, the final positioning data and satellite orbit information are retained on the SRAM, thus positioning can be resumed with "Hot Start". If the power of the device is turned off, the data on the SRAM is lost and thus the positioning starts as "Cold Start".

The final positioning data and satellite orbit information can be backed up to the flash memory before the device is powered off. The backed up data will be automatically extracted onto SRAM the next time the device is launched and used for "Hot Start". However, if the satellite orbit information has expired or the data has been corrupted, the operation becomes "Cold Start".

NameTypeM/OSummary                            Note
backupbooleanoptionalBacks up the final positioning data and satellite orbit information to the internal storage (flash memory).
true: Enable
false: Disable
The default value is false.
Frequent writing to flash memory can cause memory failure, therefore it is recommended to back up only at specific times, such as before turning off the device.
returnboolean-true: Success
false: Failure



Object Usage Examples

Sample1

This is a sample that displays GNSS positioning information every 3 seconds.

gnss.start(function(pos) {
    print(new Date(pos.datetime).toString() 
    + ',' + '0x' + ('00' + pos.svtype.toString(16).toUpperCase()).substr(-2) 
    + ',' + pos.numsv 
    + ',' + pos.numsv_tracking 
    + ',' + pos.numsv_calcpos 
    + ',' + pos.numsv_calcvel 
    + ',' + pos.pos_fixmode 
    + ',' + pos.vel_fixmode 
    + ',' + pos.latitude.toFixed(6) 
    + ',' + pos.longitude.toFixed(6) 
    + ',' + pos.altitude.toFixed(1) 
    + ',' + pos.geoid.toFixed(1) 
    + ',' + pos.velocity.toFixed(1) 
    + ',' + pos.direction.toFixed(1));
}, 3); //3s, cold start, GPS+GLONASS

Sample2

This is a sample that stops GNSS positioning if a valid fix mode is detected consecutively.

var NUM_OF_CONSECUTIVE_FIXES = 10;
var fixCnt = 0;

var cb_pos = function(pos) {
    if(pos.pos_fixmode > 1) fixCnt++;
    else fixCnt = 0;
    print(new Date(pos.datetime).toString() 
    + ',' + pos.numsv_tracking 
    + ',' + pos.pos_fixmode 
    + ',' + pos.latitude.toFixed(6) 
    + ',' + pos.longitude.toFixed(6) 
    + ',' + fixCnt);
}

gnss.start(cb_pos, 1, 2, 0x2B); //1s, hot start, GPS+GLONASS+QZSS-L1C/A+QZSS-L1S
while(1) {
    if(fixCnt >= NUM_OF_CONSECUTIVE_FIXES) break;
};
gnss.stop();
print('finish');



Updated: 2022-06-02
← 15. ADC17. Camera →
  • GNSS Global Object
  • Details
    • gnss.start(callback[,cycle[,startMode[,satellite]]])
    • {Position}
    • gnss.stop([backup])
  • Object Usage Examples
    • Sample1
    • Sample2
AboutNewsProductsFAQPrivacy Policy}
NEQTO Console
IntroductionFundamentalsAdministrative ActionsDevice Management NEQTO Apps
NEQTO Bridge
NEQTO Bridge ModuleNEQTO Bridge Wi-Fi ModuleNEQTO Bridge LTE-1 ModuleError Logging Event Messages
API Documentation
API UsageGlobal APIRegional APIAPI Terms of Service
Jigsaw, Inc.
© 2023 JIG-SAW INC.