BleOtaTransport

class BleOtaTransport(scanner: BleScanner, connectionFactory: BleConnectionFactory, address: String, dispatcher: CoroutineDispatcher = Dispatchers.Default) : UnifiedOtaProtocol(source)

BLE transport implementation for ESP32 Unified OTA protocol.

Service UUID: 4FAFC201-1FB5-459E-8FCC-C5C9C331914B

  • OTA Characteristic (Write): 62ec0272-3ec5-11eb-b378-0242ac130005

  • TX Characteristic (Notify): 62ec0272-3ec5-11eb-b378-0242ac130003

Constructors

Link copied to clipboard
constructor(scanner: BleScanner, connectionFactory: BleConnectionFactory, address: String, dispatcher: CoroutineDispatcher = Dispatchers.Default)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open suspend override fun close()

Close the connection and cleanup resources.

Link copied to clipboard
open suspend override fun connect(): Result<Unit>

Connect to the device and discover OTA service.

Link copied to clipboard
open suspend override fun startOta(sizeBytes: Long, sha256Hash: String, onHandshakeStatus: suspend (OtaHandshakeStatus) -> Unit = {}): Result<Unit>

Initiates the OTA update by sending the size and hash.

Link copied to clipboard
open suspend override fun streamFirmware(data: ByteArray, chunkSize: Int, onProgress: suspend (Float) -> Unit): Result<Unit>

Streams the firmware data in chunks.