1***@qq.com
1***@qq.com
  • 发布:2019-05-21 11:45
  • 更新:2019-05-21 11:45
  • 阅读:1100

【报Bug】plus.bluetooth.stopBluetoothDevicesDiscovery无法停止对蓝牙的搜索

分类:HTML5+

详细问题描述

[内容]

用的是官网的源码,开启搜索蓝牙,然后监听蓝牙设备,关闭搜索之后,还是在搜索,还可以打印搜索的信息
[步骤]
点击开始搜索蓝牙,然后结束搜索蓝牙,看打印内容
[结果]
依然在搜索,没有停止
[期望]
希望尽快修复
[如果语言难以表述清晰,拍一个视频或截图,有图有真相]

IDE运行环境说明

[HBuilder 或 HBuilderX。如果你用其他工具开发uni-app,也需要在此说明]
HBuilderX
[IDE版本号]
1.9.8.20190518
[windows版本号]
windows10
[mac版本号]

uni-app运行环境说明

[运行端是h5或app或某个小程序?]
h5
[运行端版本号]
真机调试
[项目是cli创建的还是HBuilderX创建的?如果是cli创建的,请更新到最新版cli再试]
HBuilderX
[编译模式是老模板模式还是新的自定义组件模式?]

App运行环境说明

[Android版本号]
android9
[iOS版本号]

[手机型号]
荣耀v10
[模拟器型号]

附件

[IDE问题请提供HBuilderX运行日志。菜单帮助-查看运行日志,点右键打开文件所在目录,将log文件压缩成zip包上传]

[App问题请提供可重现问题的代码片段,你补充的细一点,问题就解决的快一点]

[App安装包或H5地址]

[可重现代码片段]
<script type="text/javascript" >
// 扩展API加载完毕后调用onPlusReady回调函数
document.addEventListener('plusready', onPlusReady, false);
// 扩展API加载完毕,现在可以正常调用扩展API
function onPlusReady(){
}
// 开始搜索蓝牙
function startBluetoothDiscovery(){
plus.bluetooth.openBluetoothAdapter({
success:function(e){
console.log('open success: '+JSON.stringify(e));
plus.bluetooth.startBluetoothDevicesDiscovery({
success:function(e){
console.log('start discovery success: '+JSON.stringify(e));
plus.bluetooth.onBluetoothDeviceFound(function(e){
var devices = e.devices;
console.log('device found: '+e.length);
for(var i in devices){
console.log(i+': '+JSON.stringify(devices[i]));
}
});
},
fail:function(e){
console.log('start discovery failed: '+JSON.stringify(e));
}
});
},
fail:function(e){
console.log('open failed: '+JSON.stringify(e));
}
});
}
// 结束搜索蓝牙
function stopBluetoothDiscovery(){
plus.bluetooth.stopBluetoothDevicesDiscovery({
success:function(e){
console.log('stop discovery success: '+JSON.stringify(e));
plus.bluetooth.closeBluetoothAdapter({
success:function(e){
console.log('close success: '+JSON.stringify(e));
},
fail:function(e){
console.log('close failed: '+JSON.stringify(e));
}
});
},
fail:function(e){
console.log('stop discovery failed: '+JSON.stringify(e));
}
});
}
</script>
</head>
<body>
<button onclick="startBluetoothDiscovery()">开始搜索蓝牙</button>
<br/>
<button onclick="stopBluetoothDiscovery()">结束搜索蓝牙</button>
</body>

联系方式

[QQ]
1050546926

2019-05-21 11:45 负责人:无 分享
已邀请:

该问题目前已经被锁定, 无法添加新回复