1***@163.com
1***@163.com
  • 发布:2024-02-23 10:32
  • 更新:2024-02-23 10:34
  • 阅读:198

联想pad小新 使用plus.bluetooth.onBluetoothDeviceFound没有反应

分类:uni-app
search() {  
                let that = this  
                uni.openBluetoothAdapter({  
                    success: function(e) {  
                        console.log(e);  
                        uni.startBluetoothDevicesDiscovery({  
                            success: function(e) {  
                                console.log(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]));  
                                    }  
                                });  
                                // uni.onBluetoothDeviceFound((callback) => {  
                                //  //监听搜索附近蓝牙设备  
                                //  console.log(callback);  
                                //  that.lanyaArr.push(callback.devices[0])  
                                // }, (e) => {  
                                //  console.log(e);  
                                // })  
                            },  
                            fail: function(e) {  
                                console.log(e);  
                            },  
                        })  
                    },  
                    fail: function(e) {  
                        console.log(e);  
                    },  
                })  

            },
2024-02-23 10:32 负责人:无 分享
已邀请:

要回复问题请先登录注册