ManufacturerData

class ManufacturerData(val id: Int, val data: ByteArray, val dataMask: ByteArray? = null) : Filter

Provides support for filtering against advertisement manufacturer data.

If only portions of the manufacturer data needs to match, then dataMask can be used to identify the relevant bits.

Some examples to demonstrate the dataMask functionality:

dataMask valueBit representationdata only needs to match...
byteArrayOf(0x0F, 0x00)0000 1111 0000 0000bits 0-3 of the first byte of advertisement manufacturer data.
byteArrayOf(0x00, 0xFF)0000 0000 1111 1111the 2nd byte of advertisement manufacturer data.
byteArrayOf(0xF0)1111 0000bits 4-7 of the first byte of advertisement manufacturer data.
PlatformSupportedDetails
AndroidYesSupported natively
AppleYesSupport provided by Kable via flow filter
JavaScriptYesSupported natively

JavaScript support was added in Chrome 92 according to: https://developer.chrome.com/articles/bluetooth/#manufacturer-data-filter

Constructors

Link copied to clipboard
constructor(id: ByteArray, data: ByteArray, dataMask: ByteArray? = null)
constructor(id: Int, data: ByteArray, dataMask: ByteArray? = null)

Properties

Link copied to clipboard
Link copied to clipboard
val dataMask: ByteArray? = null

For any bit in the mask, set it to 1 if advertisement manufacturer data needs to match the corresponding bit in data, otherwise set it to 0. If dataMask is not null, then it must have the same length as data.

Link copied to clipboard
val id: Int

Company identifier (16-bit). A negative id is considered an invalid id.