更新时间:2024-05-14 02:38:48下载pdf
扫码配网是一种通过扫描设备二维码的方式来实现 单设备 快速配网的方式。目前支持的类型有直连设备和蓝牙设备。
ThingActivatorCoreKit.getCommonBizOpt().parseQrCode("qrcodeurl", new Business.ResultListener<ScanActionBean>() {
@Override
public void onFailure(BusinessResponse bizResponse, ScanActionBean bizResult, String apiName) {
}
@Override
public void onSuccess(BusinessResponse bizResponse, ScanActionBean bizResult, String apiName) {
}
});
参数说明
参数 | 说明 |
---|---|
qrcodeurl | 二维码字符串 |
ScanActionBean
参数说明
参数 | 说明 |
---|---|
actionName | 扫码类型
|
actionData | 设备信息 |
val builder = ThingDeviceActiveBuilder()
.setActiveModel(ThingDeviceActiveModeEnum.QR)
.setContext(context)
.setUuid(uuid)
.setRelationId(homeId)
.setTimeOut(timeout)
.setListener(object : IThingDeviceStatePauseActiveListener {
override fun onFind(devId: String) {
}
override fun onBind(devId: String) {
}
override fun onActiveSuccess(deviceBean: DeviceBean) {
}
override fun onActiveError(errorBean: ThingDeviceActiveErrorBean) {
}
override fun onActiveLimited(limitBean: ThingDeviceActiveLimitBean) {
}
override fun onActivatorStatePauseCallback(stateData: PauseStateData?) {
}
})
val activeManager = ThingActivatorCoreKit.getActiveManager().newThingActiveManager()
activeManager.startActive(builder)
参数说明
参数 | 说明 |
---|---|
context | 上下文 |
uuid | 扫码结果信息中设备唯一标识 |
relationId | 设备绑定到的家庭 ID |
timeout | 超时时,单位为秒(s) |
activeModel | 配网能力枚举 |
listener | 配网结果回调 |
val builder = ThingDeviceActiveBuilder()
.setActiveModel(ThingDeviceActiveModeEnum.BT_QRCODE)
.setUuid(uuid)
.setMac(mac)
.setRelationId(homeId)
.setTimeOut(timeout)
.setListener(object : IThingDeviceStatePauseActiveListener {
override fun onFind(devId: String) {
}
override fun onBind(devId: String) {
}
override fun onActiveSuccess(deviceBean: DeviceBean) {
}
override fun onActiveError(errorBean: ThingDeviceActiveErrorBean) {
}
override fun onActiveLimited(limitBean: ThingDeviceActiveLimitBean) {
}
override fun onActivatorStatePauseCallback(stateData: PauseStateData?) {
}
})
val activeManager = ThingActivatorCoreKit.getActiveManager().newThingActiveManager()
activeManager.startActive(builder)
参数说明
参数 | 说明 |
---|---|
mac | 扫码结果中设备 Mac 地址 |
uuid | 扫码结果信息中设备唯一标识 |
relationId | 设备绑定到的家庭 ID |
timeout | 超时时,单位为秒(s) |
activeModel | 配网能力枚举 |
listener | 配网结果回调 |
activeManager.stopActive()
该内容对您有帮助吗?
是意见反馈该内容对您有帮助吗?
是意见反馈