Last Updated on : 2024-07-15 09:53:05download
End users can switch to a new gateway if the current gateway fails. All the sub-device data and scene configuration on the failed device can be migrated to the new one without reconfiguration.
API description
/**
* Check support for replacing the faulty gateway
*
* @param gwId The ID of the new gateway
* @param listener boolean
*/
fun isSupportedMigrationWithGwId(gwId: String,listener: Business.ResultListener<Boolean>)
Parameters
Parameter | Type | Description |
---|---|---|
gwId | String | The ID of the new gateway. |
listener | ResultListener | Boolean callback |
Example
val manager = DeviceBusinessDataManager.getInstance().getMigrationManager()
manager.isSupportShareByDeviceId(devId, object : Business.ResultListener<Boolean?> {
override fun onFailure(
bizResponse: BusinessResponse?,
bizResult: Boolean?,
apiName: String?
) {
}
override fun onSuccess(
bizResponse: BusinessResponse?,
bizResult: Boolean?,
apiName: String?
) {
}
})
API description
/**
* Query the list of faulty gateways
*
* @param gwId The ID of the new gateway
* @param gid The ID of the current space
* @param listener Return data structure: ["xxxxx"] is the device ID or SN of the faulty gateway.
*/
fun getEnableMigratedGatewayList(
gwId: String,
gid: Long,
listener: Business.ResultListener<ArrayList<String>>
)
Parameters
Parameter | Type | Description |
---|---|---|
gwId | String | The ID of the new gateway. |
gid | Long | The ID of the current space. |
listener | ResultListener | ArrayList<String> callback. |
Example
val manager = DeviceBusinessDataManager.getInstance().getMigrationManager()
manager.getEnableMigratedGatewayList("devId", gid, object : Business.ResultListener<ArrayList<String?>> {
override fun onFailure(
bizResponse: BusinessResponse,
bizResult: ArrayList<String?>,
apiName: String
) {
}
override fun onSuccess(
bizResponse: BusinessResponse,
bizResult: ArrayList<String?>,
apiName: String
) {
}
})
API description
/**
* Start replacing faulty gateway
*
* @param sourcesGwId The ID of the new gateway
* @param targetGwId The ID or SN of the faulty gateway
* @param gid The ID of the current space
* @param listener MigrationInfo
*/
fun startMigrateGateway(
sourcesGwId: String,
targetGwId: String,
gid: Long,
listener: Business.ResultListener<MigrationInfo?>
)
Parameters
Parameter | Type | Description |
---|---|---|
sourcesGwId | String | The ID of the new gateway. |
targetGwId | String | The ID or SN of the faulty gateway. |
gid | Long | The ID of the current space. |
listener | ResultListener | MigrationInfo callback. |
Example
val manager = DeviceBusinessDataManager.getInstance().getMigrationManager()
manager.startMigrateGateway("sourcesGwId", "targetGwId", gid,object : Business.ResultListener<MigrationInfo?> {
override fun onFailure(
bizResponse: BusinessResponse,
bizResult: MigrationInfo?,
apiName: String
) {
}
override fun onSuccess(
bizResponse: BusinessResponse,
bizResult: MigrationInfo?,
apiName: String
) {
}
})
Return data
MigrationInfo
class
Property | Type | Description |
---|---|---|
sourceGwId | String | The ID of the new gateway. |
targetGwId | String | The ID or SN of the faulty gateway. |
API description
/**
* Check replacement status
*
* @param gwId The ID of the new gateway
* @param listener MigrationInfo
*/
fun getMigratedGwState(gwId: String, listener: Business.ResultListener<MigrationInfo?>)
Parameters
Parameter | Type | Description |
---|---|---|
sourcesGwId | String | The ID of the new gateway. |
callback | ResultListener | MigrationInfo callback. |
Example
val manager = DeviceBusinessDataManager.getInstance().getMigrationManager()
manager.getMigratedGwState("sourcesGwId", object : Business.ResultListener<MigrationInfo?> {
override fun onFailure(
bizResponse: BusinessResponse,
bizResult: MigrationInfo?,
apiName: String
) {
}
override fun onSuccess(
bizResponse: BusinessResponse,
bizResult: MigrationInfo?,
apiName: String
) {
}
})
Return data
MigrationInfo
class
Property | Type | Description |
---|---|---|
status | String | Replacement status:
|
sourceGwId | String | The ID of the new gateway. |
targetGwId | String | The ID or SN of the faulty gateway. |
targetGwName | String | The name of the faulty gateway. |
currentTimeMillis | long | The current timestamp. |
failedCode | String | The error code. |
API description
/**
* Register the replacement status listener
*
* @param listener IMigratedStateListener
*/
fun addMigratedStateListener(listener: IMigratedStateListener)
/**
* Unregister the replacement status listener
*
* @param listener IMigratedStateListener
*/
fun removeMigratedStateListener(listener: IMigratedStateListener)
Parameters
Parameter | Type | Description |
---|---|---|
backupList | List | The list of alternative networks. |
listener | IMigratedStateListener | MigrationInfo callback. |
Example
val manager = DeviceBusinessDataManager.getInstance().getDeviceNetSetManager("deviceId")
val listener = object :IMigratedStateListener{
override fun onMigratedStateChange(migrationInfo: MigrationInfo?) {
}
}
manager.addMigratedStateListener(listener)
manager.removeMigratedStateListener(listener)
Return data
MigrationInfo
class
Property | Type | Description |
---|---|---|
status | String | Replacement status:
|
sourceGwId | String | The ID of the new gateway. |
targetGwId | String | The ID or SN of the faulty gateway. |
targetGwName | String | The name of the faulty gateway. |
currentTimeMillis | long | The current timestamp. |
failedCode | String | The error code. |
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback