Most visited

Recently visited

Added in API level 21

ScanCallback

public abstract class ScanCallback
extends Object

java.lang.Object
    android.bluetooth.le.ScanCallback


蓝牙LE扫描回调。 扫描结果使用这些回调进行报告。

也可以看看:

摘要(Summary)

常量(Constants)

int SCAN_FAILED_ALREADY_STARTED

无法开始扫描,因为应用程序已经启动了具有相同设置的BLE扫描。

int SCAN_FAILED_APPLICATION_REGISTRATION_FAILED

由于应用程序无法注册,因此无法启动扫描。

int SCAN_FAILED_FEATURE_UNSUPPORTED

由于此功能不受支持,因此无法启动功耗优化扫描。

int SCAN_FAILED_INTERNAL_ERROR

由于内部错误而无法开始扫描

Public constructors

ScanCallback()

公共方法(Public methods)

void onBatchScanResults(List<ScanResult> results)

批次结果交付时回调。

void onScanFailed(int errorCode)

扫描无法开始时的回叫。

void onScanResult(int callbackType, ScanResult result)

当找到BLE广告时回调。

继承方法(Inherited methods)

From class java.lang.Object

常量(Constants)

SCAN_FAILED_ALREADY_STARTED

Added in API level 21
int SCAN_FAILED_ALREADY_STARTED

无法开始扫描,因为应用程序已经启动了具有相同设置的BLE扫描。

常数值:1(0x00000001)

SCAN_FAILED_APPLICATION_REGISTRATION_FAILED

Added in API level 21
int SCAN_FAILED_APPLICATION_REGISTRATION_FAILED

由于应用程序无法注册,因此无法启动扫描。

常量值:2(0x00000002)

SCAN_FAILED_FEATURE_UNSUPPORTED

Added in API level 21
int SCAN_FAILED_FEATURE_UNSUPPORTED

由于此功能不受支持,因此无法启动功耗优化扫描。

常量值:4(0x00000004)

SCAN_FAILED_INTERNAL_ERROR

Added in API level 21
int SCAN_FAILED_INTERNAL_ERROR

由于内部错误而无法开始扫描

常量值:3(0x00000003)

Public constructors

ScanCallback

Added in API level 21
ScanCallback ()

公共方法(Public methods)

onBatchScanResults

Added in API level 21
void onBatchScanResults (List<ScanResult> results)

批次结果交付时回调。

参数(Parameters)
results List: List of scan results that are previously scanned.

onScanFailed

Added in API level 21
void onScanFailed (int errorCode)

扫描无法开始时的回叫。

参数(Parameters)
errorCode int: Error code (one of SCAN_FAILED_*) for scan failure.

onScanResult

Added in API level 21
void onScanResult (int callbackType, 
                ScanResult result)

当找到BLE广告时回调。

参数(Parameters)
callbackType int: Determines how this callback was triggered. Could be one of CALLBACK_TYPE_ALL_MATCHES, CALLBACK_TYPE_FIRST_MATCH or CALLBACK_TYPE_MATCH_LOST
result ScanResult: A Bluetooth LE scan result.

Hooray!