Skip to main content
Version: v3.9.0

GPS

The GPS manager resolves agent geographic coordinates for Controller reporting and optional NMEA/device integration. It supports AUTO, DYNAMIC, MANUAL, and OFF modes with async initialization.

Code: internal/gps/

Purpose​

  • Determine coordinates from GPS device, web geolocation, or manual config
  • Expose GPS state for status and Controller POST
  • Serve optional web-based geolocation handler (dynamic mode)
  • Schedule periodic coordinate updates

Dependencies​

Depends onReason
configGPS mode, manual coordinates, device paths
fieldagentGPS config sync callback on reload
Used byReason
supervisorStarted before EdgeletAPI
edgeletapiGET/POST /v1/system/gps
fieldagentInstanceGPSConfigUpdated on config reload

Modes​

ModeBehavior
OFFNo coordinate collection
MANUALStatic coordinates from config
DYNAMICWeb/geolocation handler
AUTODevice NMEA with fallback chain

Implementation split: device.go, nmea/, web.go.

Lifecycle​

Start​

  1. Reset context (supervisor restart safe)
  2. startCoordinateUpdateScheduler()
  3. Async initializeGps() in goroutine. Failures fall back to OFF mode

Stop​

Cancel scheduler and main context.

Configuration​

GPS settings in config profiles and Controller-pushed fog config. Field Agent registers SetGPSConfigCallback on Supervisor for dedicated sync.

EdgeletAPI allows operator read/update via /v1/system/gps.

Module status​

PropertyValue
StatusReporter index6 (utils.GPSManager)

Internal gps.Status tracks health, coordinates, mode, last update.

External APIs​

RouteRole
GET /v1/system/gpsRead GPS state
POST /v1/system/gpsUpdate manual/dynamic settings

Controller sync via Field Agent fog config POST.

Observability​

  • Log module: "GPS Manager"
  • Health status enum on internal Status object

Failure modes​

SymptomTypical cause
OFF mode after startInit error; device missing
Stale coordinatesScheduler stopped; mode OFF
IP geolocation errorsNetwork blocked; sets health to IP error

Code map​

FileRole
manager.goMode scheduling, init, config reactions
device.goHardware GPS
web.goWeb geolocation
nmea/Sentence parsing

Related: Field agent, Edgelet API module, Status reporter.

Group 3See anything wrong with the document? Help us improve it!