disConnectBluetooth 断开蓝牙连接

disConnectBluetooth ^7.8

断开蓝牙连接

#请求参数

Prop Type Default Comment
mac String N/A //安卓:蓝牙 Mac 地址;iOS:外设 uuid

#引入接口模块

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

#接口调用示例

const params = {
  mac: '//安卓:蓝牙Mac地址;iOS:外设uuid',
}
bridge
  .disConnectBluetooth(params)
  .then((res) => {
    console.log(res)
  })
  .catch((err) => {
    console.log(err)
  })

#接口返回示例

//成功出参:通过全局事件receiveMessageFromApp输出

this.$bridge.addEventListener('receiveMessageFromApp', (res) => {
      console.log('xxxxxxxxxxxxx', res)
})
// res格式如下:
{
  messageType: 'disConnectBluetooth',  //H5用来判断消息类型,然后做相对应的处理
  messageBody: {"mac":"xxx"}  //安卓:蓝牙Mac地址;iOS:外设uuid
}
// 失败出参:
{
  errorCode:1//参数缺少mac、2未找到外设
  errorMsg:'失败原因描述'
}
posted on 2024-12-27 09:31  AtlasLapetos  阅读(14)  评论(0)    收藏  举报