SmpTransport

class SmpTransport(peripheral: Peripheral, commandTimeout: Duration) : DfuTransport

SMP (Simple Management Protocol) transport for MCUboot DFU.

SMP uses a single characteristic for both request and response. Responses may be fragmented across multiple BLE notifications when the payload exceeds the MTU. This transport reassembles fragmented responses based on the SMP header length field before returning to the caller.

Constructors

Link copied to clipboard
constructor(peripheral: Peripheral, commandTimeout: Duration)

Properties

Link copied to clipboard
open override val mtu: Int

Maximum payload size per write, in bytes.

Link copied to clipboard
open override val notifications: Flow<ByteArray>

Incoming notifications from the DFU Control Point characteristic.

Functions

Link copied to clipboard
open override fun close()

Release transport resources synchronously.

Link copied to clipboard
open suspend override fun sendCommand(data: ByteArray): ByteArray

Write a command to the DFU Control Point and wait for the response notification.

Link copied to clipboard

Send a command where the device is expected to disconnect or reboot before responding (e.g. reset commands).

Link copied to clipboard
open suspend override fun sendData(data: ByteArray)

Write firmware data to the peripheral.