DisplayMirrorViewModel

class DisplayMirrorViewModel(displayMirrorManager: DisplayMirrorManager, connectionStateProvider: ConnectionStateProvider, nodeRepository: NodeRepository, adminController: AdminController, radioConfigRepository: RadioConfigRepository) : ViewModel(source)

Constructors

Link copied to clipboard
constructor(displayMirrorManager: DisplayMirrorManager, connectionStateProvider: ConnectionStateProvider, nodeRepository: NodeRepository, adminController: AdminController, radioConfigRepository: RadioConfigRepository)

Properties

Link copied to clipboard
val connected: StateFlow<Boolean>
Link copied to clipboard
val displayInfo: StateFlow<DisplayInfo?>

Panel description from the connect handshake; null on display-less nodes and pre-DisplayInfo firmware.

Link copied to clipboard
val frame: StateFlow<MirrorFrame?>
Link copied to clipboard
val managed: StateFlow<Boolean>

Managed mode locks the device out of configuration, and the mirror is not a read-only view: arming it is an admin write and the controls inject input. The Debug Panel route it lives on is deliberately exempt from the gate every other settings route carries, so the restriction has to be enforced here.

Link copied to clipboard
val mirroring: StateFlow<Boolean>
Link copied to clipboard
val palette: StateFlow<MirrorPalette?>
Link copied to clipboard
val supported: StateFlow<Boolean>

Only firmware that can stream the display reports one in its metadata, so a missing displayInfo means arming the mirror or asking for a frame would go unanswered. Input events predate mirroring and stay allowed.

Functions

Link copied to clipboard
expect open fun addCloseable(closeable: AutoCloseable)
expect fun addCloseable(key: String, closeable: AutoCloseable)
Link copied to clipboard
expect fun <T : AutoCloseable> getCloseable(key: String): T?
Link copied to clipboard
Link copied to clipboard
fun sendChar(codePoint: Int)

Forwards a typed character; the device UI receives it as a key press rather than a navigation event.

Link copied to clipboard
fun sendKey(eventCode: Int)
Link copied to clipboard
fun sendTouch(eventCode: Int, x: Int, y: Int)

Forwards a tap/long-press on the mirrored image as a device touch event with panel coordinates.

Link copied to clipboard
fun setMirror(enabled: Boolean)
Link copied to clipboard

Stops a live stream when the mirror UI goes away; safe to call redundantly.