updateFirmware

fun updateFirmware(firmware: ByteArray): Flow<OtaProgress>

Flash firmware onto the device (vendor OTA service; see OtaControl for the wire contract). Cold flow: collection performs the update and reports OtaProgress; the terminal emission is OtaProgress.Done, after which the device applies the image and typically reboots — expect the session to go DeviceState.Disconnected. The device boots into its power-off state and advertises again only after a long press of its power button, so a host waiting for it to reappear must ask the user for that press. On any failure (NAK, timeout, link drop) the device keeps its previous firmware.

OtaProgress.Done means the device accepted the image. After reconnecting, info's firmware version is the version the device runs.

Requires DeviceState.Ready (never mid-stream) and the firmware-update service (BrainAccessError.OtaNotSupported otherwise).