Client and backend. This class is shared: the same code is compiled into your app and into your server, so everything on this page works in both.
public final class Watchdog
- Object
- Watchdog
The hardware watchdog, opened through Hardware.openWatchdog(int).
Once open, the device resets unless kick() is called within the
timeout. Kick it from a timer that only runs while the application is
healthy, so a hung event dispatch thread causes a reset:
try {
final Watchdog wd = Hardware.getInstance().openWatchdog(15);
UITimer.timer(5000, true, Display.getInstance().getCurrent(), () -> wd.kickQuietly());
} catch (HardwareException e) {
Log.e(e);
}
Methods
public void kick()
throws HardwareException | Restarts the countdown. |
public void kickQuietly() | kick(), ignoring failures, for use from a timer. |
public void close(boolean disarm) | Closes the watchdog. |
Inherited methods
Method details
kick
public void kick()
throws HardwareExceptionRestarts the countdown.
Throws
HardwareException- when the watchdog is closed or the kick fails
kickQuietly
public void kickQuietly()kick(), ignoring failures, for use from a timer.close
public void close(boolean disarm)Closes the watchdog. With
disarm the timer stops where the driver
allows it; without, the device resets when the timeout runs out, which
is the right choice on the way down after an unrecoverable error.