LabelPrintViewModel

Finds a Niimbot printer, reconnects to the one used last as soon as it is seen, and prints. The printer has its own Bluetooth connection, so the radio's is not involved.

Constructors

Link copied to clipboard
constructor(printerFactory: NiimbotPrinterFactory, prefs: LabelPrintPrefs)

Properties

Link copied to clipboard
val labelLengthMm: StateFlow<Int>
Link copied to clipboard
val state: StateFlow<LabelPrintState>

Functions

Link copied to clipboard
expect open fun addCloseable(closeable: AutoCloseable)
expect fun addCloseable(key: String, closeable: AutoCloseable)
Link copied to clipboard
fun connect(device: BleDevice)

Connects to the printer the user picked.

Link copied to clipboard
expect fun <T : AutoCloseable> getCloseable(key: String): T?
Link copied to clipboard
fun print(bitmap: LabelBitmap)
Link copied to clipboard
fun setLabelLengthMm(millimeters: Int)
Link copied to clipboard
fun start()

Starts looking for printers, unless one is already being looked for or in use.

Link copied to clipboard
fun stop()

Ends the search, any connect or print in flight, and the connection; called when the sheet closes.