Last Updated on : 2024-05-27 05:40:17download
This topic describes pairing a device using the Wi-Fi EZ mode, also known as Wi-Fi Easy Connect or SmartConfig. In the pairing process, a mobile phone connects to the router and broadcasts the Wi-Fi credentials and pairing token to enable the smart device to get this information for connection and pairing. It is easy-to-use, but has compatibility requirements for mobile phones and routers. The success rate is lower than that of AP mode.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
mode |
ActivatorMode |
Yes | The pairing mode. |
Example
EZActivator ezActivator = (EZActivator) ActivatorService.activator(ActivatorMode.EZ);
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
assetId | String | Yes | The ID of the specified asset or space. |
callback | IndustryDataCallBack | Yes | The callback. |
Example
// Get the asset activation token.
ActivatorService.activatorToken("assetId", new IndustryDataCallBack<String>() {
@Override
public void onSuccess(String s) {
Log.d(TAG, "onSuccess: " + s);
}
@Override
public void onFailure(@NonNull String s, @NonNull String s1) {
Log.d(TAG, "onFailure: " + s);
}
});
Parameters
Parameter | Type | Description |
---|---|---|
ssid | String | The SSID of the Wi-Fi network. |
password | String | The password of the Wi-Fi network. |
token | String | The token. |
Example
WiFiActivatorParams params = new WiFiActivatorParams.Builder()
.setWifi("your_ssid", "your_password")
.setToken("your_token")
.build();
IActivatorListener
to listen for pairing resultIDevice
object
Method | Description |
---|---|
getDeviceId(): String | The device ID. |
getUUID(): String | The UUID of the device. |
getName(): String | The name of the device. |
getIcon(): String | The device icon. |
getProductId(): String | The product ID. |
getCategory(): String | The abbreviation of the product category. For example, kg for a switch and cz for a socket. For more information, see Standard Instruction Set. |
getCapability(): Int | The networking capability. Valid values:
|
getProtocolAttribute(): Long | The protocol support. |
getTimezoneId(): String | The time zone of the device. |
isCloudOnline(): Boolean | The connection status of the device on the internet. |
isLocalOnline(): Boolean | The connection status of the device on the LAN. |
isOnline(): Boolean | Indicates whether the device is online on the LAN or internet. |
getLatitude(): String | The latitude of the device. |
getLongitude(): String | The longitude of the device. |
getDps(): Map<String, Any> | Get the data point (DP) of the device. |
publishDps(dps: DpCommand, callback: IndustryCallBack) | Control a DP. |
getSchemas(): Map<String, DpSchema> | Get the DP schema. |
addDeviceListener(listener: IDeviceListener) | Set a device listener. |
removeDeviceListener(listener: IDeviceListener) | Remove a device listener. |
getWifiSignalStrength(callback: IndustryValueCallBack |
Get the Wi-Fi signal strength. |
getDevAttribute(): Long | Device capability flags:
|
newOtaManager(): IDeviceOtaManager | Get the device OTA management instance. |
newBackupManager(): IDeviceWifiBackupManager | The alternative Wi-Fi network. To check if this feature is supported, review the bit12 value returned by getDevAttribute() . |
Example
ezActivator.setListener(new IActivatorListener() {
@Override
public void onSuccess(@Nullable IDevice iDevice) {
Log.d(TAG, "onSuccess: ");
}
@Override
public void onError(@NonNull String s, @NonNull String s1) {
Log.d(TAG, "onError: ");
}
});
Example
ezActivator.start();
Example
ezActivator.stop();
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback