有线设备配网

更新时间:2024-05-14 02:37:22下载pdf

有线设备已通过网线连接着网络,设备激活过程中,用户无需输入路由器的名称和密码。

开始搜索

val scanKey = ThingActivatorCoreKit.getScanDeviceManager().startLocalGatewayDeviceSearch(
        millisTimeOut: Long,
        thingActivatorScanCallback: ThingActivatorScanCallback
    )

参数说明

参数 说明
millisTimeOut 搜索时,单位为毫秒(ms)
thingActivatorScanCallback 扫描结果回调

停止搜索

ThingActivatorCoreKit.getScanDeviceManager().stopScan(scanKey)

开始配网

val builder = ThingDeviceActiveBuilder()
            .setActiveModel(ThingDeviceActiveModeEnum.WN)
            .setContext(context)
          .setActivatorScanDeviceBean(scanDevicebean)
        .setTimeOut(timeout)
            .setListener(object : IThingDeviceActiveListener {
                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) {
                }
            })

val activeManager = ThingActivatorCoreKit.getActiveManager().newThingActiveManager()

activeManager.startActive(builder)

参数说明

参数 说明
thingActivatorScanDeviceBean 搜索返回的有线设备实体
timeout 配网超时时,单位为秒(s)
activeModel 配网能力枚举
listener 配网结果回调

结束配网

activeManager.startActive(builder)