dlt.onBluetoothDeviceFound(function listener)
简介
添加蓝牙设备被发现的监听
使用限制
必须在调用 dlt.startBluetoothDevicesDiscovery 之前注册
参数
function listener
蓝牙设备被发现的监听函数
参数
Object res
属性 | 类型 | 说明 |
---|---|---|
address | string | 蓝牙设备的 mac 地址 |
name | string | 蓝牙设备名称,某些设备可能没有 |
RSSI | string | RSSI |
system_code | number | 当扫描失败时返回 |
system_code 说明
system_code | 说明 |
---|---|
1 | Fails to start scan as BLE scan with the same settings is already started by the app. |
2 | Fails to start scan as app cannot be registered. |
3 | Fails to start scan due an internal error |
4 | Fails to start power optimized scan as this feature is not supported. |
5 | Fails to start scan as it is out of hardware resources. |
6 | Fails to start scan as application tries to scan too frequently. |
示例代码
dlt.onBluetoothDeviceFound(function (res) {
console.log(res);
});