public final 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

static final int

Public constructors

ScanFilter(
    BluetoothAddress deviceAddress,
    String deviceName,
    int manufacturerId,
    byte[] manufacturerData,
    byte[] manufacturerDataMask,
    UUID serviceDataUuid,
    byte[] serviceData,
    byte[] serviceDataMask,
    UUID serviceUuid,
    UUID serviceUuidMask,
    UUID serviceSolicitationUuid,
    UUID serviceSolicitationUuidMask
)

Public methods

final BluetoothAddress

The scan filter for the remote device address.

final String

The scan filter for the remote device name.

final byte[]

The scan filter for manufacturer data.

final byte[]

The partial filter on manufacturerData.

final int

The scan filter for manufacturer id.

final byte[]

The scan filter for service data.

final byte[]

The partial filter on service data.

final UUID

The scan filter for service data uuid.

final UUID

The scan filter for service Solicitation uuid.

final UUID

The partial filter on service Solicitation uuid.

final UUID

The scan filter for service uuid.

final UUID

The partial filter on service uuid.

Constants

MANUFACTURER_FILTER_NONE

public static final int MANUFACTURER_FILTER_NONE

Public constructors

ScanFilter

Added in 1.0.0-alpha02
public ScanFilter(
    BluetoothAddress deviceAddress,
    String deviceName,
    int manufacturerId,
    byte[] manufacturerData,
    byte[] manufacturerDataMask,
    UUID serviceDataUuid,
    byte[] serviceData,
    byte[] serviceDataMask,
    UUID serviceUuid,
    UUID serviceUuidMask,
    UUID serviceSolicitationUuid,
    UUID serviceSolicitationUuidMask
)

Public methods

getDeviceAddress

Added in 1.0.0-alpha02
public final BluetoothAddress getDeviceAddress()

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

getDeviceName

Added in 1.0.0-alpha02
public final String getDeviceName()

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

getManufacturerData

Added in 1.0.0-alpha02
public final byte[] getManufacturerData()

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

getManufacturerDataMask

Added in 1.0.0-alpha02
public final byte[] getManufacturerDataMask()

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

getManufacturerId

Added in 1.0.0-alpha02
public final int getManufacturerId()

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

getServiceData

Added in 1.0.0-alpha02
public final byte[] getServiceData()

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

getServiceDataMask

Added in 1.0.0-alpha02
public final byte[] getServiceDataMask()

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

getServiceDataUuid

Added in 1.0.0-alpha02
public final UUID getServiceDataUuid()

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

getServiceSolicitationUuid

Added in 1.0.0-alpha02
public final UUID getServiceSolicitationUuid()

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.

getServiceSolicitationUuidMask

Added in 1.0.0-alpha02
public final UUID getServiceSolicitationUuidMask()

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.

getServiceUuid

Added in 1.0.0-alpha02
public final UUID getServiceUuid()

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

getServiceUuidMask

Added in 1.0.0-alpha02
public final UUID getServiceUuidMask()

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