Last Updated on : 2024-05-27 06:06:49download
Sub-device pairing can be initiated only when a gateway is online in the cloud, and the sub-device stays in pairing mode. This topic describes how to pair a sub-device, using the Zigbee sub-device as an example.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
mode |
ActivatorMode |
Yes | The pairing mode. |
Example
ZigbeeActivator zigbeeActivator = (ZigbeeActivator) ActivatorService.activator(ActivatorMode.Zigbee);
IActivatorListener
to listen for pairing resultParameters
Parameter | Type | Required | Description |
---|---|---|---|
listener | IActivatorListener | Yes | Listen for callback |
Example
zigbeeActivator.setListener(new IActivatorListener() {
@Override
public void onSuccess(@Nullable IDevice iDevice) {
Log.d(TAG, "onSuccess: ");
if (null != iDevice){
// The ID of the gateway device.
iDevice.getDeviceId();
}
}
@Override
public void onError(@NonNull String s, @NonNull String s1) {
Log.d(TAG, "onError: " + s);
}
});
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
gwDeviceId | String | Yes | The ID of the gateway. |
time | int | Yes | Set the timeout. |
Example
ZigbeeActivatorParams zigbeeActivatorParams = new ZigbeeActivatorParams.Builder()
.setGwDeviceId(gwDeviceId)
.setTimeout(time)
.build();
zigbeeActivator.setParams(zigbeeActivatorParams);
This method starts device pairing.
Example
zigbeeActivator.start();
This method stops device pairing.
Example
zigbeeActivator.stop();
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback