connectBluetooth 连接蓝牙设备

connectBluetooth ^6.8

连接蓝牙设备

#请求参数

Prop Type Value Comment
deviceId String - 安卓参数名为 mac

#引入接口模块

import bridge from '@minix-iot/etsbridge-sdk'

#参数代码示例

let params = {
  deviceId: '20:f4:78:70:6d:ee',
}

#接口调用示例

bridge
  .startBluetoothDiscovery()
  .then((res) => {
    params.deviceId = res.deviceId
    this.$bridge
      .connectBluetooth(params)
      .then((res) => {
        console.log(res)
      })
      .catch((err) => {
        console.log(err)
      })
  })
  .catch((err) => {
    console.log(err)
  })

#返回参数

  • 成功时返回
Prop Type Comment
code Number 0
msg String' success

#返回示例

{
    "code": 0,
    "msg":"success"
}
posted on 2024-12-27 09:30  AtlasLapetos  阅读(6)  评论(0)    收藏  举报