WifiOtaTransport

class WifiOtaTransport(deviceIpAddress: String, port: Int = DEFAULT_PORT) : UnifiedOtaProtocol(source)

WiFi/TCP transport implementation for ESP32 Unified OTA protocol.

Uses Ktor raw sockets for KMP-compatible TCP communication. UDP discovery is not included in this common implementation and should be handled by platform-specific code.

Unlike BLE, WiFi transport:

  • Uses synchronous TCP (no manual ACK waiting)

  • Supports larger chunk sizes (up to 1024 bytes)

  • Generally faster transfer speeds

Constructors

Link copied to clipboard
constructor(deviceIpAddress: String, port: Int = DEFAULT_PORT)

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 via TCP using Ktor raw sockets.

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

Start OTA update process.

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

Stream firmware binary data to the device.