ios端使用uni.writeBLECharacteristicValue 向设备发送关机指令后没有success或fail 或complete回调,安卓则正常。
{
"device_id": "***3EDAF3",
"service_id": "***805F9B34FB",
"characteristic_id": "0000FFF2-0000-1000-8000-00805F9B34FB",
"command": "a***023000cd",
"exec": "function() { [native code] }"
}
{
"properties": {
"indicate": false,
"notify": false,
"read": false,
"write": true
},
"uuid": "0000FFF2-0000-1000-8000-00805F9B34FB"
}
使用的框架是uniapp
uni.writeBLECharacteristicValue({
writeType:'write',
deviceId: params.device_id, // 这里的 deviceId 需要已经通过 createBLEConnection 与对应设备建立链接
serviceId: params.service_id, // 这里的 serviceId 需要在 getBLEDeviceServices 接口中获取
characteristicId: params.characteristic_id, // 这里的 characteristicId 需要在 getBLEDeviceCharacteristics 接口中获取
value: hexStringToBuffer(params.command),// 这里的value是ArrayBuffer类型
success: (res) => {
console.log('writeBLECharacteristicValue success', res.errMsg)
},
fail: (res) => {
console.log('writeBLECharacteristicValue fail:', res)
},
complete: (res) => {
console.log('writeBLECharacteristicValue complete:', res)
}
})
原生代码片段可以复现吗