Logo FSBarV1_Archived

AdminChannel Module

Low-level client for the Spring/Recoil engine's autohost UDP interface (feature 039, see specs/039-hub-admin-channel/contracts/autohost-wire.md). Owns a single UdpClient bound on 127.0.0.1, encode/decode, and a receive pump on a dedicated thread. Intended to be consumed by FSBar.Hub.AdminChannelHost, which layers coalescing and hub-level status semantics on top.

Types

Type Description

AdminChannel

Live admin channel. One instance owns one UDP socket and one
 receive pump. Dispose to close the socket and stop the pump.

AdminCommandOut

Outbound hub → engine admin command. Action codes map to AutohostInterface.cpp in the engine source.

AdminEventIn

Inbound engine → hub admin event. Unknown codes are preserved so
 future engine revisions don't silently vanish from diagnostics.

ChannelState

Socket-level state of an AdminChannel. The hub-level AdminChannelStatus (in FSBar.Hub.AdminChannelHost) layers richer semantics on top.

Functions and values

Function or value Description

bind ()

Full Usage: bind ()

Parameters:
    () : unit

Returns: Result<AdminChannel, string>

Binds a fresh UDP socket on IPAddress.Loopback:0 and returns it in the Bound state. The caller writes the allocated port into springsettings.cfg (via ScriptGenerator.generateSpringSettings) and launches the engine; once the first datagram arrives the channel auto-transitions to ReceivingFrom.

() : unit
Returns: Result<AdminChannel, string>

decodeEvent bytes

Full Usage: decodeEvent bytes

Parameters:
    bytes : byte[] - The datagram payload (including the leading action code).

Returns: AdminEventIn

Decode an inbound UDP datagram from the engine into an AdminEventIn. Returns Unknown for any action code outside the handled set, preserving the raw payload.

bytes : byte[]

The datagram payload (including the leading action code).

Returns: AdminEventIn

encodeCommand cmd

Full Usage: encodeCommand cmd

Parameters:
Returns: byte[]

Backwards-compatible single-datagram encode; returns the first datagram of AdminChannel.encodeCommandToDatagrams.

cmd : AdminCommandOut
Returns: byte[]

encodeCommandToDatagrams cmd

Full Usage: encodeCommandToDatagrams cmd

Parameters:
Returns: byte[][]

Encode an outbound command to one or more UDP text datagrams. The engine treats inbound autohost datagrams as UTF-8 chat strings; strings prefixed with / are dispatched as slash actions. SetGameSpeed expands to two datagrams (/setminspeed + /setmaxspeed) to lock the engine's effective speed at the requested multiplier.

cmd : AdminCommandOut
Returns: byte[][]

Type something to start searching.