gps

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2026 License: EPL-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseCoordinates

func ParseCoordinates(coords string) (float64, float64, error)

ParseCoordinates parses coordinates string "lat,lon" into latitude and longitude

Types

type DeviceHandler

type DeviceHandler struct {
	// contains filtered or unexported fields
}

DeviceHandler handles GPS device communication

func NewDeviceHandler

func NewDeviceHandler(manager *Manager) *DeviceHandler

NewDeviceHandler creates a new DeviceHandler

func (*DeviceHandler) IsRunning

func (d *DeviceHandler) IsRunning() bool

IsRunning returns whether the device handler is running

func (*DeviceHandler) ReadAndUpdateCoordinates

func (d *DeviceHandler) ReadAndUpdateCoordinates() error

ReadAndUpdateCoordinates reads from GPS device and updates coordinates if valid

func (*DeviceHandler) Start

func (d *DeviceHandler) Start() error

Start starts the device handler

func (*DeviceHandler) Stop

func (d *DeviceHandler) Stop() error

Stop stops the device handler

type HealthStatus

type HealthStatus string

HealthStatus represents the GPS health status

const (
	HealthStatusHealthy     HealthStatus = "HEALTHY"
	HealthStatusDeviceError HealthStatus = "DEVICE_ERROR"
	HealthStatusIPError     HealthStatus = "IP_ERROR"
	HealthStatusOff         HealthStatus = "OFF"
)

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager manages GPS functionality

func GetInstance

func GetInstance() *Manager

GetInstance returns the singleton GPS Manager instance

func (*Manager) GetModuleIndex

func (m *Manager) GetModuleIndex() int

GetModuleIndex returns the module index

func (*Manager) GetName

func (m *Manager) GetName() string

GetName returns the module name

func (*Manager) GetStatus

func (m *Manager) GetStatus() *Status

GetStatus returns the GPS status

func (*Manager) InstanceConfigUpdated

func (m *Manager) InstanceConfigUpdated()

InstanceConfigUpdated handles configuration updates

func (*Manager) Start

func (m *Manager) Start() error

Start starts the GPS Manager

func (*Manager) Stop

func (m *Manager) Stop() error

Stop stops the GPS Manager

type Mode

type Mode string

Mode represents the GPS mode

const (
	ModeAuto    Mode = "AUTO"
	ModeDynamic Mode = "DYNAMIC"
	ModeManual  Mode = "MANUAL"
	ModeOff     Mode = "OFF"
)

type Status

type Status struct {
	// contains filtered or unexported fields
}

Status represents the GPS status

func NewStatus

func NewStatus() *Status

NewStatus creates a new GPS status

func (*Status) GetHealthStatus

func (s *Status) GetHealthStatus() HealthStatus

GetHealthStatus returns the health status

func (*Status) SetHealthStatus

func (s *Status) SetHealthStatus(status HealthStatus)

SetHealthStatus sets the health status

type WebHandler

type WebHandler struct {
	// contains filtered or unexported fields
}

WebHandler handles IP-based GPS location

func NewWebHandler

func NewWebHandler(manager *Manager) *WebHandler

NewWebHandler creates a new WebHandler

func (*WebHandler) GetCoordinates

func (w *WebHandler) GetCoordinates() string

GetCoordinates returns the current coordinates

func (*WebHandler) Start

func (w *WebHandler) Start() error

Start starts the web handler. The first lookup runs in the background so GPS startup and config reload do not wait on the network.

func (*WebHandler) Stop

func (w *WebHandler) Stop() error

Stop stops the web handler

func (*WebHandler) UpdateCoordinates

func (w *WebHandler) UpdateCoordinates() error

UpdateCoordinates updates AUTO-mode coordinates from the IP location service. It does not change the external IP address. On failure the previous coordinates stay in place.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL