disConnectBluetooth 断开蓝牙连接

disConnectBluetooth ^7.6.0

断开蓝牙连接

#请求参数

Prop Type Default Description
param Object mac: "xxxx"//蓝牙mac地址, 请求参数

#接口调用示例

this.$bridge
    .disConnectBluetooth(params)
    .then(res => {    
    this.$alert(res)
    })
    .catch(err => {
    this.$toast(err)
    })

#返回参数

  • 若是蓝牙意外断开,APP通知插件
// 设备状态推送,返回数据格式:
{ 
    messageType: "disConnectBluetooth",
    messageBody: { mac:"xxxx"} 
}

const globalEvent = weex.requireModule('globalEvent')
 
export default {
.....   
created() {
    // 监听设备状态推送
    globalEvent.addEventListener('receiveMessageFromApp', (response) => {
        // 业务逻辑
        let { messageType, messageBody } = response
        if (messageType == 'disConnectBluetooth'){
            console.log(messageBody)
        }
    })
}
.....
}
posted on 2024-12-16 09:43  AtlasLapetos  阅读(55)  评论(0)    收藏  举报