在使用uniapp开发app中,使用了低功耗蓝牙,安卓在连接了蓝牙模块后通过调用uni.getConnectedBluetoothDevices Api接口能正常拿到数据,但是ios总是返回失败。
Android:
蓝牙设备:{
"deviceId": "60:55:F9:C9:C8:AA",
"name": "BLE",
"RSSI": -45,
"localName": "BLE",
"advertisServiceUUIDs": ["000000FF-0000-1000-8000-00805F9B34FB", "000000FF-0000-1000-8000-00805F9B34FB"],
"status": "offline"
}
服务:{
"services": [{
"uuid": "00001801-0000-1000-8000-00805F9B34FB",
"isPrimary": true
}, {
"uuid": "00001800-0000-1000-8000-00805F9B34FB",
"isPrimary": true
}, {
"uuid": "000000FF-0000-1000-8000-00805F9B34FB",
"isPrimary": true
}],
"errMsg": "getBLEDeviceServices:ok"
}
特征值:[{
"uuid": "0000FF01-0000-1000-8000-00805F9B34FB",
"properties": {
"read": true,
"write": true,
"notify": true,
"indicate": false
}
}, {
"uuid": "0000FF02-0000-1000-8000-00805F9B34FB",
"properties": {
"read": true,
"write": false,
"notify": false,
"indicate": false
}
}, {
"uuid": "0000FF03-0000-1000-8000-00805F9B34FB",
"properties": {
"read": false,
"write": true,
"notify": false,
"indicate": false
}
}]
连接成功后查询已连接设备:{
"devices": [{
"name": "BLE",
"deviceId": "60:55:F9:C9:C8:AA"
}],
"errMsg": "getConnectedBluetoothDevices:ok"
}
ios:
蓝牙设备:{
"RSSI": -70,
"advertisServiceUUIDs": ["000000FF-0000-1000-8000-00805F9B34FB", "000000FF-0000-1000-8000-00805F9B34FB"],
"deviceId": "60D023C2-2278-A605-61B6-9B861FB67FCB",
"localName": "BLE",
"name": "ESP_GATTS_DEMO"
}
服务:{
"services": [{
"isPrimary": true,
"uuid": "000000FF-0000-1000-8000-00805F9B34FB"
}],
"errMsg": "getBLEDeviceServices:ok"
}
特征值:[{
"properties": {
"indicate": false,
"notify": true,
"read": true,
"write": true
},
"uuid": "0000FF01-0000-1000-8000-00805F9B34FB"
}, {
"properties": {
"indicate": false,
"notify": false,
"read": true,
"write": false
},
"uuid": "0000FF02-0000-1000-8000-00805F9B34FB"
}, {
"properties": {
"indicate": false,
"notify": false,
"read": false,
"write": true
},
"uuid": "0000FF03-0000-1000-8000-00805F9B34FB"
}]
连接成功后查询已连接设备:{
"errMsg": "getConnectedBluetoothDevices:fail no device,https://ask.dcloud.net.cn/article/282",
"errCode": 10002,
"code": 10002
}
6 个回复
w***@sina.com (作者)
在社区看到两年前就有人提过这个问题,也是没人回答,到底是我们的问题还是框架的问题,完全没人可以解答下么,这个东西是烂了?
https://ask.dcloud.net.cn/question/108118
w***@sina.com (作者)
呃,也没官方能解答下吗
w***@sina.com (作者)
啧,三天了,都没一个回答吗
w***@sina.com (作者)
翻完整个官方蓝牙的文档都没看到这个10015的错误码是什么意思,官方社区提问也没人能出来回答,不知道这个框架咋让人用
{
"errMsg": "startBluetoothDevicesDiscovery:fail startBluetoothDevicesDiscovery fail",
"errCode": 10015,
"code": 10015
}
a聆听
同样的问题;请问楼主解决了吗?
w***@sina.com (作者)
没有,ios就是用不了这个接口,最后采取了别的办法来实现需求。官方就是个垃圾,一堆问题几年了都没个解决的,一个移除监听数据的事件也是几年了都没提供,人家微信小程序都有了。
2023-04-24 13:44
a聆听
回复 w***@sina.com: 楼主最后怎么解决的?
2023-05-23 10:20
zhengfuzhe
回复 w***@sina.com: 请问大佬是如何解决这个问题的
2023-08-25 02:39
bo808080
同问,这个如何解决?