public final class ScanResult extends Object implements android.os.Parcelable
| Modifier and Type | Field and Description |
|---|---|
static android.os.Parcelable.Creator<ScanResult> |
CREATOR |
static int |
DATA_COMPLETE
For chained advertisements, indicates that the data contained in this
scan result is complete.
|
static int |
DATA_TRUNCATED
For chained advertisements, indicates that the controller was
unable to receive all chained packets and the scan result contains
incomplete truncated data.
|
static int |
PERIODIC_INTERVAL_NOT_PRESENT
Periodic advertising interval is not present in the packet.
|
static int |
PHY_UNUSED
Indicates that the secondary physical layer was not used.
|
static int |
SID_NOT_PRESENT
Advertising Set ID is not present in the packet.
|
static int |
TX_POWER_NOT_PRESENT
TX power is not present in the packet.
|
| Constructor and Description |
|---|
ScanResult(android.bluetooth.BluetoothDevice device,
int eventType,
int primaryPhy,
int secondaryPhy,
int advertisingSid,
int txPower,
int rssi,
int periodicAdvertisingInterval,
ScanRecord scanRecord,
long timestampNanos)
Constructs a new ScanResult.
|
ScanResult(android.bluetooth.BluetoothDevice device,
ScanRecord scanRecord,
int rssi,
long timestampNanos)
|
| Modifier and Type | Method and Description |
|---|---|
int |
describeContents() |
boolean |
equals(Object obj) |
int |
getAdvertisingSid()
Returns the advertising set id.
|
int |
getDataStatus()
Returns the data status.
|
android.bluetooth.BluetoothDevice |
getDevice()
Returns the remote Bluetooth device identified by the Bluetooth device address.
|
int |
getPeriodicAdvertisingInterval()
Returns the periodic advertising interval in units of 1.25ms.
|
int |
getPrimaryPhy()
Returns the primary Physical Layer
on which this advertisement was received.
|
int |
getRssi()
Returns the received signal strength in dBm.
|
ScanRecord |
getScanRecord()
Returns the scan record, which is a combination of advertisement and scan response.
|
int |
getSecondaryPhy()
Returns the secondary Physical Layer
on which this advertisement was received.
|
long |
getTimestampNanos()
Returns timestamp since boot when the scan record was observed.
|
int |
getTxPower()
Returns the transmit power in dBm.
|
int |
hashCode() |
boolean |
isConnectable()
Returns true if this object represents connectable scan result.
|
boolean |
isLegacy()
Returns true if this object represents legacy scan result.
|
String |
toString() |
void |
writeToParcel(android.os.Parcel dest,
int flags) |
public static final int DATA_COMPLETE
public static final int DATA_TRUNCATED
public static final int PHY_UNUSED
public static final int SID_NOT_PRESENT
public static final int TX_POWER_NOT_PRESENT
public static final int PERIODIC_INTERVAL_NOT_PRESENT
public static final android.os.Parcelable.Creator<ScanResult> CREATOR
public ScanResult(android.bluetooth.BluetoothDevice device,
ScanRecord scanRecord,
int rssi,
long timestampNanos)
device - Remote Bluetooth device found.scanRecord - Scan record including both advertising data and scan response data.rssi - Received signal strength.timestampNanos - Timestamp at which the scan result was observed.public ScanResult(android.bluetooth.BluetoothDevice device,
int eventType,
int primaryPhy,
int secondaryPhy,
int advertisingSid,
int txPower,
int rssi,
int periodicAdvertisingInterval,
ScanRecord scanRecord,
long timestampNanos)
device - Remote Bluetooth device found.eventType - Event type.primaryPhy - Primary advertising phy.secondaryPhy - Secondary advertising phy.advertisingSid - Advertising set ID.txPower - Transmit power.rssi - Received signal strength.periodicAdvertisingInterval - Periodic advertising interval.scanRecord - Scan record including both advertising data and scan response data.timestampNanos - Timestamp at which the scan result was observed.public void writeToParcel(android.os.Parcel dest,
int flags)
writeToParcel in interface android.os.Parcelablepublic int describeContents()
describeContents in interface android.os.Parcelablepublic android.bluetooth.BluetoothDevice getDevice()
public ScanRecord getScanRecord()
public int getRssi()
public long getTimestampNanos()
public boolean isLegacy()
public boolean isConnectable()
public int getDataStatus()
DATA_COMPLETE or
DATA_TRUNCATED.public int getPrimaryPhy()
BluetoothDevice.PHY_LE_1M or
BluetoothDevice.PHY_LE_CODED.public int getSecondaryPhy()
BluetoothDevice.PHY_LE_1M,
BluetoothDevice.PHY_LE_2M, BluetoothDevice.PHY_LE_CODED
or PHY_UNUSED - if the advertisement
was not received on a secondary physical channel.public int getAdvertisingSid()
SID_NOT_PRESENT if
no set id was is present.public int getTxPower()
TX_POWER_NOT_PRESENT
indicates that the TX power is not present.public int getPeriodicAdvertisingInterval()
PERIODIC_INTERVAL_NOT_PRESENT means periodic
advertising interval is not present.