ScanFilter.Builder
public
static
final
class
ScanFilter.Builder
extends Object
Builder class for ScanFilter
.
Summary
Public methods |
ScanFilter
|
build()
Build ScanFilter .
|
ScanFilter.Builder
|
setAdvertisingDataType(int advertisingDataType)
Set filter on advertising data with specific advertising data type.
|
ScanFilter.Builder
|
setAdvertisingDataTypeWithData(int advertisingDataType, byte[] advertisingData, byte[] advertisingDataMask)
Set filter on advertising data with specific advertising data type.
|
ScanFilter.Builder
|
setDeviceAddress(String deviceAddress)
Set a scan filter on the remote device address.
|
ScanFilter.Builder
|
setDeviceName(String deviceName)
Set filter on device name.
|
ScanFilter.Builder
|
setManufacturerData(int manufacturerId, byte[] manufacturerData, byte[] manufacturerDataMask)
Set filter on partial manufacture data.
|
ScanFilter.Builder
|
setManufacturerData(int manufacturerId, byte[] manufacturerData)
Set filter on on manufacturerData.
|
ScanFilter.Builder
|
setServiceData(ParcelUuid serviceDataUuid, byte[] serviceData, byte[] serviceDataMask)
Set partial filter on service data.
|
ScanFilter.Builder
|
setServiceData(ParcelUuid serviceDataUuid, byte[] serviceData)
Set filtering on service data.
|
ScanFilter.Builder
|
setServiceSolicitationUuid(ParcelUuid serviceSolicitationUuid, ParcelUuid solicitationUuidMask)
Set filter on partial service Solicitation uuid.
|
ScanFilter.Builder
|
setServiceSolicitationUuid(ParcelUuid serviceSolicitationUuid)
Set filter on service solicitation uuid.
|
ScanFilter.Builder
|
setServiceUuid(ParcelUuid serviceUuid)
Set filter on service uuid.
|
ScanFilter.Builder
|
setServiceUuid(ParcelUuid serviceUuid, ParcelUuid uuidMask)
Set filter on partial service uuid.
|
Inherited methods |
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this object.
|
boolean
|
equals(Object obj)
Indicates whether some other object is "equal to" this one.
|
void
|
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
final
Class<?>
|
getClass()
Returns the runtime class of this Object .
|
int
|
hashCode()
Returns a hash code value for the object.
|
final
void
|
notify()
Wakes up a single thread that is waiting on this object's
monitor.
|
final
void
|
notifyAll()
Wakes up all threads that are waiting on this object's monitor.
|
String
|
toString()
Returns a string representation of the object.
|
final
void
|
wait(long timeoutMillis, int nanos)
Causes the current thread to wait until it is awakened, typically
by being notified or interrupted, or until a
certain amount of real time has elapsed.
|
final
void
|
wait(long timeoutMillis)
Causes the current thread to wait until it is awakened, typically
by being notified or interrupted, or until a
certain amount of real time has elapsed.
|
final
void
|
wait()
Causes the current thread to wait until it is awakened, typically
by being notified or interrupted.
|
|
Public constructors
Builder
public Builder ()
Public methods
setAdvertisingDataType
public ScanFilter.Builder setAdvertisingDataType (int advertisingDataType)
Set filter on advertising data with specific advertising data type.
The values of advertisingDataType
are assigned by Bluetooth SIG. For more
details refer to Bluetooth Generic Access Profile.
(https://www.bluetooth.com/specifications/assigned-numbers/)
Parameters |
advertisingDataType |
int : Value is ScanRecord.DATA_TYPE_FLAGS , ScanRecord.DATA_TYPE_SERVICE_UUIDS_16_BIT_PARTIAL , ScanRecord.DATA_TYPE_SERVICE_UUIDS_16_BIT_COMPLETE , ScanRecord.DATA_TYPE_SERVICE_UUIDS_32_BIT_PARTIAL , ScanRecord.DATA_TYPE_SERVICE_UUIDS_32_BIT_COMPLETE , ScanRecord.DATA_TYPE_SERVICE_UUIDS_128_BIT_PARTIAL , ScanRecord.DATA_TYPE_SERVICE_UUIDS_128_BIT_COMPLETE , ScanRecord.DATA_TYPE_LOCAL_NAME_SHORT , ScanRecord.DATA_TYPE_LOCAL_NAME_COMPLETE , ScanRecord.DATA_TYPE_TX_POWER_LEVEL , ScanRecord.DATA_TYPE_CLASS_OF_DEVICE , ScanRecord.DATA_TYPE_SIMPLE_PAIRING_HASH_C , ScanRecord.DATA_TYPE_SIMPLE_PAIRING_RANDOMIZER_R , ScanRecord.DATA_TYPE_DEVICE_ID , ScanRecord.DATA_TYPE_SECURITY_MANAGER_OUT_OF_BAND_FLAGS , ScanRecord.DATA_TYPE_SLAVE_CONNECTION_INTERVAL_RANGE , ScanRecord.DATA_TYPE_SERVICE_SOLICITATION_UUIDS_16_BIT , ScanRecord.DATA_TYPE_SERVICE_SOLICITATION_UUIDS_128_BIT , ScanRecord.DATA_TYPE_SERVICE_DATA_16_BIT , ScanRecord.DATA_TYPE_PUBLIC_TARGET_ADDRESS , ScanRecord.DATA_TYPE_RANDOM_TARGET_ADDRESS , ScanRecord.DATA_TYPE_APPEARANCE , ScanRecord.DATA_TYPE_ADVERTISING_INTERVAL , ScanRecord.DATA_TYPE_LE_BLUETOOTH_DEVICE_ADDRESS , ScanRecord.DATA_TYPE_LE_ROLE , ScanRecord.DATA_TYPE_SIMPLE_PAIRING_HASH_C_256 , ScanRecord.DATA_TYPE_SIMPLE_PAIRING_RANDOMIZER_R_256 , ScanRecord.DATA_TYPE_SERVICE_SOLICITATION_UUIDS_32_BIT , ScanRecord.DATA_TYPE_SERVICE_DATA_32_BIT , ScanRecord.DATA_TYPE_SERVICE_DATA_128_BIT , ScanRecord.DATA_TYPE_LE_SECURE_CONNECTIONS_CONFIRMATION_VALUE , ScanRecord.DATA_TYPE_LE_SECURE_CONNECTIONS_RANDOM_VALUE , ScanRecord.DATA_TYPE_URI , ScanRecord.DATA_TYPE_INDOOR_POSITIONING , ScanRecord.DATA_TYPE_TRANSPORT_DISCOVERY_DATA , ScanRecord.DATA_TYPE_LE_SUPPORTED_FEATURES , ScanRecord.DATA_TYPE_CHANNEL_MAP_UPDATE_INDICATION , ScanRecord.DATA_TYPE_PB_ADV , ScanRecord.DATA_TYPE_MESH_MESSAGE , ScanRecord.DATA_TYPE_MESH_BEACON , ScanRecord.DATA_TYPE_BIG_INFO , ScanRecord.DATA_TYPE_BROADCAST_CODE , ScanRecord.DATA_TYPE_RESOLVABLE_SET_IDENTIFIER , ScanRecord.DATA_TYPE_ADVERTISING_INTERVAL_LONG , ScanRecord.DATA_TYPE_3D_INFORMATION_DATA , or ScanRecord.DATA_TYPE_MANUFACTURER_SPECIFIC_DATA |
setAdvertisingDataTypeWithData
public ScanFilter.Builder setAdvertisingDataTypeWithData (int advertisingDataType,
byte[] advertisingData,
byte[] advertisingDataMask)
Set filter on advertising data with specific advertising data type. For any bit in the
mask, set it the 1 if it needs to match the one in advertising data, otherwise set it to
0.
The values of advertisingDataType
are assigned by Bluetooth SIG. For more
details refer to Bluetooth Generic Access Profile.
(https://www.bluetooth.com/specifications/assigned-numbers/) The advertisingDataMask
must have the same length of advertisingData
.
Parameters |
advertisingDataType |
int : Value is ScanRecord.DATA_TYPE_FLAGS , ScanRecord.DATA_TYPE_SERVICE_UUIDS_16_BIT_PARTIAL , ScanRecord.DATA_TYPE_SERVICE_UUIDS_16_BIT_COMPLETE , ScanRecord.DATA_TYPE_SERVICE_UUIDS_32_BIT_PARTIAL , ScanRecord.DATA_TYPE_SERVICE_UUIDS_32_BIT_COMPLETE , ScanRecord.DATA_TYPE_SERVICE_UUIDS_128_BIT_PARTIAL , ScanRecord.DATA_TYPE_SERVICE_UUIDS_128_BIT_COMPLETE , ScanRecord.DATA_TYPE_LOCAL_NAME_SHORT , ScanRecord.DATA_TYPE_LOCAL_NAME_COMPLETE , ScanRecord.DATA_TYPE_TX_POWER_LEVEL , ScanRecord.DATA_TYPE_CLASS_OF_DEVICE , ScanRecord.DATA_TYPE_SIMPLE_PAIRING_HASH_C , ScanRecord.DATA_TYPE_SIMPLE_PAIRING_RANDOMIZER_R , ScanRecord.DATA_TYPE_DEVICE_ID , ScanRecord.DATA_TYPE_SECURITY_MANAGER_OUT_OF_BAND_FLAGS , ScanRecord.DATA_TYPE_SLAVE_CONNECTION_INTERVAL_RANGE , ScanRecord.DATA_TYPE_SERVICE_SOLICITATION_UUIDS_16_BIT , ScanRecord.DATA_TYPE_SERVICE_SOLICITATION_UUIDS_128_BIT , ScanRecord.DATA_TYPE_SERVICE_DATA_16_BIT , ScanRecord.DATA_TYPE_PUBLIC_TARGET_ADDRESS , ScanRecord.DATA_TYPE_RANDOM_TARGET_ADDRESS , ScanRecord.DATA_TYPE_APPEARANCE , ScanRecord.DATA_TYPE_ADVERTISING_INTERVAL , ScanRecord.DATA_TYPE_LE_BLUETOOTH_DEVICE_ADDRESS , ScanRecord.DATA_TYPE_LE_ROLE , ScanRecord.DATA_TYPE_SIMPLE_PAIRING_HASH_C_256 , ScanRecord.DATA_TYPE_SIMPLE_PAIRING_RANDOMIZER_R_256 , ScanRecord.DATA_TYPE_SERVICE_SOLICITATION_UUIDS_32_BIT , ScanRecord.DATA_TYPE_SERVICE_DATA_32_BIT , ScanRecord.DATA_TYPE_SERVICE_DATA_128_BIT , ScanRecord.DATA_TYPE_LE_SECURE_CONNECTIONS_CONFIRMATION_VALUE , ScanRecord.DATA_TYPE_LE_SECURE_CONNECTIONS_RANDOM_VALUE , ScanRecord.DATA_TYPE_URI , ScanRecord.DATA_TYPE_INDOOR_POSITIONING , ScanRecord.DATA_TYPE_TRANSPORT_DISCOVERY_DATA , ScanRecord.DATA_TYPE_LE_SUPPORTED_FEATURES , ScanRecord.DATA_TYPE_CHANNEL_MAP_UPDATE_INDICATION , ScanRecord.DATA_TYPE_PB_ADV , ScanRecord.DATA_TYPE_MESH_MESSAGE , ScanRecord.DATA_TYPE_MESH_BEACON , ScanRecord.DATA_TYPE_BIG_INFO , ScanRecord.DATA_TYPE_BROADCAST_CODE , ScanRecord.DATA_TYPE_RESOLVABLE_SET_IDENTIFIER , ScanRecord.DATA_TYPE_ADVERTISING_INTERVAL_LONG , ScanRecord.DATA_TYPE_3D_INFORMATION_DATA , or ScanRecord.DATA_TYPE_MANUFACTURER_SPECIFIC_DATA |
advertisingData |
byte : This value cannot be null . |
advertisingDataMask |
byte : This value cannot be null . |
Throws |
IllegalArgumentException |
If the advertisingDataType is invalid, advertisingData or advertisingDataMask is null or advertisingData
and advertisingDataMask have different length. |
setDeviceName
public ScanFilter.Builder setDeviceName (String deviceName)
Set filter on device name.
Parameters |
deviceName |
String |
setManufacturerData
public ScanFilter.Builder setManufacturerData (int manufacturerId,
byte[] manufacturerData,
byte[] manufacturerDataMask)
Set filter on partial manufacture data. For any bit in the mask, set it the 1 if it needs
to match the one in manufacturer data, otherwise set it to 0.
The manufacturerDataMask
must have the same length of manufacturerData
.
Parameters |
manufacturerId |
int |
manufacturerData |
byte |
manufacturerDataMask |
byte |
Throws |
IllegalArgumentException |
If the manufacturerId is invalid, or manufacturerData is null while manufacturerDataMask is not, or manufacturerData and manufacturerDataMask have different length. |
setManufacturerData
public ScanFilter.Builder setManufacturerData (int manufacturerId,
byte[] manufacturerData)
Set filter on on manufacturerData. A negative manufacturerId is considered as invalid id.
Parameters |
manufacturerId |
int |
manufacturerData |
byte |
setServiceData
public ScanFilter.Builder setServiceData (ParcelUuid serviceDataUuid,
byte[] serviceData,
byte[] serviceDataMask)
Set partial filter on service data. For any bit in the mask, set it to 1 if it needs to
match the one in service data, otherwise set it to 0 to ignore that bit.
The serviceDataMask
must have the same length of the serviceData
.
Parameters |
serviceDataUuid |
ParcelUuid |
serviceData |
byte |
serviceDataMask |
byte |
Throws |
IllegalArgumentException |
If serviceDataUuid is null or serviceDataMask is null while serviceData is not or serviceDataMask and serviceData has different length. |
setServiceData
public ScanFilter.Builder setServiceData (ParcelUuid serviceDataUuid,
byte[] serviceData)
Set filtering on service data.
Parameters |
serviceDataUuid |
ParcelUuid |
serviceData |
byte |
setServiceSolicitationUuid
public ScanFilter.Builder setServiceSolicitationUuid (ParcelUuid serviceSolicitationUuid,
ParcelUuid solicitationUuidMask)
Set filter on partial service Solicitation uuid. The SolicitationUuidMask
is the
bit mask for the 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.
Parameters |
serviceSolicitationUuid |
ParcelUuid : can only be null if solicitationUuidMask is null. |
solicitationUuidMask |
ParcelUuid : can be null or a mask with no restriction. |
setServiceSolicitationUuid
public ScanFilter.Builder setServiceSolicitationUuid (ParcelUuid serviceSolicitationUuid)
Set filter on service solicitation uuid.
Parameters |
serviceSolicitationUuid |
ParcelUuid : This value may be null . |
setServiceUuid
public ScanFilter.Builder setServiceUuid (ParcelUuid serviceUuid)
Set filter on service uuid.
Parameters |
serviceUuid |
ParcelUuid |
setServiceUuid
public ScanFilter.Builder setServiceUuid (ParcelUuid serviceUuid,
ParcelUuid uuidMask)
Set filter on partial service uuid. The uuidMask
is the bit mask for the serviceUuid
. Set any bit in the mask to 1 to indicate a match is needed for the bit in
serviceUuid
, and 0 to ignore that bit.
Parameters |
serviceUuid |
ParcelUuid |
uuidMask |
ParcelUuid |