class ScanFilter


Criteria for filtering result from Bluetooth LE scans. A ScanFilter allows clients to restrict scan results to only those that are of interest to them.

Summary

Constants

const Int

Public constructors

ScanFilter(
    deviceAddress: BluetoothAddress?,
    deviceName: String?,
    manufacturerId: Int,
    manufacturerData: ByteArray?,
    manufacturerDataMask: ByteArray?,
    serviceDataUuid: UUID?,
    serviceData: ByteArray?,
    serviceDataMask: ByteArray?,
    serviceUuid: UUID?,
    serviceUuidMask: UUID?,
    serviceSolicitationUuid: UUID?,
    serviceSolicitationUuidMask: UUID?
)

Public properties

BluetoothAddress?

The scan filter for the remote device address.

String?

The scan filter for the remote device name.

ByteArray?

The scan filter for manufacturer data.

ByteArray?

The partial filter on manufacturerData.

Int

The scan filter for manufacturer id.

ByteArray?

The scan filter for service data.

ByteArray?

The partial filter on service data.

UUID?

The scan filter for service data uuid.

UUID?

The scan filter for service Solicitation uuid.

UUID?

The partial filter on service Solicitation uuid.

UUID?

The scan filter for service uuid.

UUID?

The partial filter on service uuid.

Constants

MANUFACTURER_FILTER_NONE

const val MANUFACTURER_FILTER_NONEInt

Public constructors

ScanFilter

Added in 1.0.0-alpha02
ScanFilter(
    deviceAddress: BluetoothAddress? = null,
    deviceName: String? = null,
    manufacturerId: Int = MANUFACTURER_FILTER_NONE,
    manufacturerData: ByteArray? = null,
    manufacturerDataMask: ByteArray? = null,
    serviceDataUuid: UUID? = null,
    serviceData: ByteArray? = null,
    serviceDataMask: ByteArray? = null,
    serviceUuid: UUID? = null,
    serviceUuidMask: UUID? = null,
    serviceSolicitationUuid: UUID? = null,
    serviceSolicitationUuidMask: UUID? = null
)

Public properties

deviceAddress

Added in 1.0.0-alpha02
val deviceAddressBluetoothAddress?

The scan filter for the remote device address. null if filter is not set.

deviceName

Added in 1.0.0-alpha02
val deviceNameString?

The scan filter for the remote device name. null if filter is not set.

manufacturerData

Added in 1.0.0-alpha02
val manufacturerDataByteArray?

The scan filter for manufacturer data. null if filter is not set.

manufacturerDataMask

Added in 1.0.0-alpha02
val manufacturerDataMaskByteArray?

The partial filter on manufacturerData. null if filter is not set.

manufacturerId

Added in 1.0.0-alpha02
val manufacturerIdInt

The scan filter for manufacturer id. MANUFACTURER_FILTER_NONE if filter is not set.

serviceData

Added in 1.0.0-alpha02
val serviceDataByteArray?

The scan filter for service data. null if filter is not set.

serviceDataMask

Added in 1.0.0-alpha02
val serviceDataMaskByteArray?

The partial filter on service data. null if filter is not set.

serviceDataUuid

Added in 1.0.0-alpha02
val serviceDataUuidUUID?

The scan filter for service data uuid. null if filter is not set.

serviceSolicitationUuid

Added in 1.0.0-alpha02
val serviceSolicitationUuidUUID?

The scan filter for service Solicitation uuid. null if filter is not set.

Please note that this will be ignored on versions before android.os.Build.VERSION_CODES.Q.

serviceSolicitationUuidMask

Added in 1.0.0-alpha02
val serviceSolicitationUuidMaskUUID?

The partial filter on service Solicitation uuid. This bit mask is for serviceSolicitationUuid. Set any bit in the mask to 1 to indicate a match is needed for the bit in serviceSolicitationUuid, and 0 to ignore that bit. null if filter is not set.

Throws
kotlin.IllegalArgumentException

if this bit mask serviceSolicitationUuidMask is set but serviceSolicitationUuid is null

Please note that this will be ignored on versions before android.os.Build.VERSION_CODES.Q.

serviceUuid

Added in 1.0.0-alpha02
val serviceUuidUUID?

The scan filter for service uuid. null if filter is not set.

serviceUuidMask

Added in 1.0.0-alpha02
val serviceUuidMaskUUID?

The partial filter on service uuid. null if filter is not set.

Throws
kotlin.IllegalArgumentException

if this bit mask serviceUuidMask is set but serviceUuid is null