Pegasus Pairing

Last Updated on : 2024-05-14 02:46:14download

Routers and Wi-Fi devices that have Pegasus pairing enabled can be used to pair other Wi-Fi devices.

Start searching

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

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

Stop searching

ThingActivatorCoreKit.getScanDeviceManager().stopScan(scankey)

Parameter description

Parameters Description
devIds The Pegasus server (a device that is paired) in the current home.
millisTimeOut The search timeout value, in milliseconds.
thingActivatorScanCallback The callback for the result.

Start pairing

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)

Parameter description

Parameters Description
lightningSearchBeans The list of discovered Pegasus devices.
timeout The pairing timeout value, in seconds.
activeModel The pairing capability enum.
listener The callback for the result of pairing.

Stop pairing

activeManager.stopActive()