Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 the sentences already buffered for this scan. A valid fix updates coordinates. Sentences with no fix return errNoFix and leave the stored coordinates unchanged. No bytes, or a port error, is returned to the caller as a device failure.
type HealthStatus ¶
type HealthStatus string
HealthStatus represents the GPS health status
const ( HealthStatusHealthy HealthStatus = "HEALTHY" HealthStatusNoFix HealthStatus = "NO_FIX" 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 ¶
GetModuleIndex returns the module index
func (*Manager) InstanceConfigUpdated ¶
func (m *Manager) InstanceConfigUpdated()
InstanceConfigUpdated handles configuration updates
type Status ¶
type Status struct {
// contains filtered or unexported fields
}
Status represents the 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) 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.