DeviceModelViewModel

class DeviceModelViewModel(repository: DeviceModelRepository, displayMirrorManager: DisplayMirrorManager, adminController: AdminController, nodeRepository: NodeRepository, radioConfigRepository: RadioConfigRepository, dispatchers: CoroutineDispatchers) : ViewModel(source)

Fetches a device's GLB and the bounds the viewer frames it with; one model at a time, the last request wins.

Constructors

Link copied to clipboard
constructor(repository: DeviceModelRepository, displayMirrorManager: DisplayMirrorManager, adminController: AdminController, nodeRepository: NodeRepository, radioConfigRepository: RadioConfigRepository, dispatchers: CoroutineDispatchers)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val banana: StateFlow<ByteArray?>

The banana's own model, loaded the first time it is shown, for AR to place on its own.

Link copied to clipboard
val screenFrame: StateFlow<MirrorFrame?>

The connected device's live screen while setMirror has it armed.

Link copied to clipboard
val state: StateFlow<DeviceModelState>
Link copied to clipboard
val supported: StateFlow<Boolean>

Only firmware that can stream the display reports one in its metadata, so without it arming the mirror would go unanswered and the model's screen would stay blank.

Link copied to clipboard

The model with the banana standing beside it while setBanana has it on; null while off or still building.

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
fun load(imageFile: String)
Link copied to clipboard

The renderer rejected a model the parser accepted: show the illustration instead.

Link copied to clipboard
fun setBanana(shown: Boolean)

Stands the bundled banana beside whichever model is shown, now and for the ones after it, or takes it away.

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

Swaps in Chirpy, the mascot, bundled with the app: the viewer's easter egg.