disconnectDevice
断开设备
import { MEngineerKit } from "@yl/super-jssdk"
MEngineerKit.disconnectDevice(optional)
参数说明
| 参数 |
类型 |
必填 |
作用 |
| optional |
Object |
是 |
必填参数 |
optional
| 参数 |
类型 |
必填 |
作用 |
| device |
object |
是 |
要断开连接的设备 |
device参数说明
| 参数 |
类型 |
必填 |
作用 |
| name |
string |
是 |
设备名称 |
| timeout |
number |
否 |
连接设备超时时间,单位ms,默认10000,连接发起时有效,传0表示持续搜索 |
返回说明
| 参数 |
类型 |
作用 |
| resolve |
Function |
成功回调,array为搜索到设备列表,例:[{"name" : "T7","address":"设备地址"},...] |
| reject(err) |
Function |
失败回调,err为详细错误信息,是一个json对象,例如:{"errCode":-1,"errMsg":"出错啦"} |
代码示例
MEngineerKit.disconnectDevice()
.then(() => {
console.log('');
})
.catch(err => {
console.log('插件调用失败:', err)
})