闪电搜索配网

更新时间:2024-05-14 02:45:59下载pdf

赋予闪电配网能力的路由器或 Wi-Fi 类设备,可以作为跳转路由,快速完成添加其他 Wi-Fi 类设备。

开始搜索

// Devices for Pegasus pairing found at home
ThingHomeSdk.getActivatorInstance().getSupportLightningActiveDevices(homeId)

val scanKey = ThingActivatorCoreKit.getScanDeviceManager().startLightningDeviceSearch(devIdList: List<String>? = null,
        millisTimeOut: Long,
        thingActivatorScanCallback: ThingActivatorScanCallback)

停止搜索

ThingActivatorCoreKit.getScanDeviceManager().stopScan(scankey)

参数说明

参数 说明
devIds 当前家庭中已配网的闪电设备
millisTimeOut 搜索时长,单位为毫秒(ms)
thingActivatorScanCallback 扫描结果回调

开始配网

val builder = ThingDeviceActiveBuilder()
        builder.lightningSearchBeans = lightningDeviceList
        builder.timeout = 120L
        builder.activeModel = ThingDeviceActiveModeEnum.Lightning
        builder.listener = object : IThingDeviceActiveListener {
            override fun onActiveError(errorBean: ThingDeviceActiveErrorBean) {

            }

            override fun onActiveLimited(limitBean: ThingDeviceActiveLimitBean) {

            }

            override fun onActiveSuccess(deviceBean: DeviceBean) {

            }

            override fun onBind(devId: String) {

            }

            override fun onFind(devId: String) {

            }

        }

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

activeManager.startActive(builder)

参数说明

参数 说明
lightningSearchBeans 搜索到的闪电设备列表
timeout 配网超时时长,单位为秒(s)
activeModel 配网能力枚举
listener 配网结果回调

停止配网

activeManager.stopActive()