connectBluetooth 连接蓝牙设备

connectBluetooth ^7.6

连接蓝牙设备

#请求参数

Prop Type Value
mac String "xxxx"//蓝牙mac地址(ios是uuid)
moduleType Number 0;//ms

#参数代码示例

    let params = {
        mac: 'xxxx',
        moduleType:0
    }

#接口调用示例

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

#返回参数

  • 成功时返回

#返回示例

callback:{
    errorCode:0 //连接成功
}
callbackFail:{
    errorCode:1,
    errorMsg:"失败原因描述"
}
posted on 2024-12-16 09:44  AtlasLapetos  阅读(13)  评论(0)    收藏  举报