gpsfeed

package
v0.1.24 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2023 License: BSD-3-Clause Imports: 7 Imported by: 0

README

Overview

  • library to handle gps nmea emitting devices via bufio.Scanner interface
  • automatic recovery (watchdog), handling cecksums,
  • can detect if the devices is unresponsive, emitts defective frames, disconnects, missbehaves ...
  • 100 % pure go, stdlib only, no external dependencies
  • see api.go for more details, cmd/gpsfeed for an example app

Documentation

Overview

package gpsfeed

package gpsfeed ...

Index

Constants

View Source
const DeviceTimeout = _deviceDataValidTimeout + 1 // wait before try to access device again

DeviceTimeout ...

Variables

This section is empty.

Functions

func CheckSumTag

func CheckSumTag(sentence string) string

CheckSumTag calculates the NMEA sentence CheckSum and returns an tag string [ok|fail]

func CheckSumValid

func CheckSumValid(sentence string) bool

CheckSumValid validates an NMEA sentence checksum

func GetDeviceName

func GetDeviceName(arg, old string) string

GetDeviceName ...

Types

type GpsDevice

type GpsDevice struct {
	FileIO     string         // file name, eg. /dev/gps0
	Feed       *bufio.Scanner // line feed
	ErrCount   atomic.Uint64  // global err counter
	InitDone   atomic.Bool    // initial time sync done
	Responsive atomic.Bool    // feed state [responsive/unresponsive]
	DataValid  atomic.Bool    // feed state [datavalid/invalidutput]]
	Dog        atomic.Bool    // watchdog state
	Lock       sync.Mutex     // global device lock
	Handle     *os.File       // file handle
	Global     sync.WaitGroup // global state
}

GpsDevice holds all the feed, locks and handles for a specifc gps input device dongle

func (*GpsDevice) CheckErrAdd

func (dev *GpsDevice) CheckErrAdd() bool

CheckErrAdd validates the current number of global errors

func (*GpsDevice) Close

func (dev *GpsDevice) Close()

Close ...

func (*GpsDevice) GetErr

func (dev *GpsDevice) GetErr() string

GetErr returns the number of errors assoc with this device

func (*GpsDevice) Open

func (dev *GpsDevice) Open()

Open ...

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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