2***@qq.com
2***@qq.com
  • 发布:2025-06-16 14:48
  • 更新:2025-06-16 14:48
  • 阅读:32

【报Bug】uniapp 安卓版onBluetoothDeviceFound方式不能返回BLE蓝牙5.0+的设备

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: win11

HBuilderX类型: 正式

HBuilderX版本号: 4.66

手机系统: Android

手机系统版本号: Android 13

手机厂商: OPPO

手机机型: oppo

页面类型: vue

vue版本: vue2

打包方式: 云端

项目创建方式: HBuilderX

操作步骤:
    onBluetoothDeviceFound: function() {  
            var that = this;  
            let devices = this.devices;  
            uni.onBluetoothDeviceFound((res) => {  
                res.devices.forEach((device) => {  
                     console.log('设备名称:', device.name, '设备ID:', device.deviceId, '设备localname:', device.localName);  
                    if (!device.name && !device.localName) {  
                        return;  
                    }  
                    if (device.name == 'X-Ride' || device.localName == 'X-ride') {  
                        let isexist = devices.some(item => item.deviceId === device.deviceId)  
                        if (!isexist) {  
                            this.devices.push(device);  
                        }  

                    }  

                });  
            });  
        },

预期结果:

返回全部BLE设备

实际结果:

只返回5.0以下的蓝牙设备
14:46:09.834 设备名称:, BT912_4199, 设备ID:, 02:6A:0A:00:41:99, 设备localname:, BT912_4199 at pages/index/index.vue:248
14:46:10.432 设备名称:, BT107604524JBDH2562938, 设备ID:, AA:C2:37:01:90:CF, 设备localname:, BT107604524JBDH2562938 at pages/index/index.vue:248
14:46:25.556 设备名称:, YD38151887, 设备ID:, C1:28:38:15:18:87, 设备localname:, YD38151887 at pages/index/index.vue:248
14:46:25.971 设备名称:, , 设备ID:, 22:22:05:26:11:FD, 设备localname:, at pages/index/index.vue:248
14:46:32.691 设备名称:, NIO BLE Key 9C, 设备ID:, 54:F8:2A:25:90:9C, 设备localname:, NIO BLE Key 9C at pages/index/index.vue:248
14:46:35.929 设备名称:, 0WDAB2421J2188, 设备ID:, F4:1A:7A:C2:4B:D4, 设备localname:, 0WDAB2421J2188 at pages/index/index.vue:248
14:46:39.155 设备名称:, S58f7dfbcc46fd9c5C, 设备ID:, 7C:E2:69:FF:5C:8C, 设备localname:, S58f7dfbcc46fd9c5C at pages/index/index.vue:248

bug描述:

用uniapp连接BLE蓝牙设备,用真机测试安卓OnBluetoothDeviceFoundResult搜索返回的蓝牙设备不包括5.1的设备,就是蓝牙5.1的设备搜索不到。用小程序测试可以

2025-06-16 14:48 负责人:无 分享
已邀请:

要回复问题请先登录注册