Class TrcWatchdogMgr.Watchdog

java.lang.Object
trclib.robotcore.TrcWatchdogMgr.Watchdog
Enclosing class:
TrcWatchdogMgr

public static class TrcWatchdogMgr.Watchdog extends Object
This class encapsulates the state of the watchdog. A watchdog has an identifiable name, an associated thread, a maximum time interval between which the heart beat must be received and the next heart beat expiraton time.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    This method returns the heart beat threshold time for the watchdog.
    void
    This method is called to pause watchdog monitoring.
    void
    This method is called to resume watchdog monitoring.
    void
    This method is called by the thread that registered the watchdog to send a heart beat.
    This method returns the string containing the info of the watchdog.
    boolean
    This method unregisters this watchdog from Watchdog Manager.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Method Details

    • pauseWatch

      public void pauseWatch()
      This method is called to pause watchdog monitoring. It is useful for a thread to call this before going into sleep or a wait knowing it won't be able to send periodic heartbeat to prevent a watchdog timeout.
    • resumeWatch

      public void resumeWatch()
      This method is called to resume watchdog monitoring. It is useful for a thread to call this right after waking up from a sleep or a wait so watchdog monitoring will be resumed.
    • sendHeartBeat

      public void sendHeartBeat()
      This method is called by the thread that registered the watchdog to send a heart beat. This will update the next heart beat expiration time.
    • unregister

      public boolean unregister()
      This method unregisters this watchdog from Watchdog Manager. Important: this method must be called in the thread the watchdog is monitoring. In other words, the caller's thread must be the owner of the watchdog.
      Returns:
      true if watchdog is unregistered successfully, false if watchdog does not exist.
    • toString

      public String toString()
      This method returns the string containing the info of the watchdog.
      Overrides:
      toString in class Object
      Returns:
      string form of the watchdog info.
    • getHeartBeatThreshold

      public double getHeartBeatThreshold()
      This method returns the heart beat threshold time for the watchdog.
      Returns:
      watchdog heart beat threshold time in seconds.