|
本帖最后由 王少790318 于 2021-11-5 12:05 编辑
做了两个函数 打开 和扫描 打开正常 扫描就没反应,没有callback。 function fnBleScan(){ //api.alert({ msg: "扫描" });
//scan
ble.scan({
serviceUUIDs: ['', '']
}, function(ret) {
api.alert({ msg: "扫描" });
if (ret.status) {
api.alert({ msg: "开始扫描" });
//Pripheral
ble.getPeripheral(function(ret) {
if (ret) {
api.alert({ msg: JSON.stringify(ret) });
}
});
//prepheral end
}
else {
api.alert({ msg: "扫描失败" });
}
});
//scan end
}
|
|