请扫码查看示例
 # readBlueToothData ^7.8
读取蓝牙数据
# 请求参数
| Prop | Type | Default | Comment | 
|---|---|---|---|
| mac | String | N/A | 安卓:蓝牙 Mac 地址;iOS:外设 uuid | 
| serviceUuid | String | N/A | 服务通道的 uuid | 
| readUuid | String | N/A | 写通道的 uuid | 
# 引入接口模块
import bridge from '@minix-iot/etsbridge-sdk'
1
# 接口调用示例
const params = {
  mac: '安卓:蓝牙Mac地址;iOS:外设uuid',
  serviceUuid: '服务通道的uuid',
  readUuid: '写通道的uuid',
}
bridge
  .readBlueToothData(params)
  .then((res) => {
    console.log(res)
  })
  .catch((err) => {
    console.log(err)
  })
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
# 接口返回示例
// 通过事件回调方式返回。
receiveMessageFromApp({
  messageType: 'receivebuletoothData',
  messageBody: {
    mac: 'xxx',
    data: 'xxx',
    serviceUuid: xxx,
    readUuid: xxx,
  },
})
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10