public final class BleScanRecord extends java.lang.Object implements UsesCustomNull
Modifier and Type | Class and Description |
---|---|
static class |
BleScanRecord.Option
Enumeration for advertising options
|
Modifier and Type | Field and Description |
---|---|
static BleScanRecord |
NULL |
Constructor and Description |
---|
BleScanRecord()
Basic constructor to use if you are building a scan record to advertise.
|
BleScanRecord(Pointer<java.lang.Integer> advFlags,
Pointer<java.lang.Integer> txPower,
java.util.List<java.util.UUID> serviceUuids,
boolean uuidCompleteList,
java.util.List<ManufacturerData> mfgData,
java.util.Map<java.util.UUID,byte[]> serviceData,
java.lang.String localName,
boolean shortName)
Constructor used internally when a
BleDevice is discovered. |
BleScanRecord(Pointer<java.lang.Integer> advFlags,
Pointer<java.lang.Integer> txPower,
java.util.List<java.util.UUID> serviceUuids,
boolean uuidCompleteList,
short mfgId,
byte[] mfgData,
java.util.Map<java.util.UUID,byte[]> serviceData,
java.lang.String localName,
boolean shortName)
Old Constructor used to be used internally when a
BleDevice is discovered. |
BleScanRecord(java.util.UUID serviceUuid) |
BleScanRecord(java.util.UUID[] serviceUuids,
BleScanRecord.Option... options) |
BleScanRecord(java.util.UUID serviceUuid,
BleScanRecord.Option... options) |
BleScanRecord(java.util.UUID serviceUuid,
byte[] serviceData) |
BleScanRecord(java.util.UUID serviceUuid,
byte[] serviceData,
BleScanRecord.Option... options) |
Modifier and Type | Method and Description |
---|---|
BleScanRecord |
addManufacturerData(short manId,
byte[] data)
Add some manufacturer data, along with the given manufacturer id to the backing
List . |
BleScanRecord |
addServiceData(java.util.Map<java.util.UUID,byte[]> data)
Set the service data for this
BleScanRecord instance. |
BleScanRecord |
addServiceData(java.util.UUID uuid,
byte[] data)
Add the given
UUID and data to this instance's service data map. |
BleScanRecord |
addServiceUuid(java.util.UUID uuid)
Overload of
addServiceUuid(UUID, BleUuid.UuidSize) , which sets the size to BleUuid.UuidSize.SHORT , if it can fit, otherwise it will
default to BleUuid.UuidSize.FULL |
BleScanRecord |
addServiceUuid(java.util.UUID uuid,
BleUuid.UuidSize size)
|
BleScanRecord |
addServiceUUIDs(java.util.List<java.util.UUID> uuids)
Add the given List of
UUID s to this instance's UUID list. |
byte[] |
buildPacket()
Build a byte[] scan record from the data stored in this instance.
|
BleScanRecord |
clearServiceData()
Clear all service data that may be in this
BleScanRecord instance. |
BleScanRecord |
clearServiceUUIDs()
Clears any service UUIDs in this instance.
|
Pointer<java.lang.Integer> |
getAdvFlags()
Get the advertising flags for this instance.
|
byte[] |
getManufacturerData()
Get the manufacturer data from this instance.
|
java.util.List<ManufacturerData> |
getManufacturerDataList()
Returns a
List of all manufacturer data parsed in the scan record. |
short |
getManufacturerId()
Get the manufacturer Id from this
BleScanRecord instance. |
java.lang.String |
getName()
Returns the device name
|
java.util.Map<java.util.UUID,byte[]> |
getServiceData()
Returns a
Map of the service data in this instance. |
java.util.List<java.util.UUID> |
getServiceUUIDS()
Returns a list of service
UUID s. |
Pointer<java.lang.Integer> |
getTxPower()
Gets the Tx power
|
boolean |
hasUuid(java.util.UUID uuid)
Returns true if this advertising packet contains the uuid given.
|
boolean |
includesDeviceName()
Returns whether the resulting advertising packet will have the device name included or not.
|
boolean |
includesTxPowerLevel()
Returns whether the resulting advertising packet will have the TX Power level included or not.
|
boolean |
isConnectable()
Returns whether the resulting advertising packet will have the connectable flag set or not.
|
boolean |
isNull()
Returns
true if this instance is considered null. |
boolean |
isShortName()
Returns whether the name is a shortened version or not.
|
BleScanRecord |
setAdvFlags(byte... flags)
Convenience method to set the advertising flags, which allows you to pass in every flag you want, and this
method will OR them together for you.
|
BleScanRecord |
setAdvFlags(byte mask)
Set the advertising flags.
|
BleScanRecord |
setManufacturerDataList(java.util.List<ManufacturerData> list)
Sets this
BleScanRecord 's manufacturer data list. |
BleScanRecord |
setName(java.lang.String name)
Overload of
setName(String, boolean) , which defaults to a complete name (not short). |
BleScanRecord |
setName(java.lang.String name,
boolean shortName)
Set the device name, and if it's a shortened name or not.
|
BleScanRecord |
setOptions(BleScanRecord.Option... options)
Set the options for this scan record.
|
BleScanRecord |
setTxPower(byte power)
Set the TX power
|
public static final BleScanRecord NULL
public BleScanRecord()
public BleScanRecord(java.util.UUID serviceUuid)
public BleScanRecord(java.util.UUID serviceUuid, byte[] serviceData)
public BleScanRecord(java.util.UUID serviceUuid, byte[] serviceData, BleScanRecord.Option... options)
public BleScanRecord(java.util.UUID serviceUuid, BleScanRecord.Option... options)
public BleScanRecord(java.util.UUID[] serviceUuids, BleScanRecord.Option... options)
public BleScanRecord(Pointer<java.lang.Integer> advFlags, Pointer<java.lang.Integer> txPower, java.util.List<java.util.UUID> serviceUuids, boolean uuidCompleteList, short mfgId, byte[] mfgData, java.util.Map<java.util.UUID,byte[]> serviceData, java.lang.String localName, boolean shortName)
BleDevice
is discovered. Now, BleScanRecord(Pointer, Pointer, List, boolean, List, Map, String, boolean)
is
used instead.public BleScanRecord(Pointer<java.lang.Integer> advFlags, Pointer<java.lang.Integer> txPower, java.util.List<java.util.UUID> serviceUuids, boolean uuidCompleteList, java.util.List<ManufacturerData> mfgData, java.util.Map<java.util.UUID,byte[]> serviceData, java.lang.String localName, boolean shortName)
BleDevice
is discovered.public final BleScanRecord clearServiceData()
BleScanRecord
instance.
See also clearServiceUUIDs()
.public final BleScanRecord addServiceData(java.util.Map<java.util.UUID,byte[]> data)
BleScanRecord
instance.public final BleScanRecord setOptions(BleScanRecord.Option... options)
BleServer
to advertise itself.BleScanRecord.Option
public final boolean isConnectable()
public final boolean includesTxPowerLevel()
public final boolean includesDeviceName()
public final BleScanRecord clearServiceUUIDs()
public final BleScanRecord addServiceUUIDs(java.util.List<java.util.UUID> uuids)
UUID
s to this instance's UUID list.public final BleScanRecord addServiceData(java.util.UUID uuid, byte[] data)
UUID
and data to this instance's service data map.public final BleScanRecord addServiceUuid(java.util.UUID uuid, BleUuid.UuidSize size)
public final BleScanRecord addServiceUuid(java.util.UUID uuid)
addServiceUuid(UUID, BleUuid.UuidSize)
, which sets the size to BleUuid.UuidSize.SHORT
, if it can fit, otherwise it will
default to BleUuid.UuidSize.FULL
public final BleScanRecord addManufacturerData(short manId, byte[] data)
List
.public final BleScanRecord setManufacturerDataList(java.util.List<ManufacturerData> list)
BleScanRecord
's manufacturer data list. This creates a new list from the one given.public final BleScanRecord setName(java.lang.String name)
setName(String, boolean)
, which defaults to a complete name (not short).public final BleScanRecord setName(java.lang.String name, boolean shortName)
public final short getManufacturerId()
BleScanRecord
instance. This is a convenience method. This simply returns the first item in the List
holding
all manufacturer data.getManufacturerDataList()
public final byte[] getManufacturerData()
List
holding
all manufacturer data.getManufacturerDataList()
public final java.util.List<ManufacturerData> getManufacturerDataList()
List
of all manufacturer data parsed in the scan record.public final BleScanRecord setAdvFlags(byte mask)
public final BleScanRecord setAdvFlags(byte... flags)
public final Pointer<java.lang.Integer> getAdvFlags()
public final BleScanRecord setTxPower(byte power)
public final Pointer<java.lang.Integer> getTxPower()
public final java.util.List<java.util.UUID> getServiceUUIDS()
UUID
s. This ONLY includes UUID
s that do NOT have any data associated with them.
See also getServiceData()
.public final java.util.Map<java.util.UUID,byte[]> getServiceData()
Map
of the service data in this instance.
See also getServiceUUIDS()
.public final java.lang.String getName()
public final boolean isShortName()
public final boolean isNull()
true
if this instance is considered null.isNull
in interface UsesCustomNull
public final byte[] buildPacket()
public boolean hasUuid(java.util.UUID uuid)