目录
兼容性:企业微信
获取蓝牙设备某个服务中的所有 characteristic(特征值)。
ww.getBLEDeviceCharacteristics({
deviceId: deviceId,
serviceId: serviceId
})
属性 | 类型 | 必填 | 说明 | |
---|---|---|---|---|
deviceId | string | 是 | 蓝牙设备 ID,需要已经通过 createBLEConnection 与对应设备建立链接 | |
serviceId | string | 是 | 蓝牙服务 uuid,需要通过 getBLEDeviceServices 接口获取 | |
success | Function | 否 | 成功回调 | |
fail | Function | 否 | 失败回调 | |
cancel | Function | 否 | 取消回调 | |
complete | Function | 否 | 完成回调 |
Promise<Object>
属性 | 类型 | 必填 | 说明 | ||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
errMsg | string | 是 | 通用错误信息 | ||||||||||||||||||||||||||||||||||||||||||||||
errCode | number | 是 | 通用错误码 | ||||||||||||||||||||||||||||||||||||||||||||||
characteristics | Object[] | 是 | 设备特征值列表 | ||||||||||||||||||||||||||||||||||||||||||||||
|
wx.getBLEDeviceCharacteristics({
// 这里的 deviceId 需要已经通过 createBLEConnection 与对应设备建立链接
deviceId,
// 这里的 serviceId 需要在 getBLEDeviceServices 接口中获取
serviceId,
success (res) {
console.log('device getBLEDeviceCharacteristics:', res.characteristics)
}
})