server

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2025 License: GPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NewSimCreateLocal = iota
	NewSimCreateRemote
	NewSimJoinRemote
)
View Source
const ViceRPCVersion = ViceSerializeVersion
View Source
const ViceSerializeVersion = 38

Version history 0-7 not explicitly recorded 8: STARSPane DCB improvements, added DCB font size control 9: correct STARSColors, so update brightness settings to compensate 10: stop being clever about JSON encoding Waypoint arrays to strings 11: expedite, intercept localizer, fix airspace serialization 12: set 0 DCB brightness to 50 (WAR not setting a default for it) 13: update departure handling for multi-controllers (and rename some members) 14: Aircraft ArrivalHandoffController -> WaypointHandoffController 15: audio engine rewrite 16: cleared/assigned alt for departures, minor nav changes 17: weather intensity default bool 18: STARS ATPA 19: runway waypoints now per-airport 20: "stars_config" and various scenario fields moved there, plus STARSFacilityAdaptation 21: STARS DCB drawing changes, so system list positions changed 22: draw points using triangles, remove some CommandBuffer commands 23: video map format update 24: packages, audio to platform, flight plan processing 25: remove ArrivalGroup/Index from Aircraft 26: make allow_long_scratchpad a single bool 27: rework prefs, videomaps 28: new departure flow 29: TFR cache 30: video map improvements 31: audio squelch for pilot readback 32: VFRs, custom spcs, pilot reported altitude, ... 33: VFRs v2 34: sim/server refactor, signon flow 35: VFRRunways in sim.State, METAR Wind struct changes 36: STARS center representation changes 37: rework STARS flight plan (et al) 38: rework STARS flight plan (et al) ongoing

View Source
const ViceServerAddress = "vice.pharr.org"
View Source
const ViceServerPort = 8000 + ViceRPCVersion

Variables

View Source
var (
	ErrControllerAlreadySignedIn = errors.New("Controller with that callsign already signed in")
	ErrDuplicateSimName          = errors.New("A sim with that name already exists")
	ErrInvalidCommandSyntax      = errors.New("Invalid command syntax")
	ErrInvalidControllerToken    = errors.New("Invalid controller token")
	ErrInvalidPassword           = errors.New("Invalid password")
	ErrInvalidSSimConfiguration  = errors.New("Invalid SimConfiguration")
	ErrNoNamedSim                = errors.New("No Sim with that name")
	ErrNoSimForControllerToken   = errors.New("No Sim running for controller token")
	ErrRPCTimeout                = errors.New("RPC call timed out")
	ErrRPCVersionMismatch        = errors.New("Client and server RPC versions don't match")
	ErrServerDisconnected        = errors.New("Server disconnected")
)

Functions

func BroadcastMessage

func BroadcastMessage(hostname, msg, password string, lg *log.Logger)

func LaunchLocalServer

func LaunchLocalServer(extraScenario string, extraVideoMap string, e *util.ErrorLogger, lg *log.Logger) (chan *Server, error)

func LoadScenarioGroups

func LoadScenarioGroups(isLocal bool, extraScenarioFilename string, extraVideoMapFilename string,
	e *util.ErrorLogger, lg *log.Logger) (map[string]map[string]*ScenarioGroup, map[string]map[string]*Configuration, map[string]*sim.VideoMapManifest)

LoadScenarioGroups loads all of the available scenarios, both from the scenarios/ directory in the source code distribution as well as, optionally, a scenario file provided on the command line. It doesn't try to do any sort of meaningful error handling but it does try to continue on in the presence of errors; all errors will be printed and the program will exit if there are any. We'd rather force any errors due to invalid scenario definitions to be fixed...

func PostDeserializeSTARSFacilityAdaptation

func PostDeserializeSTARSFacilityAdaptation(s *sim.STARSFacilityAdaptation, e *util.ErrorLogger, sg *ScenarioGroup,
	manifest *sim.VideoMapManifest)

func RunServer

func RunServer(extraScenario string, extraVideoMap string, serverPort int, lg *log.Logger)

func TryConnectRemoteServer

func TryConnectRemoteServer(hostname string, lg *log.Logger) chan *serverConnection

func TryDecodeError

func TryDecodeError(e error) error

func TryDecodeErrorString

func TryDecodeErrorString(s string) error

Types

type ACIDSpecifier added in v0.12.0

type ACIDSpecifier struct {
	ControllerToken string
	ACID            sim.ACID
}

type AcceptHandoffArgs

type AcceptHandoffArgs ACIDSpecifier

type ActivateFlightPlanArgs added in v0.12.0

type ActivateFlightPlanArgs struct {
	ControllerToken     string
	TrackCallsign       av.ADSBCallsign
	FpACID              sim.ACID
	FlightPlanSpecifier *sim.STARSFlightPlanSpecifier
}

type ActiveSim

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

func (*ActiveSim) AddHumanController

func (as *ActiveSim) AddHumanController(tcp, token string) *HumanController

type AircraftCommandsArgs

type AircraftCommandsArgs struct {
	ControllerToken string
	Callsign        av.ADSBCallsign
	Commands        string
}

type AircraftCommandsResult

type AircraftCommandsResult struct {
	ErrorMessage   string
	RemainingInput string
}

If an RPC call returns an error, then the result argument is not returned(!?). So we don't use the error type for syntax errors...

type AircraftSpecifier

type AircraftSpecifier struct {
	ControllerToken string
	Callsign        av.ADSBCallsign
}

type AssociateFlightPlanArgs added in v0.12.0

type AssociateFlightPlanArgs struct {
	ControllerToken     string
	Callsign            av.ADSBCallsign
	FlightPlanSpecifier sim.STARSFlightPlanSpecifier
}

type CancelHandoffArgs

type CancelHandoffArgs ACIDSpecifier

type ChangeControlPositionArgs

type ChangeControlPositionArgs struct {
	ControllerToken string
	TCP             string
	KeepTracks      bool
}

type Configuration

type Configuration struct {
	ScenarioConfigs  map[string]*SimScenarioConfiguration
	ControlPositions map[string]*av.Controller
	DefaultScenario  string
}

type ConnectResult

type ConnectResult struct {
	Configurations map[string]map[string]*Configuration
	RunningSims    map[string]*RemoteSim
}

type Connection

type Connection struct {
	SimState sim.State
	SimProxy *proxy
}

type ConnectionManager

type ConnectionManager struct {
	LocalServer  *Server
	RemoteServer *Server
	// contains filtered or unexported fields
}

func MakeServerConnection

func MakeServerConnection(address, additionalScenario, additionalVideoMap string, e *util.ErrorLogger, lg *log.Logger,
	onNewClient func(*ControlClient), onError func(error)) (*ConnectionManager, error)

func (*ConnectionManager) ClientIsLocal

func (cm *ConnectionManager) ClientIsLocal() bool

func (*ConnectionManager) Connected

func (cm *ConnectionManager) Connected() bool

func (*ConnectionManager) ConnectionStartTime

func (cm *ConnectionManager) ConnectionStartTime() time.Time

func (*ConnectionManager) CreateNewSim

func (cm *ConnectionManager) CreateNewSim(config NewSimConfiguration, srv *Server) error

func (*ConnectionManager) Disconnect

func (cm *ConnectionManager) Disconnect()

func (*ConnectionManager) LoadLocalSim

func (cm *ConnectionManager) LoadLocalSim(s *sim.Sim, lg *log.Logger) (*ControlClient, error)

func (*ConnectionManager) NewConnection

func (cm *ConnectionManager) NewConnection(state sim.State, controllerToken string, client *RPCClient)

func (*ConnectionManager) Update

func (cm *ConnectionManager) Update(es *sim.EventStream, lg *log.Logger)

func (*ConnectionManager) UpdateRemoteSims

func (cm *ConnectionManager) UpdateRemoteSims() error

type ControlClient

type ControlClient struct {
	SessionStats SessionStats

	// This is all read-only data that we expect other parts of the system
	// to access directly.
	State sim.State
	// contains filtered or unexported fields
}

func NewControlClient

func NewControlClient(ss sim.State, local bool, controllerToken string, client *RPCClient, lg *log.Logger) *ControlClient

func (*ControlClient) AcceptHandoff

func (c *ControlClient) AcceptHandoff(acid sim.ACID, callback func(error))

func (*ControlClient) AcceptRedirectedHandoff

func (c *ControlClient) AcceptRedirectedHandoff(acid sim.ACID, callback func(error))

func (*ControlClient) AcknowledgePointOut

func (c *ControlClient) AcknowledgePointOut(acid sim.ACID, callback func(error))

func (*ControlClient) ActivateFlightPlan added in v0.12.0

func (c *ControlClient) ActivateFlightPlan(callsign av.ADSBCallsign, fpACID sim.ACID, spec *sim.STARSFlightPlanSpecifier,
	callback func(error))

func (*ControlClient) AssociateFlightPlan added in v0.12.0

func (c *ControlClient) AssociateFlightPlan(callsign av.ADSBCallsign, spec sim.STARSFlightPlanSpecifier, callback func(error))

func (*ControlClient) CancelHandoff

func (c *ControlClient) CancelHandoff(acid sim.ACID, callback func(error))

func (*ControlClient) ChangeControlPosition

func (c *ControlClient) ChangeControlPosition(tcp string, keepTracks bool) error

func (*ControlClient) Connected

func (c *ControlClient) Connected() bool

func (*ControlClient) ControllerAirspace

func (c *ControlClient) ControllerAirspace(id string) []av.ControllerAirspaceVolume

func (*ControlClient) CreateArrival

func (c *ControlClient) CreateArrival(group, airport string, ac *sim.Aircraft, callback func(error))

func (*ControlClient) CreateDeparture

func (c *ControlClient) CreateDeparture(airport, runway, category string, rules av.FlightRules, ac *sim.Aircraft,
	callback func(error))

func (*ControlClient) CreateFlightPlan added in v0.12.0

func (c *ControlClient) CreateFlightPlan(spec sim.STARSFlightPlanSpecifier, callback func(error))

func (*ControlClient) CreateOverflight

func (c *ControlClient) CreateOverflight(group string, ac *sim.Aircraft, callback func(error))

func (*ControlClient) CreateRestrictionArea

func (c *ControlClient) CreateRestrictionArea(ra av.RestrictionArea, callback func(int, error))

Note that the success callback is passed an integer, giving the index of the newly-created restriction area.

func (*ControlClient) CurrentTime

func (c *ControlClient) CurrentTime() time.Time

CurrentTime returns an extrapolated value that models the current Sim's time. (Because the Sim may be running remotely, we have to make some approximations, though they shouldn't cause much trouble since we get an update from the Sim at least once a second...)

func (*ControlClient) DeleteAircraft added in v0.12.0

func (c *ControlClient) DeleteAircraft(aircraft []sim.Aircraft, callback func(err error))

func (*ControlClient) DeleteAllAircraft

func (c *ControlClient) DeleteAllAircraft(callback func(err error))

func (*ControlClient) DeleteFlightPlan added in v0.12.0

func (c *ControlClient) DeleteFlightPlan(acid sim.ACID, callback func(error))

func (*ControlClient) DeleteRestrictionArea

func (c *ControlClient) DeleteRestrictionArea(idx int, callback func(error))

func (*ControlClient) Disconnect

func (c *ControlClient) Disconnect()

func (*ControlClient) FastForward added in v0.12.0

func (c *ControlClient) FastForward()

func (*ControlClient) ForceQL

func (c *ControlClient) ForceQL(acid sim.ACID, controller string, callback func(error))

func (*ControlClient) GetAircraftDisplayState added in v0.12.0

func (c *ControlClient) GetAircraftDisplayState(callsign av.ADSBCallsign) (sim.AircraftDisplayState, error)

func (*ControlClient) GetSerializeSim

func (c *ControlClient) GetSerializeSim() (*sim.Sim, error)

func (*ControlClient) GetSimRate

func (c *ControlClient) GetSimRate() float32

func (*ControlClient) GetUpdates

func (c *ControlClient) GetUpdates(eventStream *sim.EventStream, onErr func(error))

func (*ControlClient) GetVideoMapLibrary

func (c *ControlClient) GetVideoMapLibrary(filename string) (*sim.VideoMapLibrary, error)

func (*ControlClient) HandoffTrack

func (c *ControlClient) HandoffTrack(acid sim.ACID, controller string, callback func(error))

func (*ControlClient) LaunchArrivalOverflight

func (c *ControlClient) LaunchArrivalOverflight(ac sim.Aircraft)

func (*ControlClient) LaunchDeparture

func (c *ControlClient) LaunchDeparture(ac sim.Aircraft, rwy string)

func (*ControlClient) ModifyFlightPlan added in v0.12.0

func (c *ControlClient) ModifyFlightPlan(acid sim.ACID, spec sim.STARSFlightPlanSpecifier, callback func(error))

func (*ControlClient) PointOut

func (c *ControlClient) PointOut(acid sim.ACID, controller string, callback func(error))

func (*ControlClient) RPCClient

func (c *ControlClient) RPCClient() *RPCClient

func (*ControlClient) RecallPointOut

func (c *ControlClient) RecallPointOut(acid sim.ACID, callback func(error))

func (*ControlClient) RedirectHandoff

func (c *ControlClient) RedirectHandoff(acid sim.ACID, tcp string, callback func(error))

func (*ControlClient) RejectPointOut

func (c *ControlClient) RejectPointOut(acid sim.ACID, callback func(error))

func (*ControlClient) ReleaseDeparture

func (c *ControlClient) ReleaseDeparture(callsign av.ADSBCallsign, callback func(error))

func (*ControlClient) RepositionTrack added in v0.12.0

func (c *ControlClient) RepositionTrack(acid sim.ACID, callsign av.ADSBCallsign, p math.Point2LL, callback func(error))

func (*ControlClient) RequestFlightFollowing added in v0.12.0

func (c *ControlClient) RequestFlightFollowing()

func (*ControlClient) RunAircraftCommands

func (c *ControlClient) RunAircraftCommands(callsign av.ADSBCallsign, cmds string, handleResult func(message string, remainingInput string))

func (*ControlClient) SendGlobalMessage

func (c *ControlClient) SendGlobalMessage(global sim.GlobalMessage)

func (*ControlClient) SetLaunchConfig

func (c *ControlClient) SetLaunchConfig(lc sim.LaunchConfig)

func (*ControlClient) SetSimRate

func (c *ControlClient) SetSimRate(r float32)

func (*ControlClient) Status

func (c *ControlClient) Status() string

func (*ControlClient) StringIsSPC

func (c *ControlClient) StringIsSPC(s string) bool

func (*ControlClient) TakeOrReturnLaunchControl

func (c *ControlClient) TakeOrReturnLaunchControl(eventStream *sim.EventStream)

func (*ControlClient) ToggleSimPause

func (c *ControlClient) ToggleSimPause()

func (*ControlClient) TowerListAirports

func (c *ControlClient) TowerListAirports() []string

func (*ControlClient) UpdateRestrictionArea

func (c *ControlClient) UpdateRestrictionArea(idx int, ra av.RestrictionArea, callback func(error))

type CreateArrivalArgs

type CreateArrivalArgs struct {
	ControllerToken string
	Group           string
	Airport         string
}

type CreateDepartureArgs

type CreateDepartureArgs struct {
	ControllerToken string
	Airport         string
	Runway          string
	Category        string
	Rules           av.FlightRules
}

type CreateFlightPlanArgs added in v0.12.0

type CreateFlightPlanArgs struct {
	ControllerToken     string
	FlightPlanSpecifier sim.STARSFlightPlanSpecifier
}

type CreateOverflightArgs

type CreateOverflightArgs struct {
	ControllerToken string
	Group           string
}

type CreateRestrictionAreaResultArgs added in v0.12.0

type CreateRestrictionAreaResultArgs struct {
	Index       int
	StateUpdate sim.StateUpdate
}

type DeleteAircraftArgs

type DeleteAircraftArgs AircraftSpecifier

type DeleteAircraftListArgs added in v0.12.0

type DeleteAircraftListArgs struct {
	ControllerToken string
	Aircraft        []sim.Aircraft
}

type DeleteFlightPlanArgs added in v0.12.0

type DeleteFlightPlanArgs ACIDSpecifier

type Dispatcher

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

func (*Dispatcher) AcceptHandoff

func (sd *Dispatcher) AcceptHandoff(ah *AcceptHandoffArgs, update *sim.StateUpdate) error

func (*Dispatcher) AcceptRedirectedHandoff

func (sd *Dispatcher) AcceptRedirectedHandoff(po *AcceptHandoffArgs, update *sim.StateUpdate) error

func (*Dispatcher) AcknowledgePointOut

func (sd *Dispatcher) AcknowledgePointOut(po *PointOutArgs, update *sim.StateUpdate) error

func (*Dispatcher) ActivateFlightPlan added in v0.12.0

func (sd *Dispatcher) ActivateFlightPlan(af *ActivateFlightPlanArgs, update *sim.StateUpdate) error

func (*Dispatcher) AssociateFlightPlan added in v0.12.0

func (sd *Dispatcher) AssociateFlightPlan(it *AssociateFlightPlanArgs, update *sim.StateUpdate) error

func (*Dispatcher) CancelHandoff

func (sd *Dispatcher) CancelHandoff(ch *CancelHandoffArgs, update *sim.StateUpdate) error

func (*Dispatcher) ChangeControlPosition

func (sd *Dispatcher) ChangeControlPosition(cs *ChangeControlPositionArgs, _ *struct{}) error

func (*Dispatcher) CreateArrival

func (sd *Dispatcher) CreateArrival(aa *CreateArrivalArgs, arrAc *sim.Aircraft) error

func (*Dispatcher) CreateDeparture

func (sd *Dispatcher) CreateDeparture(da *CreateDepartureArgs, depAc *sim.Aircraft) error

func (*Dispatcher) CreateFlightPlan added in v0.12.0

func (sd *Dispatcher) CreateFlightPlan(cfp *CreateFlightPlanArgs, update *sim.StateUpdate) error

func (*Dispatcher) CreateOverflight

func (sd *Dispatcher) CreateOverflight(oa *CreateOverflightArgs, ofAc *sim.Aircraft) error

func (*Dispatcher) CreateRestrictionArea

func (sd *Dispatcher) CreateRestrictionArea(ra *RestrictionAreaArgs, result *CreateRestrictionAreaResultArgs) error

func (*Dispatcher) DeleteAircraft added in v0.12.0

func (sd *Dispatcher) DeleteAircraft(da *DeleteAircraftListArgs, update *sim.StateUpdate) error

func (*Dispatcher) DeleteAllAircraft

func (sd *Dispatcher) DeleteAllAircraft(da *DeleteAircraftArgs, update *sim.StateUpdate) error

func (*Dispatcher) DeleteFlightPlan added in v0.12.0

func (sd *Dispatcher) DeleteFlightPlan(dt *DeleteFlightPlanArgs, update *sim.StateUpdate) error

func (*Dispatcher) DeleteRestrictionArea

func (sd *Dispatcher) DeleteRestrictionArea(ra *RestrictionAreaArgs, update *sim.StateUpdate) error

func (*Dispatcher) FastForward added in v0.12.0

func (sd *Dispatcher) FastForward(token string, update *sim.StateUpdate) error

func (*Dispatcher) ForceQL

func (sd *Dispatcher) ForceQL(ql *ForceQLArgs, update *sim.StateUpdate) error

func (*Dispatcher) GetAircraftDisplayState added in v0.12.0

func (sd *Dispatcher) GetAircraftDisplayState(as *AircraftSpecifier, state *sim.AircraftDisplayState) error

func (*Dispatcher) GetStateUpdate added in v0.12.0

func (sd *Dispatcher) GetStateUpdate(token string, update *sim.StateUpdate) error

func (*Dispatcher) GetVideoMapLibrary

func (sd *Dispatcher) GetVideoMapLibrary(vm *VideoMapsArgs, vmf *sim.VideoMapLibrary) error

func (*Dispatcher) GlobalMessage

func (sd *Dispatcher) GlobalMessage(gm *GlobalMessageArgs, _ *struct{}) error

func (*Dispatcher) HandoffTrack

func (sd *Dispatcher) HandoffTrack(h *HandoffArgs, update *sim.StateUpdate) error

func (*Dispatcher) LaunchAircraft

func (sd *Dispatcher) LaunchAircraft(ls *LaunchAircraftArgs, _ *struct{}) error

func (*Dispatcher) ModifyFlightPlan added in v0.12.0

func (sd *Dispatcher) ModifyFlightPlan(mfp *ModifyFlightPlanArgs, update *sim.StateUpdate) error

func (*Dispatcher) PointOut

func (sd *Dispatcher) PointOut(po *PointOutArgs, update *sim.StateUpdate) error

func (*Dispatcher) RecallPointOut

func (sd *Dispatcher) RecallPointOut(po *PointOutArgs, update *sim.StateUpdate) error

func (*Dispatcher) RedirectHandoff

func (sd *Dispatcher) RedirectHandoff(h *HandoffArgs, update *sim.StateUpdate) error

func (*Dispatcher) RejectPointOut

func (sd *Dispatcher) RejectPointOut(po *PointOutArgs, update *sim.StateUpdate) error

func (*Dispatcher) ReleaseDeparture

func (sd *Dispatcher) ReleaseDeparture(hd *HeldDepartureArgs, update *sim.StateUpdate) error

func (*Dispatcher) RepositionTrack added in v0.12.0

func (sd *Dispatcher) RepositionTrack(rt *RepositionTrackArgs, update *sim.StateUpdate) error

func (*Dispatcher) RequestFlightFollowing added in v0.12.0

func (sd *Dispatcher) RequestFlightFollowing(token string, _ *struct{}) error

func (*Dispatcher) RunAircraftCommands

func (sd *Dispatcher) RunAircraftCommands(cmds *AircraftCommandsArgs, result *AircraftCommandsResult) error

func (*Dispatcher) SetLaunchConfig

func (sd *Dispatcher) SetLaunchConfig(lc *SetLaunchConfigArgs, _ *struct{}) error

func (*Dispatcher) SetSimRate

func (sd *Dispatcher) SetSimRate(r *SetSimRateArgs, _ *struct{}) error

func (*Dispatcher) SignOff

func (sd *Dispatcher) SignOff(token string, _ *struct{}) error

func (*Dispatcher) TakeOrReturnLaunchControl

func (sd *Dispatcher) TakeOrReturnLaunchControl(token string, _ *struct{}) error

func (*Dispatcher) TogglePause

func (sd *Dispatcher) TogglePause(token string, _ *struct{}) error

func (*Dispatcher) UpdateRestrictionArea

func (sd *Dispatcher) UpdateRestrictionArea(ra *RestrictionAreaArgs, update *sim.StateUpdate) error

type ForceQLArgs

type ForceQLArgs struct {
	ControllerToken string
	ACID            sim.ACID
	Controller      string
}

type GlobalMessageArgs

type GlobalMessageArgs struct {
	ControllerToken string
	Message         string
}

type HandoffArgs

type HandoffArgs struct {
	ControllerToken string
	ACID            sim.ACID
	ToTCP           string
}

type HeldDepartureArgs

type HeldDepartureArgs AircraftSpecifier

type HumanController

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

type LaunchAircraftArgs

type LaunchAircraftArgs struct {
	ControllerToken string
	Aircraft        sim.Aircraft
	DepartureRunway string
}

type ModifyFlightPlanArgs added in v0.12.0

type ModifyFlightPlanArgs struct {
	ControllerToken     string
	FlightPlanSpecifier sim.STARSFlightPlanSpecifier
	ACID                sim.ACID
}

type NewSimConfiguration

type NewSimConfiguration struct {
	// FIXME: unify Password/RemoteSimPassword, SelectedRemoteSim / NewSimName, etc.
	NewSimType   int32
	NewSimName   string
	GroupName    string
	ScenarioName string

	SelectedRemoteSim         string
	SelectedRemoteSimPosition string

	Scenario *SimScenarioConfiguration

	TFRs []av.TFR

	TRACONName        string
	RequirePassword   bool
	Password          string // for create remote only
	RemoteSimPassword string // for join remote only

	LiveWeather bool

	InstructorAllowed bool
	Instructor        bool
}

func MakeNewSimConfiguration

func MakeNewSimConfiguration() NewSimConfiguration

type NewSimResult

type NewSimResult struct {
	SimState        *sim.State
	ControllerToken string
}

type PendingCall added in v0.12.0

type PendingCall struct {
	Call      *rpc.Call
	IssueTime time.Time
	Callback  func(*sim.EventStream, *sim.State, error)
}

func (*PendingCall) CheckFinished added in v0.12.0

func (p *PendingCall) CheckFinished(es *sim.EventStream, state *sim.State) bool

type PointOutArgs

type PointOutArgs struct {
	ControllerToken string
	ACID            sim.ACID
	Controller      string
}

type RPCClient added in v0.12.0

type RPCClient struct {
	*rpc.Client
}

func (*RPCClient) CallWithTimeout added in v0.12.0

func (c *RPCClient) CallWithTimeout(serviceMethod string, args any, reply any) error

type RemoteSim

type RemoteSim struct {
	GroupName          string
	ScenarioName       string
	PrimaryController  string
	RequirePassword    bool
	InstructorAllowed  bool
	AvailablePositions map[string]av.Controller
	CoveredPositions   map[string]av.Controller
}

type RepositionTrackArgs added in v0.12.0

type RepositionTrackArgs struct {
	ControllerToken string
	ACID            sim.ACID        // from
	Callsign        av.ADSBCallsign // to
	Position        math.Point2LL   // to
}

type RestrictionAreaArgs

type RestrictionAreaArgs struct {
	ControllerToken string
	Index           int
	RestrictionArea av.RestrictionArea
}

type Scenario

type Scenario struct {
	SoloController      string                   `json:"solo_controller"`
	SplitConfigurations av.SplitConfigurationSet `json:"multi_controllers"`
	DefaultSplit        string                   `json:"default_split"`
	Wind                av.Wind                  `json:"wind"`
	VirtualControllers  []string                 `json:"controllers"`

	// Map from inbound flow names to a map from airport name to default rate,
	// with "overflights" a special case to denote overflights
	InboundFlowDefaultRates map[string]map[string]int `json:"inbound_rates"`
	// Temporary backwards compatibility
	ArrivalGroupDefaultRates map[string]map[string]int `json:"arrivals"`

	Airspace map[string][]string `json:"airspace"`

	DepartureRunways []sim.DepartureRunway `json:"departure_runways,omitempty"`
	ArrivalRunways   []sim.ArrivalRunway   `json:"arrival_runways,omitempty"`

	Center       math.Point2LL `json:"-"`
	CenterString string        `json:"center"`
	Range        float32       `json:"range"`
	DefaultMaps  []string      `json:"default_maps"`
	VFRRateScale *float32      `json:"vfr_rate_scale"`
}

func (*Scenario) PostDeserialize

func (s *Scenario) PostDeserialize(sg *ScenarioGroup, e *util.ErrorLogger, manifest *sim.VideoMapManifest)

type ScenarioGroup

type ScenarioGroup struct {
	TRACON             string                     `json:"tracon"`
	Name               string                     `json:"name"`
	Airports           map[string]*av.Airport     `json:"airports"`
	Fixes              map[string]math.Point2LL   `json:"-"`
	FixesStrings       util.OrderedMap            `json:"fixes"`
	Scenarios          map[string]*Scenario       `json:"scenarios"`
	DefaultScenario    string                     `json:"default_scenario"`
	ControlPositions   map[string]*av.Controller  `json:"control_positions"`
	Airspace           av.Airspace                `json:"airspace"`
	InboundFlows       map[string]*av.InboundFlow `json:"inbound_flows"`
	VFRReportingPoints []av.VFRReportingPoint     `json:"vfr_reporting_points"`

	PrimaryAirport string `json:"primary_airport"`

	ReportingPointStrings []string            `json:"reporting_points"`
	ReportingPoints       []av.ReportingPoint // not in JSON

	NmPerLatitude           float32 // Always 60
	NmPerLongitude          float32 // Derived from Center
	MagneticVariation       float32
	MagneticAdjustment      float32                     `json:"magnetic_adjustment"`
	STARSFacilityAdaptation sim.STARSFacilityAdaptation `json:"stars_config"`
}

func (*ScenarioGroup) Locate

func (sg *ScenarioGroup) Locate(s string) (math.Point2LL, bool)

func (*ScenarioGroup) PostDeserialize

func (sg *ScenarioGroup) PostDeserialize(multiController bool, e *util.ErrorLogger, simConfigurations map[string]map[string]*Configuration,
	manifest *sim.VideoMapManifest)

func (*ScenarioGroup) Similar added in v0.11.10

func (sg *ScenarioGroup) Similar(fix string) []string

type Server

type Server struct {
	*RPCClient
	// contains filtered or unexported fields
}

func (*Server) Close

func (s *Server) Close() error

func (*Server) GetConfigs

func (s *Server) GetConfigs() map[string]map[string]*Configuration

func (*Server) GetRunningSims

func (s *Server) GetRunningSims() map[string]*RemoteSim

type SessionStats added in v0.12.0

type SessionStats struct {
	Departures    int
	Arrivals      int
	IntraFacility int
	Overflights   int

	SignOnTime time.Time
	// contains filtered or unexported fields
}

func (*SessionStats) Update added in v0.12.0

func (s *SessionStats) Update(ss *sim.State)

type SetLaunchConfigArgs

type SetLaunchConfigArgs struct {
	ControllerToken string
	Config          sim.LaunchConfig
}

type SetSimRateArgs

type SetSimRateArgs struct {
	ControllerToken string
	Rate            float32
}

type SimBroadcastMessage

type SimBroadcastMessage struct {
	Password string
	Message  string
}

type SimManager

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

func NewSimManager

func NewSimManager(scenarioGroups map[string]map[string]*ScenarioGroup,
	simConfigurations map[string]map[string]*Configuration, manifests map[string]*sim.VideoMapManifest,
	lg *log.Logger) *SimManager

func (*SimManager) Add

func (sm *SimManager) Add(as *ActiveSim, result *NewSimResult, prespawn bool) error

func (*SimManager) AddLocal

func (sm *SimManager) AddLocal(sim *sim.Sim, result *NewSimResult) error

func (*SimManager) Broadcast

func (sm *SimManager) Broadcast(m *SimBroadcastMessage, _ *struct{}) error

func (*SimManager) Connect

func (sm *SimManager) Connect(version int, result *ConnectResult) error

func (*SimManager) GetRunningSims

func (sm *SimManager) GetRunningSims(_ int, result *map[string]*RemoteSim) error

func (*SimManager) GetSerializeSim

func (sm *SimManager) GetSerializeSim(token string, s *sim.Sim) error

func (*SimManager) GetStateUpdate added in v0.12.0

func (sm *SimManager) GetStateUpdate(token string, update *sim.StateUpdate) error

func (*SimManager) LookupController

func (sm *SimManager) LookupController(token string) (*HumanController, *sim.Sim, bool)

func (*SimManager) New

func (sm *SimManager) New(config *NewSimConfiguration, result *NewSimResult) error

func (*SimManager) SignOff

func (sm *SimManager) SignOff(token string) error

func (*SimManager) SimShouldExit

func (sm *SimManager) SimShouldExit(sim *sim.Sim) bool

type SimScenarioConfiguration

type SimScenarioConfiguration struct {
	SelectedController  string
	SelectedSplit       string
	SplitConfigurations av.SplitConfigurationSet
	PrimaryAirport      string

	Wind         av.Wind
	LaunchConfig sim.LaunchConfig

	DepartureRunways []sim.DepartureRunway
	ArrivalRunways   []sim.ArrivalRunway
}

type VideoMapsArgs

type VideoMapsArgs struct {
	ControllerToken string
	Filename        string
}

Jump to

Keyboard shortcuts

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