Last Updated on : 2025-05-26 02:52:16download
This topic describes how to integrate remote device restart functionality, allowing device restart control by using the mobile app.
API description
abstract fun isSupportDeviceRestart(deviceId: String,callback: IThingResultCallback<Boolean>)
Parameters
Parameter | Description |
---|---|
deviceId | The device ID. |
callback | The callback function. |
Example
DeviceRestartServiceImpl.isSupportDeviceRestart(deviceId,object : IThingResultCallback<Boolean>{
override fun onSuccess(result: Boolean?) {
}
override fun onError(errorCode: String?, errorMessage: String?) {
}
})
API description
abstract fun rebootImmediately(deviceId: String, callback: IResultCallback
Parameters
Parameter | Description |
---|---|
deviceId | The device ID. |
callback | The callback function. |
Example
DeviceRestartServiceImpl.rebootImmediately(it,object : IResultCallback{
override fun onError(code: String?, error: String?) {
}
override fun onSuccess() {
}
})
API description
abstract fun addDeviceRebootTimer(
deviceId: String,
timer: DeviceTimerWrapperBean,
callback: IThingResultCallback<String>
)
Parameters
Parameter | Description |
---|---|
deviceId | The device ID. |
timer | The information about a scheduled task for restart. |
callback | The callback function. TID is returned. |
Parameters of the DeviceTimerWrapperBean
class:
Parameter | Description |
---|---|
time | The time in the format of HH:mm . |
loops | A 7-digit string composed of 0 or 1 , representing weekly repetition. The first digit indicates Sunday, the second digit indicates Monday, and so on. For example, 1000000 indicates repeat on Sunday, 1100000 indicates repeat on Sunday and Monday, 1111111 indicates repeat every day, and 0000000 indicates no repeat. |
status | The status. true : Enable the scheduled task. false : Disable the scheduled task. |
tid | The ID of the specified scheduled task. |
Example
DeviceRestartServiceImpl.addDeviceRebootTimer(
deviceId,
timerWrapperDemoBean!!,
object : IThingResultCallback<String> {
override fun onSuccess(result: String?) {
}
override fun onError(errorCode: String?, errorMessage: String?) {
}
})
API description
abstract fun updateDeviceRebootTimer(
deviceId: String,
timer: DeviceTimerWrapperBean,
callback: IResultCallback
)
Parameters
Parameter | Description |
---|---|
deviceId | The device ID. |
timer | The information about a scheduled task for restart. |
callback | The callback function. |
Example
DeviceRestartServiceImpl.updateDeviceRebootTimer(
deviceId,
timerWrapperDemoBean2,
object : IResultCallback {
override fun onSuccess() {
}
override fun onError(errorCode: String?, errorMessage: String?) {
}
})
API description
abstract fun getDeviceRebootTimer(
deviceId: String,
callback: IThingResultCallback<DeviceTimerWrapperBean>
)
Parameters
Parameter | Description |
---|---|
deviceId | The device ID. |
callback | The callback function. The details of the scheduled task will be returned. |
Example
DeviceRestartServiceImpl.getDeviceRebootTimer(it,object :IThingResultCallback<DeviceTimerWrapperBean>{
override fun onSuccess(result: DeviceTimerWrapperBean?) {
}
override fun onError(errorCode: String?, errorMessage: String?) {
}
})
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback