Sub-Device Pairing

Last Updated on : 2024-05-17 03:05:56download

Sub-device pairing can be initiated only when a gateway is online in the cloud, and the sub-device stays in the pairing state. This topic describes the process to pair a sub-device that is connected through a Zigbee gateway.

Initialize pairing parameters

API description

ThingGwSubDevActivatorBuilder builder = new ThingGwSubDevActivatorBuilder()
		.setDevId(mDevId)
		.setTimeOut(timeout)
		.setListener(new IThingSmartActivatorListener() {

				@Override
				public void onError(String errorCode, String errorMsg) {

				}

				@Override
				public void onActiveSuccess(DeviceBean devResp) {

				}

				@Override
				public void onStep(String step, Object data) {

				}
			}
		));

Parameters

Parameter Description
mDevId The gateway ID.
timeout The timeout value of a pairing task. Default value: 100. Unit: seconds.

Call the pairing method

IThingActivator mThingGWSubActivator = ThingHomeSdk.getActivatorInstance().newGwSubDevActivator(builder);
// Starts pairing.
mThingGWSubActivator.start();
// Stops pairing.
mThingGWSubActivator.stop();
// Destroys the pairing task.
mThingGWSubActivator.onDestory();