写二进制输入提示无权限

- 发布:2020-07-03 14:12
- 更新:2022-12-22 21:03
- 阅读:4461
产品分类: uniapp/App
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: 10
HBuilderX类型: 正式
HBuilderX版本号: 2.7.14
手机系统: Android
手机系统版本号: Android 9.0
手机厂商: 华为
手机机型: 三部不同型号的华为
页面类型: vue
nvue编译模式: fast
打包方式: 云端
项目创建方式: HBuilderX
操作步骤:
预期结果:
正常写入
正常写入
实际结果:
无权限
无权限
bug描述:
再开发低功耗蓝牙时,发现同样代码,再苹果app端正常,小程序IOS和安卓也正常,但在安卓APP端写入二进制数据时出错
{
"errMsg": "writeBLECharacteristicValue:fail property not support",
"errCode": 10007
}
读到的characteristics是有写权限的
{
"characteristics": [{
"uuid": "000003F0-0000-1000-8000-00805F9B34FB",
"properties": {
"read": true,
"write": true,
"notify": true,
"indicate": true
}
}],
"errMsg": "getBLEDeviceCharacteristics:ok"
}

1***@163.com - Grady123
经过各种尝试垂死挣扎终止找到不报10007的方法了,太坑了,在notifyBLECharacteristicValueChange启动成功后再延时写入就可以了

三段码农 (作者) - 从5+到uniapp,6年开发,一路成长。
到目前仍无解···
-
-
-
-
-
-
三段码农 (作者)
回复 DCloud_Android_zl: 刚试了下 开启uni.notifyBLECharacteristicValueChange后,加上延迟超过300毫秒蓝牙就断开了,求帮助
2020-07-17 10:46
-
三段码农 (作者)
回复 DCloud_Android_zl: 老大可以看下这个 https://ask.dcloud.net.cn/question/101191?item_id=132458&rf=false 会不会有关
2020-07-17 11:15
-
-
-

我的问题也是和你一样,采用plus.Bluetooth 来操作也是一样的,特征值是可以写入的[{"uuid":"0000FEE2-0000-1000-8000-00805F9B34FB","properties":{"read":false,"write":true,"notify":false,"indicate":false}},{"uuid":"0000FEE1-0000-1000-8000-00805F9B34FB","properties":{"read":false,"write":false,"notify":true,"indicate":false}}]。
-
-
-
-
回复 DCloud_Android_zl: 最新版本依然出现此问题,用uni或plus.Bluetooth,操作都会如此,只有安卓系统才会出现这样
2020-09-21 09:55
-
回复 DCloud_Android_zl: 2.9.3的版本也是一样的,获取到的characteristicId是true,writeBLECharacteristicValue()里面有成功有失败成功{"errMsg":"writeBLECharacteristicValue:ok"} at pages/myCenter/blueTooth/newBluetooth.js:513
11:05:57.228 成功{"errMsg":"writeBLECharacteristicValue:ok"} at pages/myCenter/blueTooth/newBluetooth.js:513
11:05:57.248 成功{"errMsg":"writeBLECharacteristicValue:ok"} at pages/myCenter/blueTooth/newBluetooth.js:513
11:05:57.268 成功{"errMsg":"writeBLECharacteristicValue:ok"} at pages/myCenter/blueTooth/newBluetooth.js:513
11:05:57.288 成功{"errMsg":"writeBLECharacteristicValue:ok"} at pages/myCenter/blueTooth/newBluetooth.js:513
11:05:57.308 失败{"errMsg":"writeBLECharacteristicValue:fail property not support","errCode":10007} at pages/myCenter/blueTooth/newBluetooth.js:531
11:05:57.328 成功{"errMsg":"writeBLECharacteristicValue:ok"} at pages/myCenter/blueTooth/newBluetooth.js:513
11:05:57.348 失败{"errMsg":"writeBLECharacteristicValue:fail property not support","errCode":10007} at pages/myCenter/blueTooth/newBluetooth.js:531
11:05:57.368 成功{"errMsg":"writeBLECharacteristicValue:ok"} at pages/myCenter/blueTooth/newBluetooth.js:513
11:05:57.388 成功{"errMsg":"writeBLECharacteristicValue:ok"} at pages/myCenter/blueTooth/newBluetooth.js:513
11:05:57.408 成功{"errMsg":"writeBLECharacteristicValue:ok"} at pages/myCenter/blueTooth/newBluetooth.js:513
11:05:57.428 成功{"errMsg":"writeBLECharacteristicValue:ok"} at pages/myCenter/blueTooth/newBluetooth.js:5132020-11-05 11:10
-
回复 DCloud_Android_zl: 小程序跟ios都不会,安卓手机我试了三台都一样,会出现"errMsg":"writeBLECharacteristicValue:fail property not support","errCode":10007
2020-11-05 11:12

HBuilder 3.1.2 版本依然有这个问题,已经排除了蓝牙芯片的问题,app连接芯片10次,差不多有3次会有这个问题
{
"errMsg": "writeBLECharacteristicValue:fail property not support",
"errCode": 10007,
"code": 10007
}

1***@qq.com - 被遗忘的程序员
我知道了,分享出来把。
部分手机报10007
uni.writeBLECharacteristicValue({
deviceId: _deviceId,
serviceId: _serviceId,
characteristicId: _characteristicId,
value: buffer,
success(res) {
setTimeout(() => {
realWriteData(sendloop, i + 1);
}, 10);//就是这里需要加延时,具体原因不清楚,等大神解释吧
},
fail (res) {
console.log(res)
},
})

楼里有小伙伴解决的吗?我这边时而出现。
{
"errMsg": "writeBLECharacteristicValue:fail property not support",
"errCode": 10007,
"code": 10007
}
9***@qq.com
啥意思啊,咋弄的啊
2021-05-31 16:18
2***@qq.com
请问这个是如何解决的?
2021-06-08 13:45
m***@126.com
具体怎么弄啊 可以贴一下关键代码吗
2021-06-22 13:46
x***@163.com
老哥,我们也卡在这了,能不能详细说一下怎么解决的?
2021-06-30 17:08
2***@qq.com
牛逼,兄弟,百度了一下午,终于解决了,使用这个uni.setBLEMTU(OBJECT)就行了
2022-09-26 19:33