publishers

package
v0.0.0-...-7984459 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FilePublisher

type FilePublisher struct {
	// Folder where the file will be saved.
	Folder string
	// Title of the mission.
	Title string
}

FilePublisher publishes ACMI messages to a file.

func (*FilePublisher) Publish

func (p *FilePublisher) Publish(ctx context.Context, initials InitialsProvider, messages <-chan string) error

Publish implements [Publisher.Publish] by writing messages to a file. The file is created in the FilePublisher's folder, and is named using the FilePublisher's title and the current date and time.

type Initials

type Initials struct {
	Global    *objects.Object
	Bullseyes []*objects.Object
}

Initials implements InitialsProvider.

func (*Initials) Get

func (i *Initials) Get() ([]string, error)

Get implements [InitialsProvider.Get].

type InitialsProvider

type InitialsProvider interface {
	// Get returns the ACMI lines for the initial global object and navaids state.
	Get() ([]string, error)
}

InitialsProvider provides initial object state.

type Publisher

type Publisher interface {
	// Publish is a blocking function that publishes ACMI messages to an output until the context is cancelled.
	Publish(ctx context.Context, initials InitialsProvider, messages <-chan string) error
}

Publisher publishes ACMI messages to an output.

type Server

type Server struct {
	// Address to listen on.
	Address string
	// Password required for clients to connect.
	Password string
}

Server listens for real-time telemetry client connections and publishes ACMI messages over TCP.

func (*Server) Publish

func (s *Server) Publish(ctx context.Context, initials InitialsProvider, messages <-chan string) error

Publish implements [Publisher.Publish] by listening for client connections on the server's address, negotiating a handshake, and writing ACMI data over TCP.

type StdoutPublisher

type StdoutPublisher struct{}

StdoutPublisher publishes ACMI messages to stdout.

func (*StdoutPublisher) Publish

func (p *StdoutPublisher) Publish(ctx context.Context, initials InitialsProvider, messages <-chan string) error

Publish implements [Publisher.Publish] by writing messages to stdout.

Jump to

Keyboard shortcuts

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