Class ScanFilter
java.lang.Object
com.codename1.bluetooth.le.ScanFilter
A single scan filter -- all criteria set on one filter are AND-combined;
multiple filters added to a ScanSettings are OR-combined. Fluent
setters return this for chaining:
new ScanFilter()
.setServiceUuid(BluetoothUuid.fromShort(0x180D))
.setNamePrefix("Polar");
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThe address criterion, ornullwhen unset.byte[]The manufacturer-data payload criterion, ornull.byte[]The manufacturer-data mask, ornull(exact comparison).intThe manufacturer-data company identifier criterion, or-1when unset.getName()The exact-name criterion, ornullwhen unset.The name-prefix criterion, ornullwhen unset.The service UUID criterion, ornullwhen unset.booleanmatches(ScanResult result) truewhen the given scan result satisfies every criterion of this filter.setAddress(String address) Matches the device with the given address (seeBluetoothDevice.getAddress()for the per-platform address semantics).setManufacturerData(int companyId, byte[] data, byte[] mask) Matches devices whose advertisement carries manufacturer data forcompanyIdwhose leading bytes equaldataundermask(anullmask compares all ofdataexactly).Matches devices advertising exactly this local name.setNamePrefix(String prefix) Matches devices whose advertised local name starts with the given prefix.setServiceUuid(BluetoothUuid uuid) Matches devices advertising the given service UUID.
-
Constructor Details
-
ScanFilter
public ScanFilter()
-
-
Method Details
-
setServiceUuid
Matches devices advertising the given service UUID. -
setName
Matches devices advertising exactly this local name. -
setNamePrefix
Matches devices whose advertised local name starts with the given prefix. -
setAddress
Matches the device with the given address (seeBluetoothDevice.getAddress()for the per-platform address semantics). -
setManufacturerData
Matches devices whose advertisement carries manufacturer data forcompanyIdwhose leading bytes equaldataundermask(anullmask compares all ofdataexactly). Passnulldata to match any payload for the company. -
getServiceUuid
The service UUID criterion, ornullwhen unset. Ports use the getters to push filters down to the platform scanner -- required for background scanning on iOS. -
getName
The exact-name criterion, ornullwhen unset. -
getNamePrefix
The name-prefix criterion, ornullwhen unset. -
getAddress
The address criterion, ornullwhen unset. -
getManufacturerId
public int getManufacturerId()The manufacturer-data company identifier criterion, or-1when unset. -
getManufacturerData
public byte[] getManufacturerData()The manufacturer-data payload criterion, ornull. -
getManufacturerDataMask
public byte[] getManufacturerDataMask()The manufacturer-data mask, ornull(exact comparison). -
matches
truewhen the given scan result satisfies every criterion of this filter. Used by the core scan demultiplexer; ports may also use it to pre-filter.
-