See: Description
Interface | Description |
---|---|
WatchdogTimer |
The
WatchdogTimer interface provides methods for controlling a watchdog timer that can be used to force the
device to reboot (or depending on the platform, the Java Virtual Machine to restart). |
WindowedWatchdogTimer |
The
WindowedWatchdogTimer interface provides methods for controlling a watchdog timer that can be used to
force the device to reboot (or depending on the platform, the Java Virtual Machine to restart). |
WatchdogTimer
instance for the watchdog timer the application wants to use,
using its numerical ID, name, type (interface) and/or properties:
WatchdogTimer wdt = (WatchdogTimer) PeripheralManager.open(8);
Or for a windowed watchdog timer,WatchdogTimer wdt = (WatchdogTimer) PeripheralManager.open("WDT", WatchdogTimer.class, null);
WindowedWatchdogTimer wdt = (WindowedWatchdogTimer) PeripheralManager.open("WWDT", WindowedWatchdogTimer.class, null);
WatchdogTimer.start()
method and subsequently
refresh the timer periodically using the WatchdogTimer.refresh()
method When done, the application should call thewdt.start(1000); ... wdt.refresh();
WatchdogTimer.close()
method to release the watchdog
timer. The following sample codes give examples of using the watchdog timer API:wdt.close();
public class WatchdogSample { public boolean checkSomeStatus() { // check some status.... // if status is ok then return true to kick watch dog timer. return true; } public void test_loop() { WatchdogTimer watchdogTimer = (WatchdogTimer) PeripheralManager.open(WDT_ID); watchdogTimer.start(180000); // Start watch dog timer with 3 min duration. while (true) { if (checkSomeStatus() == true) { // Everything goes fine, timer will be kick. watchdogTimer.refresh(); // do something more... } else { // Something goes wrong. Timer will not be kick. // If status not recovered within 2-3 turns then system will be reboot. } sleep(60000); // sleep for 1 min. } } }
com.oracle.deviceaccess.PeripheralManager.open
methods. The "com.oracle.deviceaccess.watchdog"
permission
allows access to be granted to watchdog timers devices as a whole.Copyright (c) 2012, Oracle and/or its affiliates. All Rights Reserved. Use of this specification is subject to license terms.