Last Updated on : 2024-06-12 10:22:40download
Routers and Wi-Fi devices that have Pegasus pairing enabled can be used to pair other Wi-Fi devices.
Process
API description
/**
* Get activated devices with lightning activation support.
*
* @param homeId Home id.
* @return Device id list.
*/
ThingHomeSdk.getActivatorInstance().getSupportLightningActiveDevices(homeId)
Parameters
Parameter | Description |
---|---|
homeId | The home ID. |
Parameters
Parameter | Type | Description |
---|---|---|
devIds | List |
The list of devices that support Pegasus pairing. |
serverTimeout | long | The timeout value for the server to search for devices to be paired. Unit: seconds. |
clientTimeout | long | The timeout value for the client. Unit: seconds. |
IThingLightningSearchListener | Callback | The callback. |
Example
ThingHomeSdk.getActivatorInstance().newLightningActivator().startSearch(devList, serverTimeout, clientTimeout, new IThingLightningSearchListener() {
@Override
public void onSearchResponse(LightningSearchBean bean) {
// The search result.
}
});
IThingLightningActivator.stopSearch();
Parameter | Type | Description |
---|---|---|
devList | List |
The list of discovered devices that support Pegasus pairing. |
IThingLightningActivator.cancel(devList);
Process
Before the Pegasus pairing process, the SDK must get a pairing token from the cloud in the networked state. The token is valid for 10 minutes and expires immediately after the device is paired. A new token must be generated if the device needs to be paired again.
Parameters
Parameter | Type | Description |
---|---|---|
homeId | String | The home ID. For more information, see Home Management. |
Example
ThingHomeSdk.getActivatorInstance().getActivatorToken(homeId, new IThingActivatorGetToken() {
@Override
public void onSuccess(String token) {
}
@Override
public void onFailure(String errorCode, String errorMsg) {
}
});
Parameters
Parameter | Type | Description |
---|---|---|
lightningSearchBeanList | List |
The list of discovered devices that support Pegasus pairing. |
token | String | The pairing token. |
timeout | Int | The timeout value for pairing. Unit: seconds. Recommended value: 120 . |
IThingDevActivatorListener | Callback | The callback of the pairing result. |
Example
ThingHomeSdk.getActivatorInstance()
.newLightningActivator()
.startActive(new ThingLightningDevActivatorBuilder()
.setLightningSearchBeanList(lightningSearchBeans)
.setTimeOut(60 * 1000)
.setToken(token)
.setListener(new IThingDevActivatorListener() {
@Override
public void onError(String errorCode, String errorMsg) {
}
@Override
public void onActiveSuccess(DeviceBean devResp) {
}
}));
IThingLightningActivator.stopActive();
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback