FlightProjector

Streams the FateWeaver log to connected AdvantageScope clients over a WebSocket.

The bytes are the same ones a .fate file would contain, so AdvantageScope decodes a live stream with its file decoder. A client that connects partway through an OpMode first receives the header and every schema entry declared so far, in order. Channel indices are positional, and a message entry means nothing without its schema entry.

See also

Properties

Link copied to clipboard

How many AdvantageScope clients are currently attached.

Link copied to clipboard
const val DEFAULT_PORT: Int = 8110

The port start binds, chosen to avoid 8080 (FTC web server) and 8000 (FTC Dashboard).

Link copied to clipboard

Whether the server is bound and accepting clients.

Link copied to clipboard

Changing this while the server is running has no effect until the next start.

Link copied to clipboard

The text frame a client sends to have the header and schema entries replayed.

Functions

Link copied to clipboard
open override fun close()

Does nothing. The projector outlives any one gay.zharel.fateweaver.log.FateLogWriter, so closing an OpMode's writer must not stop the server or drop clients.

Link copied to clipboard
open override fun flush()
Link copied to clipboard
open override fun header(bytes: ByteArray)
Link copied to clipboard
open override fun messageEntry(bytes: ByteArray)
Link copied to clipboard

Releases the port when the Robot Controller app goes away.

Link copied to clipboard
@OpModeRegistrar
fun registerToggleOpMode(manager: OpModeManager)

Registers an OpMode that toggles live streaming from the Driver Station.

Link copied to clipboard
open override fun schemaEntry(bytes: ByteArray)
Link copied to clipboard

Turns live streaming on or off and saves the choice across robot restarts.

Link copied to clipboard

Binds port and begins accepting clients, unless LiveSettings.enabled is false.

Link copied to clipboard

Closes the server, unbinds the port and disconnects every client.