同步操作将从 OpenHarmony/docs 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
Figure 1 illustrates the process of using a watchdog.
Figure 1 Process of using a watchdog
Use WatchdogOpen to open a watchdog. A system may have multiple watchdogs. You can open a specified watchdog by using the ID.
int32_t WatchdogOpen(int16_t wdtId);
Table 1 Description of WatchdogOpen
struct DevHandle *handle = NULL;
handle = WatchdogOpen(0); /* Open watchdog 0.*/
if (handle == NULL) {
HDF_LOGE("WatchdogOpen: failed, ret %d\n", ret);
return;
}
int32_t WatchdogGetStatus(struct DevHandle *handle, int32_t *status);
Table 2 Description of WatchdogGetStatus
int32_t ret;
int32_t status;
/* Obtain the watchdog status. */
ret = WatchdogGetStatus(handle, &status);
if (ret != 0) {
HDF_LOGE("WatchdogGetStatus: failed, ret %d\n", ret);
return;
}
int32_t WatchdogSetTimeout(PalHandle *handle, uint32_t seconds);
Table 3 Description of WatchdogSetTimeout
int32_t ret;
uint32_t timeOut = 60;
/* Set the timeout duration, in seconds. */
ret = WatchdogSetTimeout(handle, timeOut);
if (ret != 0) {
HDF_LOGE("WatchdogSetTimeout: failed, ret %d\n", ret);
return;
}
int32_t WatchdogGetTimeout(PalHandle *handle, uint32_t *seconds);
Table 4 Description of WatchdogGetTimeout
int32_t ret;
uint32_t timeOut;
/* Obtain the timeout duration, in seconds. */
ret = WatchdogGetTimeout(handle, &timeOut);
if (ret != 0) {
HDF_LOGE("WatchdogGetTimeout: failed, ret %d\n", ret);
return;
}
int32_t WatchdogStart(struct DevHandle *handle);
Table 5 Description of WatchdogStart
int32_t ret;
/* Start the watchdog. */
ret = WatchdogStart(handle);
if (ret != 0) {
HDF_LOGE("WatchdogStart: failed, ret %d\n", ret);
return;
}
int32_t WatchdogFeed(struct DevHandle *handle);
Table 6 Description of WatchdogFeed
int32_t ret;
/* Feed the watchdog. */
ret = WatchdogFeed(handle);
if (ret != 0) {
HDF_LOGE("WatchdogFeed: failed, ret %d\n", ret);
return;
}
int32_t WatchdogStop(struct DevHandle *handle);
Table 7 Description of WatchdogStop
int32_t ret;
/* Stop the watchdog. */
ret = WatchdogStop(handle);
if (ret != 0) {
HDF_LOGE("WatchdogStop: failed, ret %d\n", ret);
return;
}
If the watchdog is no longer required, call WatchdogClose to close the watchdog handle.
void WatchdogClose(struct DevHandle *handle);
Table 8 Description of WatchdogClose
/* Close the watchdog. */
ret = WatchdogClose(handle);
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。