Wired Device Pairing

Last Updated on : 2024-05-14 02:37:43download

A wired device connects to a router over an Ethernet cable. During the pairing process, users do not need to enter the name and password of the router.

Start searching

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

Parameter description

Parameters Description
millisTimeOut The search timeout value, in milliseconds.
thingActivatorScanCallback The callback for the result.

Stop searching

ThingActivatorCoreKit.getScanDeviceManager().stopScan(scanKey)

Start pairing

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)

Parameter description

Parameters Description
thingActivatorScanDeviceBean The discovered wired device.
timeout The pairing timeout value, in seconds.
activeModel The pairing capability enum.
listener The callback for the result of pairing.

Finish pairing

activeManager.startActive(builder)