ntrip

package
v0.0.0-...-f0b4dbc Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

README

ntrip

Decode gnss based configuration files suitable for configuring ntripcaster and bnc

Documentation

Index

Constants

View Source
const (
	AliasesFile = "aliases.csv"
	FormatsFile = "formats.csv"
	ModelsFile  = "models.csv"
	MountsFile  = "mounts.csv"
	UsersFile   = "users.csv"
)

Variables

This section is empty.

Functions

func Read

func Read(rd io.Reader, dec Decoder) error

Read reads csv input and decodes the data into a given decoder interface.

func ReadBytes

func ReadBytes(data []byte, dec Decoder) error

ReadFile reads csv input from a byte listand decodes elements into a given decoder interface.

func ReadFile

func ReadFile(path string, dec Decoder) error

ReadFile reads csv input from a file and decodes elements into a given decoder interface.

func ReadFormats

func ReadFormats(path string) (map[string][]string, error)

func ReadModels

func ReadModels(path string) (map[string]string, error)

ReadModels extracts a map of GNNS receiver models from a csv file.

func Write

func Write(writer io.Writer, enc Encoder) error

Write encodes and writes a given decoder interface.

func WriteBytes

func WriteBytes(enc Encoder) ([]byte, error)

WriteBytes encodes a given encoder interface into a byte slice.

Types

type Alias

type Alias struct {
	Alias string
	Mount string
}

Mount represents an ntripcaster alias mount point.

func ReadAliases

func ReadAliases(path string) ([]Alias, error)

type Aliases

type Aliases []Alias

Mounts represents a list of ntripcaster alias mount information.

func (*Aliases) Decode

func (a *Aliases) Decode(data [][]string) error

Decode extracts a set of alias mount information from rows as expected from csv mount entries.

func (Aliases) Encode

func (a Aliases) Encode() [][]string

Encode builds a set of string slices representing the csv alias mount entries.

func (Aliases) Fields

func (a Aliases) Fields() int

Fields returns the number of expected csv fields.

func (Aliases) Header

func (a Aliases) Header() []string

Header returns a slice of the expected csv header fields.

type Caster

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

Caster holds the decoded config data.

func NewCaster

func NewCaster(common, input string) (*Caster, error)

NewCaster returns a Caster pointer after reading all expected config files.

func (*Caster) Aliases

func (c *Caster) Aliases() []Alias

Aliases returns all configured aliases as a slice.

func (*Caster) Format

func (c *Caster) Format(details string) ([]string, bool)

Format looks up the internal config for the given format details.

func (*Caster) Model

func (c *Caster) Model(model string) (string, bool)

Model looks up the internal config for the given model details.

func (*Caster) Mounts

func (c *Caster) Mounts() []Mount

Mounts returns all configured mounts as a slice.

func (*Caster) Users

func (c *Caster) Users() []User

Users returns all configured users as a slice.

type Decoder

type Decoder interface {
	Fields() int
	Decode([][]string) error
}

Decoder is used to unpack csv information.

type Encoder

type Encoder interface {
	Header() []string
	Encode() [][]string
}

Encode is used to pack csv information.

type Format

type Format struct {
	Format  string
	Details []string
}

Format represents the RTCM message types with update periods in parenthesis in seconds.

type Formats

type Formats []Format

func (*Formats) Decode

func (f *Formats) Decode(data [][]string) error

func (Formats) Encode

func (f Formats) Encode() [][]string

func (Formats) Fields

func (f Formats) Fields() int

func (Formats) Header

func (f Formats) Header() []string

type Model

type Model struct {
	Model string
	Name  string
}

Model represents a set of GNSS receiver model name aliases.

type Models

type Models []Model

Models represents a set of GNSS receiver model aliases.

func (*Models) Decode

func (m *Models) Decode(data [][]string) error

Decode extracts model alias information from string slices as expected from csv files.

func (Models) Encode

func (m Models) Encode() [][]string

Encode builds model alias information as expected in csv files.

func (Models) Fields

func (m Models) Fields() int

Fields returns the number of expected fields in a csv file representation.

func (Models) Header

func (m Models) Header() []string

Header returns a slice of expected csv file header values.

type Mount

type Mount struct {
	Mount      string
	Mark       string
	Country    string
	Format     string
	Details    string
	Navigation string
	Groups     []string
	User       string
	Address    string
}

Mount represents an ntripcaster mount point.

func ReadMounts

func ReadMounts(path string) ([]Mount, error)

type Mounts

type Mounts []Mount

Mounts represents a list of ntripcaster mount information.

func (*Mounts) Decode

func (m *Mounts) Decode(data [][]string) error

Decode extracts a set of mount information from rows as expected from csv mount entries.

func (Mounts) Encode

func (m Mounts) Encode() [][]string

Encode builds a set of string slices representing the csv mount entries.

func (Mounts) Fields

func (m Mounts) Fields() int

Fields returns the number of expected csv fields.

func (Mounts) Header

func (m Mounts) Header() []string

Header returns a slice of the expected csv header fields.

type User

type User struct {
	Username string
	Groups   []string
	Password string
}

User represents a registered account user.

func ReadUsers

func ReadUsers(path string) ([]User, error)

type Users

type Users []User

Users represents a list of account users.

func (*Users) Decode

func (u *Users) Decode(data [][]string) error

Decode is a function to extract information from a list of string slices, as expected for the entries in a csv file.

func (Users) Encode

func (u Users) Encode() [][]string

Encode is a function to build a list of string slices as expected for the entries in a csv file.

func (Users) Fields

func (u Users) Fields() int

Fields returns the number of expected csv fields.

func (Users) Header

func (u Users) Header() []string

Header is a function to build a string slice as expected for the first line of a csv file.

Jump to

Keyboard shortcuts

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