telemetry

package
v0.13.4 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: MIT Imports: 25 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
	// PasswordHash is the CRC64 hash of the password.
	PasswordHash string
}

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() (packet string)

Encode the client handshake as a string.

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 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