BluetoothDeviceFilter.Builder

public static final class BluetoothDeviceFilter.Builder
extends Object

java.lang.Object
   ↳ android.companion.BluetoothDeviceFilter.Builder


A builder for BluetoothDeviceFilter

Summary

Public constructors

BluetoothDeviceFilter.Builder()

Public methods

BluetoothDeviceFilter.Builder addServiceUuid(ParcelUuid serviceUuid, ParcelUuid serviceUuidMask)

Add filtering by certain bits of BluetoothDevice.getUuids() A device with any uuid matching the given bits is considered passing

BluetoothDeviceFilter build()

Builds the instance Once this method is called, this builder should no longer be used.

BluetoothDeviceFilter.Builder setAddress(String address)
BluetoothDeviceFilter.Builder setNamePattern(Pattern regex)

Protected methods

void checkNotUsed()
void markUsed()

Inherited methods

Public constructors

BluetoothDeviceFilter.Builder

added in API level 26
public BluetoothDeviceFilter.Builder ()

Public methods

addServiceUuid

added in API level 26
public BluetoothDeviceFilter.Builder addServiceUuid (ParcelUuid serviceUuid, 
                ParcelUuid serviceUuidMask)

Add filtering by certain bits of BluetoothDevice.getUuids() A device with any uuid matching the given bits is considered passing

Parameters
serviceUuid ParcelUuid: the values for the bits to match

This value may be null.

serviceUuidMask ParcelUuid: if provided, only those bits would have to match.

This value may be null.

Returns
BluetoothDeviceFilter.Builder

This value will never be null.

build

added in API level 26
public BluetoothDeviceFilter build ()

Builds the instance Once this method is called, this builder should no longer be used. Any subsequent calls to a setter or build() will throw an exception

Returns
BluetoothDeviceFilter

This value will never be null.

setAddress

added in API level 26
public BluetoothDeviceFilter.Builder setAddress (String address)

Parameters
address String: if set, only devices with MAC address exactly matching the given one will pass the filter

This value may be null.

Returns
BluetoothDeviceFilter.Builder

This value will never be null.

setNamePattern

added in API level 26
public BluetoothDeviceFilter.Builder setNamePattern (Pattern regex)

Parameters
regex Pattern: if set, only devices with name matching the given regular expression will be shown

This value may be null.

Returns
BluetoothDeviceFilter.Builder

Protected methods

checkNotUsed

protected void checkNotUsed ()

markUsed

protected void markUsed ()