Android APIs
public final class

ScanRecord

extends Object
java.lang.Object
   ↳ android.bluetooth.le.ScanRecord

Class Overview

Represents a scan record from Bluetooth LE scan.

Summary

Public Methods
int getAdvertiseFlags()
Returns the advertising flags indicating the discoverable mode and capability of the device.
String getLocalName()
Returns the local name of the BLE device.
int getManufacturerId()
Returns the manufacturer identifier, which is a non-negative number assigned by Bluetooth SIG.
byte[] getManufacturerSpecificData()
Returns the manufacturer specific data which is the content of manufacturer specific data field.
byte[] getServiceData()
Returns service data.
ParcelUuid getServiceDataUuid()
Returns a 16 bit uuid of the service that the service data is associated with.
List<ParcelUuid> getServiceUuids()
Returns a list of service uuids within the advertisement that are used to identify the bluetooth gatt services.
int getTxPowerLevel()
Returns the transmission power level of the packet in dBm.
static ScanRecord parseFromBytes(byte[] scanRecord)
Parse scan record bytes to ScanRecord.
String toString()
Returns a string containing a concise, human-readable description of this object.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public int getAdvertiseFlags ()

Returns the advertising flags indicating the discoverable mode and capability of the device. Returns -1 if the flag field is not set.

public String getLocalName ()

Returns the local name of the BLE device. The is a UTF-8 encoded string.

public int getManufacturerId ()

Returns the manufacturer identifier, which is a non-negative number assigned by Bluetooth SIG.

public byte[] getManufacturerSpecificData ()

Returns the manufacturer specific data which is the content of manufacturer specific data field. The first 2 bytes of the data contain the company id.

public byte[] getServiceData ()

Returns service data. The first two bytes should be a 16 bit service uuid associated with the service data.

public ParcelUuid getServiceDataUuid ()

Returns a 16 bit uuid of the service that the service data is associated with.

public List<ParcelUuid> getServiceUuids ()

Returns a list of service uuids within the advertisement that are used to identify the bluetooth gatt services.

public int getTxPowerLevel ()

Returns the transmission power level of the packet in dBm. Returns MIN_VALUE if the field is not set. This value can be used to calculate the path loss of a received packet using the following equation:

pathloss = txPowerLevel - rssi

public static ScanRecord parseFromBytes (byte[] scanRecord)

Parse scan record bytes to ScanRecord.

The format is defined in Bluetooth 4.1 specification, Volume 3, Part C, Section 11 and 18.

All numerical multi-byte entities and values shall use little-endian byte order.

Parameters
scanRecord The scan record of Bluetooth LE advertisement and/or scan response.

public String toString ()

Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:

   getClass().getName() + '@' + Integer.toHexString(hashCode())

See Writing a useful toString method if you intend implementing your own toString method.

Returns
  • a printable representation of this object.