HomeDocs
跳到主要内容

dlt.onBluetoothDeviceFound(function listener)

简介

添加蓝牙设备被发现的监听

使用限制

必须在调用 dlt.startBluetoothDevicesDiscovery 之前注册

参数

function listener

蓝牙设备被发现的监听函数

参数

Object res

属性类型说明
addressstring蓝牙设备的 mac 地址
namestring蓝牙设备名称,某些设备可能没有
RSSIstringRSSI
system_codenumber当扫描失败时返回

system_code 说明

system_code说明
1Fails to start scan as BLE scan with the same settings is already started by the app.
2Fails to start scan as app cannot be registered.
3Fails to start scan due an internal error
4Fails to start power optimized scan as this feature is not supported.
5Fails to start scan as it is out of hardware resources.
6Fails to start scan as application tries to scan too frequently.

示例代码

dlt.onBluetoothDeviceFound(function (res) {
console.log(res);
});
Privacy agreementDeveloper agreementcontact us: developer_service.mi@transsion.com © 2024 MiniApp. All Rights Reserved.