Documentation ¶
Overview ¶
package types contains types used by the SRS clients.
Index ¶
Constants ¶
const ( // IFFControlModeCockpit corresponds to IFFControlMode.COCKPIT in SRS. IFFControlModeCockpit = 0 // IFFControlModeOverlay corresponds to IFFControlMode.OVERLAY in SRS. IFFControlModeOverlay = 1 // IFFControlModeDisabled corresponds to IFFControlMode.DISABLED in SRS. IFFControlModeDisabled = 2 )
const ( // IFFStatusOff corresponds to IFFStatus.OFF in SRS. IFFStatusOff = 0 // IFFStatusNormal corresponds to IFFStatus.NORMAL in SRS. IFFStatusNormal = 1 // IFFStatusIdent corresponds to IFFStatus.IDENT in SRS. IFFStatusIdent = 2 )
const ( // ModulationAM is Amplitude Modulation. ModulationAM = 0 // ModulationFM is Frequency Modulation. ModulationFM = 1 // ModulationIntercom is intercom (used for multi-crew). ModulationIntercom = 2 ModulationDisabled = 3 // ModulationIntercom is HAVE QUICK (https://en.wikipedia.org/wiki/Have_Quick, unused). ModulationHAVEQUICK = 4 // ModulationSATCOM is satellite voice channels (unused). ModulationSATCOM = 5 // ModulationMIDS is Multifunction Information Distribution System (datalink digital voice channels) // These are used by F/A-18C for VOC A and VOC B. ModulationMIDS = 6 // ModulationSINCGARS is Single Channel Ground and Airborne Radio System (https://en.wikipedia.org/wiki/SINCGARS, unused). ModulationSINCGARS = 7 )
const GUIDLength = 22
GUIDLength is the length of a GUID in bytes.
const IFFMicDisabled = -1
IFFMicDisabled is a special value used by the SRS client to indicate that the mic-triggered ident mode is disabled.
const IFFModeDisabled = -1
IFFModeDisabled is a special value used by the SRS client to indicate that a given transponder mode is disabled.
Variables ¶
This section is empty.
Functions ¶
func IsSpectator ¶
func IsSpectator(c coalitions.Coalition) bool
IsSpectator returns true if the given coalition is not red or blue. SRS considers any other coalition ID to be a spectator.
Types ¶
type Ambient ¶
Ambient is related to the ambient audio feature introduced in SRS 2.0.9.1. It is included for completeness but is otherwise unused in SkyEye.
func NewAmbient ¶
func NewAmbient() Ambient
NewAmbient returns a new Ambient with all fields set to reasonable defaults.
type ClientConfiguration ¶
type ClientConfiguration struct { // GUID corresponds to [ClientInfo.GUID]. GUID string // Address is the network address of the SRS server, including port. Address string // ConnectionTimeout is the connection timeout for connecting to the SRS server. ConnectionTimeout time.Duration // ClientName corresponds to [ClientInfo.Name]. ClientName string // ExternalAWACSModePassword is the password for External AWACS Mode ExternalAWACSModePassword string // Coalition corresponds to [ClientInfo.Coalition]. Coalition coalitions.Coalition // Radio is the [Radio] to listen and talk on. Radios []Radio // AllowRecording corresponds to [ClientInfo.AllowRecording]. AllowRecording bool // Mute is true if the client should not transmit. Mute bool }
ClientConfiguration is configuration used to construct the audio and data clients.
type ClientInfo ¶
type ClientInfo struct { // GUID a unique client ID. GUID GUID `json:"ClientGuid"` // Name is the name that will appear in the client list and in in-game transmissions Name string `json:"Name"` // Seat is the seat number for multicrew aircraft. For bots, set this to 0. Seat int `json:"Seat"` // Coalition is the side that the client will act on Coalition coalitions.Coalition `json:"Coalition"` // AllowRecording indicates consent to record audio server-side. For bots, this should usually be set to True. AllowRecording bool `json:"AllowRecord"` // RadioInfo contains the client's unit, radios, transponder and ambient audio settings. RadioInfo RadioInfo `json:"RadioInfo"` // Position is the unit's in-game location. This is omitted for external clients not bound to a unit. Position *Position `json:"LatLngPosition,omitempty"` }
ClientInfo is information about the client included in messages.
type GUID ¶
type GUID string
GUID is a unique identifier for an SRS network client. Each client generates a 22-byte GUID on startup. GUIDs are encoded in base57.
type IFFControlMode ¶
type IFFControlMode int
IFFControlMode is used by the SRS client as part of the configuration for how the player sets Transponder codes.
type IFFMode ¶
type IFFMode int
IFFMode is used by the SRS client to indicate the mode of the IFF system.
type IFFStatus ¶
type IFFStatus int
IFFStatus is used by the SRS client to indicate the output of the IFF system.
type Message ¶
type Message struct { // Version is the SRS client version. Version string `json:"Version"` // Client is used in messages that reference a single client. Client ClientInfo `json:"Client,omitempty"` // Clients is used in messages that reference multiple clients. Clients []ClientInfo `json:"Clients,omitempty"` // ServerSettings is a map of server settings and their values. It sometimes appears in Sync messages. ServerSettings map[string]string `json:"ServerSettings,omitempty"` // ExternalAWACSModePassword is the External AWACS Mode password, used in ExternalAWACSModePassword messages to authenticate a client as an AWACS. ExternalAWACSModePassword string `json:"ExternalAWACSModePassword,omitempty"` // Type is the type of the message. Type MessageType `json:"MsgType"` }
Message is the JSON schema of SRS protocol messages. The SRS data protocol sends these messages, one per line, in JSON format over the TCP connection. The order of fields in this type matches the order of fields in the official SRS client, just in case a different order were to trigger some obscure bug.
type MessageType ¶
type MessageType int
MessageType is an enum indicating the type of an SRS data protocol message.
const ( MessageUpdate MessageType = iota MessagePing MessageSync MessageRadioUpdate MessageServerSettings MessageClientDisconnect MessageVersionMismatch MessageExternalAWACSModePassword MessageExternalAWACSModeDisconnect )
type Modulation ¶
type Modulation byte
Modulation indicates the technology used to send a transmission.
type Position ¶
type Position struct { // Latitude is the north-south coordinate in decimal degrees. Latitude float64 `json:"lat"` // Longitude is the east-west coordinate in decimal degrees. Longitude float64 `json:"lng"` // Altitude is the height above sea level in meters. Altitude float64 `json:"alt"` }
Position is a 3D coordinate indicating the source position of a transmission.
type Radio ¶
type Radio struct { // Frequency is the transmission frequency in Hz. // Example: 249.500MHz is encoded as 249500000.0 Frequency float64 `json:"freq"` // Modulation is the transmission modulation mode. Modulation Modulation `json:"modulation"` // IsEncryption indicates if the transmission is encrypted. IsEncrypted bool `json:"enc"` // EncruptionKey is the encryption key used to encrypted transmissions. EncryptionKey byte `json:"encKey"` // GuardFrequency is a second frequency the client can receive. GuardFrequency float64 `json:"secFreq"` ShouldRetransmit bool `json:"retransmit"` }
Radio describes one of a client's radios.
func (Radio) IsSameFrequency ¶
IsSameFrequency is true if the other radio has the same frequency, modulation, and encryption settings as this radio.
type RadioInfo ¶
type RadioInfo struct { // Radios is the inventory of radios operated by the client Radios []Radio `json:"radios,omitempty"` // Unit is the name of the unit that the client is bound to. Unit string `json:"unit"` // UnitID is the in-game ID of the unit that the client is bound to. UnitID uint64 `json:"unitId"` // IFF contains the client's transponder settings IFF Transponder `json:"iff"` // Ambient contains the client's ambient audio settings Ambient Ambient `json:"ambient"` }
func (*RadioInfo) IsOnFrequency ¶
IsOnFrequency is true if the other client has a radio with the same frequency, modulation, and encryption settings as this client.
type ServerSetting ¶ added in v0.5.0
type ServerSetting string
const ( ServerPort ServerSetting = "SERVER_PORT" CoalitionAudioSecurity ServerSetting = "COALITION_AUDIO_SECURITY" SpectatorsAudioDisabled ServerSetting = "SPECTATORS_AUDIO_DISABLED" ClientExportEnabled ServerSetting = "CLIENT_EXPORT_ENABLED" LOSEnabled ServerSetting = "LOS_ENABLED" DistanceEnabled ServerSetting = "DISTANCE_ENABLED" IRLRadioTX ServerSetting = "IRL_RADIO_TX" IRLRadioRXInterference ServerSetting = "IRL_RADIO_RX_INTERFERENCE" IRLRadioStatic ServerSetting = "IRL_RADIO_STATIC" RadioExpansion ServerSetting = "RADIO_EXPANSION" ExternalAWACSMode ServerSetting = "EXTERNAL_AWACS_MODE" ExternalAWACSModeBluePassword ServerSetting = "EXTERNAL_AWACS_MODE_BLUE_PASSWORD" // #nosec G101 ExternalAWACSModeRedPassword ServerSetting = "EXTERNAL_AWACS_MODE_RED_PASSWORD" // #nosec G101 ClientExportFilePath ServerSetting = "CLIENT_EXPORT_FILE_PATH" CheckForBetaUpdates ServerSetting = "CHECK_FOR_BETA_UPDATES" AllowRadioEncryption ServerSetting = "ALLOW_RADIO_ENCRYPTION" TestFrequencies ServerSetting = "TEST_FREQUENCIES" ShowTunedCount ServerSetting = "SHOW_TUNED_COUNT" GlobalLobbyFrequencies ServerSetting = "GLOBAL_LOBBY_FREQUENCIES" ShowTransmitterName ServerSetting = "SHOW_TRANSMITTER_NAME" LotATCExportEnabled ServerSetting = "LOTATC_EXPORT_ENABLED" LotATCExportPort ServerSetting = "LOTATC_EXPORT_PORT" LotATCExportIP ServerSetting = "LOTATC_EXPORT_IP" UPnPEnabled ServerSetting = "UPNP_ENABLED" RetransmissionNodeLimit ServerSetting = "RETRANSMISSION_NODE_LIMIT" StrictRadioEncryption ServerSetting = "STRICT_RADIO_ENCRYPTION" TransmissionLogEnabled ServerSetting = "TRANSMISSION_LOG_ENABLED" TransmissionLogRetention ServerSetting = "TRANSMISSION_LOG_RETENTION" RadioEffectOverride ServerSetting = "RADIO_EFFECT_OVERRIDE" ServerIP ServerSetting = "SERVER_IP" )
type Transponder ¶
type Transponder struct { // ControlMode is the mode in which the player sets Transponder codes. ControlMode IFFControlMode `json:"control"` // Status is the Transponder output state. Status IFFStatus `json:"status"` // Mode1 is a two digit military IFF code. Mode1 IFFMode `json:"mode1"` // Mode 2 is a four digit military IFF code. Mode2 IFFMode `json:"mode2"` // Mode 3 is a four digit military/civilian transponder code, also known as Mode A or Mode 3/A. This is the code that ATC uses to identify aircraft on radar. Mode3 IFFMode `json:"mode3"` // Mode 4 is an encrypted military IFF code. In SRS, it's a simple on/off state. Mode4 bool `json:"mode4"` // Mic is used by some aircraft that can auto-ident while the Mic switch is pressed. Mic int `json:"mic"` }
Transponder represents an aircraft's transponder.
func NewIFF ¶
func NewIFF() Transponder
NewIFF returns a new Transponder with all fields set to reasonable defaults.