protocol

package
v0.0.0-...-844acb8 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2025 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound      = errors.New("not found")
	ErrClosed        = errors.New("closed")
	ErrUnimplemented = errors.New("unimplemented")
)
View Source
var DefaultDialFunc = func(network, addr string) (net.Conn, error) {
	conn, err := net.Dial(network, addr)
	if err != nil {
		return nil, errors.WithStack(err)
	}

	return conn, nil
}

Functions

func Register

func Register(identifier Identifier, factory ProtocolFactory)

Types

type AveragePositionPayload

type AveragePositionPayload struct {
	Coordinates   Coordinates `json:"coordinates"`
	AntennaOffset float64     `json:"antenna_offset"`
}

type BaseInfo

type BaseInfo struct {
	Mode          string
	AntennaOffset float64
	Latitude      float64
	Longitude     float64
	Height        float64
	Accumulation  int
}

type CasterInfo

type CasterInfo struct {
	Country      string  `json:"country"`
	Distance     float64 `json:"distance"`
	FallbackHost string  `json:"fallback_host"`
	FallbackPort string  `json:"fallback_port"`
	Host         string  `json:"host"`
	ID           string  `json:"id"`
	Latitude     string  `json:"latitude"`
	Longitude    string  `json:"longitude"`
	NMEA         string  `json:"nmea"`
	Operator     string  `json:"operator"`
	OtherDetails *string `json:"other_details"`
	Port         string  `json:"port"`
	Site         string  `json:"site"`
}

type Coordinates

type Coordinates struct {
	Latitude  float64 `json:"latitude"`
	Longitude float64 `json:"longitude"`
	Height    float64 `json:"height"`
}

type DialFunc

type DialFunc func(network string, addr string) (net.Conn, error)

type IOConfig

type IOConfig struct {
	IOType   string           `json:"io_type"`
	Settings IOConfigSettings `json:"settings"`
}

type IOConfigSettings

type IOConfigSettings struct {
	NTRIPCli NTRIPCliConfig `json:"ntripcli"`
}

type Identifier

type Identifier string

type NTRIPCliConfig

type NTRIPCliConfig struct {
	Address            string `json:"address"`
	Port               int    `json:"port"`
	Username           string `json:"username"`
	Password           string `json:"password"`
	MountPoint         string `json:"mount_point"`
	SendPositionToBase bool   `json:"send_position_to_base"`
}

type NTRIPPayload

type NTRIPPayload struct {
	CAS []CasterInfo  `json:"cas"`
	Net []NetworkInfo `json:"net"`
	Str []StreamInfo  `json:"str"`
}

type NetworkInfo

type NetworkInfo struct {
	Authentication string   `json:"authentication"`
	Distance       *float64 `json:"distance"`
	Fee            string   `json:"fee"`
	ID             string   `json:"id"`
	Operator       string   `json:"operator"`
	OtherDetails   string   `json:"other_details"`
	WebNet         string   `json:"web_net"`
	WebReg         string   `json:"web_reg"`
	WebStr         string   `json:"web_str"`
}

type Operations

type Operations interface {
	// Connect initiates a new connection to the ReachView service
	// It should be called before any other operation
	Connect(ctx context.Context) error

	// Close closes the current connection to the ReachView service
	Close(ctx context.Context) error

	// Alive returns true if the ReachView websocket connection is alive, false otherwise
	Alive(ctx context.Context) (bool, error)

	// Version returns the current ReachView version,
	// true if the module uses the stable channel or an error
	Version(ctx context.Context) (string, bool, error)

	// On listens for messages of the given type on ReachView websocket connection
	On(ctx context.Context, mType string) (chan any, error)

	// Emit sends the given message on the ReachView websocket connection
	Emit(ctx context.Context, mType string, message any) error

	// Configuration retrieves the module's configuration
	Configuration(ctx context.Context) (any, error)

	// SetBase updates the base configuration
	SetBase(ctx context.Context, funcs ...SetBaseOptionFunc) error

	GetBaseInfo(ctx context.Context) (*BaseInfo, error)

	// Reboot restarts the module
	Reboot(ctx context.Context) error

	// AveragePosition gathers data and computes the average position
	AveragePosition(ctx context.Context) (*TaskMessage[AveragePositionPayload], error)

	//GetNTRIPMountPoint retrieves availables mount point
	GetNTRIPMountPoint(ctx context.Context) (*TaskMessage[NTRIPPayload], error)

	//SetBaseCorrections updates the corrections obtaining station
	SetBaseCorrections(ctx context.Context, funcs ...SetBaseCorrectionsFunc) error

	//SetModem updates mobile data config
	SetModem(ctx context.Context, funcs ...SetModemOptionsFunc) error

	//GetModemConfiguration  mobile data config
	GetModemConfiguration(ctx context.Context) (any, error)

	//GetModemAuthentication  mobile data config
	GetModemAuthentication(ctx context.Context) (any, error)

	//SetDeviceAntennaHeight update device config
	SetDeviceAntennaHeight(ctx context.Context, funcs ...SetBaseOptionFunc) error
}

type Protocol

type Protocol interface {
	Identifier() Identifier
	Available(ctx context.Context, addr string) (bool, error)
	Operations(addr string) Operations
}

func Availables

func Availables(ctx context.Context, addr string, timeout time.Duration) ([]Protocol, error)

type ProtocolFactory

type ProtocolFactory func(opts *ProtocolOptions) (Protocol, error)

type ProtocolOptionFunc

type ProtocolOptionFunc func(opts *ProtocolOptions)

func WithProtocolDial

func WithProtocolDial(dial DialFunc) ProtocolOptionFunc

func WithProtocolLogger

func WithProtocolLogger(logger logger.Logger) ProtocolOptionFunc

type ProtocolOptions

type ProtocolOptions struct {
	Logger logger.Logger
	Dial   DialFunc
}

func NewProtocolOptions

func NewProtocolOptions(funcs ...ProtocolOptionFunc) *ProtocolOptions

type Registry

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

func DefaultRegistry

func DefaultRegistry() *Registry

func NewRegistry

func NewRegistry() *Registry

func (*Registry) Availables

func (r *Registry) Availables(ctx context.Context, addr string, timeout time.Duration, funcs ...ProtocolOptionFunc) ([]Protocol, error)

func (*Registry) Get

func (r *Registry) Get(identifier Identifier, funcs ...ProtocolOptionFunc) (Protocol, error)

func (*Registry) Register

func (r *Registry) Register(identifier Identifier, factory ProtocolFactory)

type SetBaseCorrectionsFunc

type SetBaseCorrectionsFunc func(opts *SetBaseCorrectionsOptions)

func WithNTRIPAddress

func WithNTRIPAddress(value string) SetBaseCorrectionsFunc

func WithNTRIPMountPoint

func WithNTRIPMountPoint(value string) SetBaseCorrectionsFunc

func WithNTRIPPassword

func WithNTRIPPassword(value string) SetBaseCorrectionsFunc

func WithNTRIPPort

func WithNTRIPPort(value int) SetBaseCorrectionsFunc

func WithNTRIPUsername

func WithNTRIPUsername(value string) SetBaseCorrectionsFunc

func WithSendPositionToBase

func WithSendPositionToBase(value bool) SetBaseCorrectionsFunc

type SetBaseCorrectionsOptions

type SetBaseCorrectionsOptions struct {
	Address            *string
	Port               *int
	Username           *string
	Password           *string
	MountPoint         *string
	SendPositionToBase *bool
}

func NewSetBaseCorrectionsOptions

func NewSetBaseCorrectionsOptions(funcs ...SetBaseCorrectionsFunc) *SetBaseCorrectionsOptions

type SetBaseOptionFunc

type SetBaseOptionFunc func(opts *SetBaseOptions)

func WithAccumulation

func WithAccumulation(value int) SetBaseOptionFunc

func WithBaseAntennaOffset

func WithBaseAntennaOffset(value float64) SetBaseOptionFunc

func WithBaseHeight

func WithBaseHeight(value float64) SetBaseOptionFunc

func WithBaseLatitude

func WithBaseLatitude(value float64) SetBaseOptionFunc

func WithBaseLongitude

func WithBaseLongitude(value float64) SetBaseOptionFunc

func WithBaseMode

func WithBaseMode(value string) SetBaseOptionFunc

type SetBaseOptions

type SetBaseOptions struct {
	Mode          *string
	AntennaOffset *float64
	Latitude      *float64
	Longitude     *float64
	Height        *float64
	Accumulation  *int
}

func NewSetBaseOptions

func NewSetBaseOptions(funcs ...SetBaseOptionFunc) *SetBaseOptions

type SetModemOptions

type SetModemOptions struct {
	Apn      *string
	Type     *string
	Username *string
	Password *string
	Pin      *string
}

func NewSetModemOptions

func NewSetModemOptions(funcs ...SetModemOptionsFunc) *SetModemOptions

type SetModemOptionsFunc

type SetModemOptionsFunc func(opts *SetModemOptions)

func WithApn

func WithApn(value string) SetModemOptionsFunc

func WithPassword

func WithPassword(value string) SetModemOptionsFunc

func WithPin

func WithPin(value string) SetModemOptionsFunc

func WithType

func WithType(value string) SetModemOptionsFunc

func WithUsername

func WithUsername(value string) SetModemOptionsFunc

type StreamInfo

type StreamInfo struct {
	Authentication string  `json:"authentication"`
	Bitrate        string  `json:"bitrate"`
	Carrier        string  `json:"carrier"`
	ComprEncryp    string  `json:"compr_encryp"`
	Country        string  `json:"country"`
	Distance       float64 `json:"distance"`
	Fee            string  `json:"fee"`
	Format         string  `json:"format"`
	FormatDetails  string  `json:"format_details"`
	Generator      string  `json:"generator"`
	ID             string  `json:"id"`
	Latitude       string  `json:"latitude"`
	Longitude      string  `json:"longitude"`
	Mountpoint     string  `json:"mountpoint"`
	NavSystem      string  `json:"nav_system"`
	Network        string  `json:"network"`
	NMEA           string  `json:"nmea"`
	OtherDetails   string  `json:"other_details"`
	Solution       string  `json:"solution"`
}

type TaskMessage

type TaskMessage[T any] struct {
	Name    string `json:"name"`
	State   string `json:"state"`
	Payload T      `json:"payload"`
}

Directories

Path Synopsis
v1
v2

Jump to

Keyboard shortcuts

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