dcs

package
v0.0.0-...-1c9a717 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

package dcs provides a client for the DCS-gRPC server. This client can be used to query and manipulate the sim.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientConfiguration

type ClientConfiguration struct {
	Address           string
	ConnectionTimeout time.Duration
}

ClientConfiguration configures the DCS-gRPC client.

type DCSClient

type DCSClient interface {
	// WorldClient returns a WorldServiceClient, which can be used to query the sim world state. This includes the theatre name, airbases, and map markers.
	WorldClient() world.WorldServiceClient
	// MissionClient returns a MissionServiceClient, which can be used to query and manipulate the mission scenario. This includes commands to manipulate the Communications menu.
	MissionClient() mission.MissionServiceClient
	// CoalitionClient returns a CoalitionServiceClient, which can be used to query coalition data. This includes the bullseye, groups and player units on the blue and red coalitions.
	CoalitionClient() coalition.CoalitionServiceClient
	// GroupClient returns a GroupServiceClient, which can be used to query the units within a group.
	GroupClient() group.GroupServiceClient
	// UnitClient returns a UnitServiceClient, which can be used to query a unit's name, description and position.
	UnitClient() unit.UnitServiceClient
	// Close closes the DCS-gRPC client connection. This is anti-idomatic Go and should be refactored...
	Close() error
}

DCSClient wraps the DCS-gRPC client.

func NewDCSClient

func NewDCSClient(ctx context.Context, config ClientConfiguration) (DCSClient, error)

type Faded

type Faded struct {
	Timestamp time.Time
	UnitID    uint32
}

type Sim

type Sim interface {
	// Stream aircraft updates from the sim to the provided channels.
	// The first channel receives updates for active aircraft.
	// The second channel receives messages when an aircraft disappears.
	// This function blocks until the context is cancelled.
	Stream(context.Context, chan<- Updated, chan<- Faded) error
	// Bullseye returns the coalition's bullseye center.
	Bullseye(context.Context) (*orb.Point, error)
}

func NewSim

func NewSim(missionClient mission.MissionServiceClient, coalitionClient coalition.CoalitionServiceClient, coalition common.Coalition) Sim

type Updated

type Updated struct {
	Aircraft trackfile.Aircraft
	Frame    trackfile.Frame
}

Jump to

Keyboard shortcuts

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