Last Updated on : 2024-07-15 09:39:58download
Users might change the Wi-Fi network credentials (SSID and password) regularly for security purposes. Without the alternative Wi-Fi network feature, users have to pair all smart devices again. The alternative Wi-Fi network feature allows users to preset multiple sets of Wi-Fi network credentials. When the current Wi-Fi network is unavailable, the device will attempt to connect using one of the preset credentials.
API description
/**
* Get the device's current network information
*
* @param callback The callback.
*/
fun getDeviceCurrentNetInfo(callback: IThingDataCallback<CurrentWifiInfoBean?>)
Parameters
Parameter | Type | Description |
---|---|---|
callback | IThingDataCallback | CurrentWifiInfoBean callback. |
Example
val manager = DeviceBusinessDataManager.getInstance().getDeviceNetSetManager("deviceId")
manager.getDeviceCurrentNetInfo(object :IThingDataCallback<CurrentWifiInfoBean?>{
override fun onSuccess(result: CurrentWifiInfoBean?) {
}
override fun onError(errorCode: String?, errorMessage: String?) {
}
})
Return data (CurrentWifiInfoBean
class)
Property | Type | Description |
---|---|---|
ssid | String | The SSID of the Wi-Fi network. |
signal | int | The Wi-Fi signal strength. |
network | int | The network type.
|
version | int | The protocol version. |
hash | String | The hash value of the Wi-Fi network. |
originJSONString | String | The original data reported by the device, including the fields above. |
API description
/**
* Get the list of alternative networks
*
* @param callback The callback.
*/
fun getDeviceBackupWiFiList(callback: IThingDataCallback<BackupWifiListInfo?>)
Parameters
Parameter | Type | Description |
---|---|---|
callback | IThingDataCallback | BackupWifiListInfo callback. |
Example
val manager = DeviceBusinessDataManager.getInstance().getDeviceNetSetManager("deviceId")
manager.getDeviceBackupWiFiList(object :IThingDataCallback<BackupWifiListInfo?>{
override fun onSuccess(result: BackupWifiListInfo?) {
}
override fun onError(errorCode: String?, errorMessage: String?) {
}
})
Return data
BackupWifiListInfo
class
Property | Type | Description |
---|---|---|
maxNum | String | The maximum number of SSIDs that the device can store. |
backupList | List | The list of alternative networks. |
BackupWifiBean
class
Property | Type | Description |
---|---|---|
ssid | String | The SSID of the Wi-Fi network. |
passwd | String | The password of the Wi-Fi network. |
hash | String | The hash value of the Wi-Fi network. |
API description
/**
* Update the list of alternative networks
*
* @param backupWifiList List<BackupWifiBean>
* @param callback The callback.
*/
fun updateDeviceBackupWiFiList(
backupWifiList: List<BackupWifiBean>?,
callback: IThingDataCallback<BackupWifiResultBean?>
)
Parameters
Parameter | Type | Description |
---|---|---|
backupList | List | The list of alternative networks. |
callback | IThingDataCallback | BackupWifiResultBean callback. |
Example
val manager = DeviceBusinessDataManager.getInstance().getDeviceNetSetManager("deviceId")
manager.updateDeviceBackupWiFiList(arrayListOf(),object :IThingDataCallback<BackupWifiResultBean?>{
override fun onSuccess(result: BackupWifiResultBean?) {
}
override fun onError(errorCode: String?, errorMessage: String?) {
}
})
Return data
BackupWifiResultBean
class
Property | Type | Description |
---|---|---|
ssid | String | The SSID of the Wi-Fi network. |
resCode | int | The code returned by the device.
|
ssidList | List | The SSID of the alternative Wi-Fi network. |
API description
/**
* Connect the device to a new Wi-Fi network other than the alternative networks
*
* @param ssid The Wi-Fi SSID.
* @param pwd The Wi-Fi password.
* @param callback The callback.
*/
fun switchToNewWifi(
ssid: String?,
pwd: String?,
callback: IThingDataCallback<SwitchWifiResultBean?>
)
Parameters
Parameter | Type | Description |
---|---|---|
backupList | List | The list of alternative networks. |
callback | IThingDataCallback | BackupWifiResultBean callback. |
Example
val manager = DeviceBusinessDataManager.getInstance().getDeviceNetSetManager("deviceId")
manager.switchToNewWifi("ssid","pwd",object :IThingDataCallback<SwitchWifiResultBean?>{
override fun onSuccess(result: SwitchWifiResultBean?) {
}
override fun onError(errorCode: String?, errorMessage: String?) {
}
})
Return data
SwitchWifiResultBean
class
Property | Type | Description |
---|---|---|
ssid | String | The SSID of the Wi-Fi network. |
resCode | int | The code returned by the device.
|
API description
/**
* Connect the device to an alternative Wi-Fi network
*
* @param ssid The Wi-Fi SSID.
* @param pwd The Wi-Fi password.
* @param callback The callback.
*/
fun switchToNewWifi(
ssid: String?,
pwd: String?,
callback: IThingDataCallback<SwitchWifiResultBean?>
)
Parameters
Parameter | Type | Description |
---|---|---|
backupList | List | The list of alternative networks. |
callback | IThingDataCallback | BackupWifiResultBean callback. |
Example
val manager = DeviceBusinessDataManager.getInstance().getDeviceNetSetManager("deviceId")
manager.switchToBackupWifi("hash",object :IThingDataCallback<SwitchWifiResultBean?>{
override fun onSuccess(result: SwitchWifiResultBean?) {
}
override fun onError(errorCode: String?, errorMessage: String?) {
}
})
Return data
SwitchWifiResultBean
class
Property | Type | Description |
---|---|---|
ssid | String | The SSID of the Wi-Fi network. |
resCode | int | The code returned by the device.
|
API description
/**
* Check support for updating the alternative network list
*
* @param bean CurrentWifiInfoBean
* @return true: Support. false: Not support.
*/
fun canUpdateDeviceBackupWiFiList(bean: CurrentWifiInfoBean): Boolean
Parameters
Parameter | Type | Description |
---|---|---|
bean | CurrentWifiInfoBean | The current network information. |
Example
val manager = DeviceBusinessDataManager.getInstance().getDeviceNetSetManager("deviceId")
manager.canUpdateDeviceBackupWiFiList(CurrentWifiInfoBean())
API description
/**
* Check support for automatic network switching
*
* @param bean CurrentWifiInfoBean
* @return true: Support. false: Not support.
*/
fun canSwitchDeviceWiFi(bean: CurrentWifiInfoBean): Boolean
Parameters
Parameter | Type | Description |
---|---|---|
bean | CurrentWifiInfoBean | The current network information. |
Example
val manager = DeviceBusinessDataManager.getInstance().getDeviceNetSetManager("deviceId")
manager.canSwitchDeviceWiFi(CurrentWifiInfoBean())
API description
/**
* Check support for alternative networks
*
* @return true: Support. false: Not support.
*/
fun isSupportBackupNetwork(): Boolean
Example
val manager = DeviceBusinessDataManager.getInstance().getDeviceNetSetManager("deviceId")
manager.isSupportBackupNetwork()
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback