ScanFilter.Builder
public static final class ScanFilter.Builder
extends Object
Builder class for ScanFilter
.
Summary
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 millis, int nanos) Causes the current thread to wait until another thread invokes the notify() method or the notifyAll() method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed. |
final void |
wait(long millis) Causes the current thread to wait until either another thread invokes the notify() method or the notifyAll() method for this object, or a specified amount of time has elapsed. |
final void |
wait() Causes the current thread to wait until another thread invokes the notify() method or the notifyAll() method for this object. |
|
Public constructors
ScanFilter.Builder
ScanFilter.Builder ()
Public methods
setDeviceAddress
ScanFilter.Builder setDeviceAddress (String deviceAddress)
Set filter on device address.
Parameters |
deviceAddress |
String : The device Bluetooth address for the filter. It needs to be in the format of "01:02:03:AB:CD:EF". The device address can be validated using checkBluetoothAddress(String) . |
setDeviceName
ScanFilter.Builder setDeviceName (String deviceName)
Set filter on device name.
Parameters |
deviceName |
String
|
setManufacturerData
ScanFilter.Builder setManufacturerData (int manufacturerId,
byte[] manufacturerData)
Set filter on on manufacturerData. A negative manufacturerId is considered as invalid id.
Note the first two bytes of the manufacturerData
is the manufacturerId.
Parameters |
manufacturerId |
int
|
manufacturerData |
byte
|
setManufacturerData
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. |
setServiceData
ScanFilter.Builder setServiceData (ParcelUuid serviceDataUuid,
byte[] serviceData)
Set filtering on service data.
Parameters |
serviceDataUuid |
ParcelUuid
|
serviceData |
byte
|
setServiceData
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. |
setServiceUuid
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
|