daemon

package
v0.0.0-...-8995d27 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2025 License: MIT Imports: 41 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cmd

func Cmd(progName string, args []string)

func NewDispatcher

func NewDispatcher(lg *slog.Logger, pktProcs map[gpsprot.Tag]gpsprot.PacketProcessor, clk *ts.Clock, pulseWidth time.Duration, cfg *Config, gm *mon.Grandmaster, rc *mon.ProxyRefClock, obs obs.Observer, tStart time.Time) (*gpsevent.Dispatcher, error)

func NewSdHandler

func NewSdHandler(minLevel slog.Level, w io.Writer) slog.Handler

Types

type Config

type Config struct {
	Serial     SerialConfig
	GPS        GPSConfig
	PHC        PHCConfig
	Proxy      proxy.Config
	HTTP       []HTTPConfig
	LeapSecond LeapSecondConfig
	PTP        PTPConfig
	NTP        NTPConfig
	Log        LogConfig
}

func LoadConfig

func LoadConfig(paths ...string) (*Config, error)

type GPSConfig

type GPSConfig struct {
	Config             bool         `toml:"config"`
	Mobile             bool         `toml:"mobile"`
	Resurvey           bool         `toml:"resurvey"`
	SurveyTime         uint32       `toml:"surveyTime"`
	SurveyAcc          float64      `toml:"surveyAcc"`
	FixedPosECEF       geopos.ECEF  `toml:"fixedPosECEF"`
	FixedPosAcc        float64      `toml:"fixedPosAcc"`
	AntennaCableDelay  float64      `toml:"antennaCableDelay"`  // in nanoseconds
	AntennaCableLength float64      `toml:"antennaCableLength"` // in meters
	AntennaCableVF     float64      `toml:"antennaCableVF"`     // velocity factor
	TimeGNSS           gpsprot.GNSS `toml:"timeGNSS"`
	PulseWidth         float64      `toml:"pulseWidth"`
	SatellitesOutput   *bool        `toml:"satellitesOutput"`
	RTCMOutput         *bool        `toml:"rtcmOutput"`
	Vendor             string       `toml:"vendor"`
}

func (*GPSConfig) CreatePacketProcessors

func (c *GPSConfig) CreatePacketProcessors() (map[gpsprot.Tag]gpsprot.PacketProcessor, error)

type HTTPConfig

type HTTPConfig struct {
	Listen  string `toml:"listen"`
	PProf   bool   `toml:"pprof"`
	GUI     *bool  `toml:"gui"`     // Serve graphical user interface
	Metrics *bool  `toml:"metrics"` // Serve Prometheus metrics endpoint
}

type LeapSecondConfig

type LeapSecondConfig struct {
	Date   toml.LocalDate `toml:"date"`
	Before uint8          `toml:"before"`
	After  uint8          `toml:"after"`
}

type LogConfig

type LogConfig struct {
	Interval int    `toml:"interval"`
	Verbose  bool   `toml:"verbose"`
	Dir      string `toml:"dir"`
	Clock    bool   `toml:"clock"`  // whether to generate a clock log
	Event    bool   `toml:"event"`  // whether to generate an event log
	Packet   bool   `toml:"packet"` // whether to generate a packet log
}

func (*LogConfig) ClockPath

func (cfg *LogConfig) ClockPath(phcPath, ext string) string

ClockPath returns the path for the clock log file. phcPath is the path to the PHC device (e.g. /dev/ptp0)

func (*LogConfig) EventPath

func (cfg *LogConfig) EventPath(serialPath, ext string) string

func (*LogConfig) PacketPath

func (cfg *LogConfig) PacketPath(serialPath, ext string) string

type NTPConfig

type NTPConfig struct {
	Sock *NTPSockConfig `toml:"sock"`
}

func (*NTPConfig) NewRefClock

func (cfg *NTPConfig) NewRefClock(lg *slog.Logger) (mon.RefClock, error)

type NTPSockConfig

type NTPSockConfig struct {
	Path string `toml:"path"`
}

type PHCConfig

type PHCConfig struct {
	Interface string `toml:"interface"`
	Pin       uint8  `toml:"pin"`
	Channel   uint8  `toml:"channel"`
	Wait      bool   `toml:"wait"`
}

func (PHCConfig) OpenClock

func (cfg PHCConfig) OpenClock(ctx context.Context, lg *slog.Logger) (*ts.Clock, error)

func (PHCConfig) PinDesc

func (cff PHCConfig) PinDesc() ts.PinDesc

type PTP4LConfig

type PTP4LConfig struct {
	UDSAddress string `toml:"udsAddress"`
}

type PTPConfig

type PTPConfig struct {
	ClockAccuracy int          `toml:"clockAccuracy"`
	DomainNumber  uint8        `toml:"domainNumber"`
	MajorSdoID    uint8        `toml:"majorSdoId"`
	MinorSdoID    uint8        `toml:"minorSdoId"`
	PTP4L         *PTP4LConfig `toml:"ptp4l"`
}

func (*PTPConfig) NewClient

func (cfg *PTPConfig) NewClient() (*pmc.Client, error)

type SdHandler

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

func (*SdHandler) Enabled

func (h *SdHandler) Enabled(c context.Context, level slog.Level) bool

func (*SdHandler) Handle

func (h *SdHandler) Handle(c context.Context, r slog.Record) error

func (*SdHandler) WithAttrs

func (h *SdHandler) WithAttrs(attrs []slog.Attr) slog.Handler

func (*SdHandler) WithGroup

func (h *SdHandler) WithGroup(name string) slog.Handler

type SerialConfig

type SerialConfig struct {
	Device string
	Speed  *int
}

Jump to

Keyboard shortcuts

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