DAAPI B (b02)
- Java ME Embedded 3.3 Release

Package com.oracle.deviceaccess.watchdog

Interfaces and classes for using system watchdog timers (WDT).

See: Description

Package com.oracle.deviceaccess.watchdog Description

Interfaces and classes for using system watchdog timers (WDT).

A watchdog timer is used to reset/reboot the system in case of hang or critical failure. This is used to reset the system from a unresponsive state to a normal state. A watchdog timer can be set with a time interval for the reset/reboot. Continuously refreshing the watchdog timer within the specified time interval prevents the reset/reboot. If the watchdog timer has not been refreshed within the specified time interval a critical failure is assumed and a system reset/reboot is carried out.
A windowed watchdog timer must be refreshed within an open time window. If the watchdog is refreshed too soon - during the closed window - or if it is refreshed too late - after the watchdog timeout has expired - the device will be rebooted.

In order to use with a specific watchdog timer, an application should first open and obtain an WatchdogTimer instance for the watchdog timer the application wants to use, using its numerical ID, name, type (interface) and/or properties:

Using its ID
 WatchdogTimer wdt = (WatchdogTimer) PeripheralManager.open(8);
Using its name and interface
 WatchdogTimer wdt = (WatchdogTimer) PeripheralManager.open("WDT", WatchdogTimer.class, null);
Or for a windowed watchdog timer,
 WindowedWatchdogTimer wdt = (WindowedWatchdogTimer) PeripheralManager.open("WWDT", WindowedWatchdogTimer.class, null);
Once the peripheral opened, the application can start using it and can especially start the timer using the WatchdogTimer.start() method and subsequently refresh the timer periodically using the WatchdogTimer.refresh() method
When done, the application should call the WatchdogTimer.close() method to release the watchdog timer.

The following sample codes give examples of using the watchdog timer API:

 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.
                 // 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.


Watchdog timers are opened by invoking one of the com.oracle.deviceaccess.PeripheralManager.open methods. The "com.oracle.deviceaccess.watchdog" permission allows access to be granted to watchdog timers devices as a whole.
DAAPI B (b02)
5-February-2013 04:40

Copyright (c) 2012, Oracle and/or its affiliates. All Rights Reserved. Use of this specification is subject to license terms.