segment

fun segment(data: ByteArray, type: PduType, mtu: Int): List<ByteArray>

Segments the given data with given message type to 1+ messages where all but the last one are of the MTU size and the last one is MTU size or smaller. This method implements the Proxy Protocol from Bluetooth Mesh specification.

Return

Array of segmented messages.

Parameters

data

Data to be segmented.

type

Type of the message.

mtu

Maximum size of the message.