telemetry

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2025 License: MIT Imports: 27 Imported by: 3

Documentation

Overview

Package telemetry contains clients for reading ACMI data from files or real-time telemetry.

Index

Constants

View Source
const (
	// LowLevelProtocol is the name of the real-time telemetry low level protocol.
	LowLevelProtocol = "XtraLib.Stream"
	// LowLevelProtocolVersion is the supported version of the real-time telemetry low level protocol.
	LowLevelProtocolVersion = "0"
)
View Source
const (
	// HighLevelProtocol is the name of the real-time telemetry high level protocol.
	HighLevelProtocol = "Tacview.RealTimeTelemetry"
	// HighLevelProtocolVersion is the supported version of the real-time telemetry high level protocol.
	HighLevelProtocolVersion = "0"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// Run reads telemetry data.
	Run(context.Context) error
	// Stream publishes telemetry data to the given channels.
	Stream(context.Context, *sync.WaitGroup, chan<- sim.Started, chan<- sim.Updated, chan<- sim.Faded)
	// Bullseye returns the position of the given coalition's bullseye.
	Bullseye(coalitions.Coalition) (orb.Point, error)
	// Time returns the current mission time.
	Time() time.Time
}

Client reads telemetry data from a data source.

type ClientHandshake

type ClientHandshake struct {
	// LowLevelProtocolVersion is the version of the low level protocol.
	LowLevelProtocolVersion string
	// HighLevelProtocolVersion is the version of the high level protocol.
	HighLevelProtocolVersion string
	// Hostname of the client.
	Hostname string
	// contains filtered or unexported fields
}

ClientHandshake is the handshake packet sent by the client in response to the host handshake.

func DecodeClientHandshake

func DecodeClientHandshake(packet string) (*ClientHandshake, error)

DecodeClientHandshake decodes a client handshake from the given string.

func NewClientHandshake

func NewClientHandshake(hostname string, password string) (handshake *ClientHandshake)

NewClientHandshake creates a new client handshake using the given client hostname and password.

func (*ClientHandshake) Encode

func (h *ClientHandshake) Encode(algorithm HashAlgorithm) (packet string)

Encode the client handshake as a string.

func (*ClientHandshake) HashCRC32ISOHDLC added in v0.14.0

func (h *ClientHandshake) HashCRC32ISOHDLC() string

Returns the CRC32ISOHDLC hash of the password. If the handshake was created using NewClientHandshake, the hash is computed from the provided password. If the handshakre was created using DecodeClientHandshake, the hash is read from the decoded packet, or is "0" if no CRC32ISOHDLC hash was found.

func (*ClientHandshake) HashCRC64WE added in v0.14.0

func (h *ClientHandshake) HashCRC64WE() string

HashCRC64WE returns the CRC64WE hash of the password. If the handshake was created using NewClientHandshake, the hash is computed from the provided password. If the handshake was created using DecodeClientHandshake, the hash is read from the decoded packet, or is "0" if no CRC64WE hash was found.

type FileReader

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

FileReader reads telemetry data from a file.

func NewFileClient

func NewFileClient(
	filePath string,
	updateInterval time.Duration,
) *FileReader

NewFileClient creates a new telemetry client for reading data from a file.

func (*FileReader) Bullseye

func (c *FileReader) Bullseye(coalition coalitions.Coalition) (orb.Point, error)

func (*FileReader) Run

func (r *FileReader) Run(ctx context.Context) error

Run reads telemetry data from the file.

func (*FileReader) Stream

func (c *FileReader) Stream(ctx context.Context, wg *sync.WaitGroup, starts chan<- sim.Started, updates chan<- sim.Updated, fades chan<- sim.Faded)

func (*FileReader) Time

func (c *FileReader) Time() time.Time

type HashAlgorithm added in v0.14.0

type HashAlgorithm string
const (
	// CRC64WE is the CRC-64/WE hash algorithm.
	CRC64WE HashAlgorithm = "CRC-64/WE"
	// CRC32ISOHDLC is the CRC-32/ISO-HDLC hash algorithm.
	CRC32ISOHDLC HashAlgorithm = "CRC-32/ISO-HDLC"
)

func (HashAlgorithm) String added in v0.14.0

func (a HashAlgorithm) String() string

type HostHandshake

type HostHandshake struct {
	// LowLevelProtocolVersion is the version of the low level protocol.
	LowLevelProtocolVersion string
	// HighLevelProtocolVersion is the version of the high level protocol.
	HighLevelProtocolVersion string
	// Hostname of the server.
	Hostname string
}

HostHandshake is the handshake packet sent by the host.

func DecodeHostHandshake

func DecodeHostHandshake(packet string) (HostHandshake, error)

DecodeHostHandshake decodes a host handshake from the given string.

func (*HostHandshake) Encode

func (h *HostHandshake) Encode() (packet string)

Encode the host handshake as a string.

type RealTimeClient added in v0.13.4

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

RealTimeClient reads real-time telemetry data from a remote telemetry service.

func NewRealTimeClient added in v0.13.4

func NewRealTimeClient(
	address,
	clientHostname,
	password string,
	connectionTimeout time.Duration,
	updateInterval time.Duration,
) *RealTimeClient

NewRealTimeClient creates a new telemetry client for reading real-time telemetry data.

func (*RealTimeClient) Bullseye added in v0.13.4

func (c *RealTimeClient) Bullseye(coalition coalitions.Coalition) (orb.Point, error)

func (*RealTimeClient) Run added in v0.13.4

func (c *RealTimeClient) Run(ctx context.Context) error

Run reads telemetry data until the context is canceled, automatically reconnecting if the connection is lost, a read timeout occurs, or an EOF is received.

func (*RealTimeClient) Stream added in v0.13.4

func (c *RealTimeClient) Stream(ctx context.Context, wg *sync.WaitGroup, starts chan<- sim.Started, updates chan<- sim.Updated, fades chan<- sim.Faded)

func (*RealTimeClient) Time added in v0.13.4

func (c *RealTimeClient) Time() time.Time

Jump to

Keyboard shortcuts

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