Class NotifierJNI

java.lang.Object
org.wpilib.hardware.hal.JNIWrapper
org.wpilib.hardware.hal.NotifierJNI

public class NotifierJNI extends JNIWrapper
The NotifierJNI class directly wraps the C++ HAL Notifier.

This class is not meant for direct use by teams. Instead, the org.wpilib.system.Notifier class, which corresponds to the C++ Notifier class, should be used.

See Also:
  • "wpi/hal/Notifier.h"
  • Method Details

    • createNotifier

      public static int createNotifier()
      Creates a notifier.

      A notifier is an timer that alarms at an initial and (optionally) repeated intervals. This can be used to make precise control loops.

      Returns:
      the created notifier
      See Also:
      • "HAL_CreateNotifier"
    • setNotifierName

      public static void setNotifierName(int notifierHandle, String name)
      Sets the name of the notifier.
      Parameters:
      notifierHandle - Notifier handle.
      name - Notifier name.
      See Also:
      • "HAL_SetNotifierName"
    • destroyNotifier

      public static void destroyNotifier(int notifierHandle)
      Destroys a notifier.

      Destruction wakes up any waiters.

      Parameters:
      notifierHandle - the notifier handle
      See Also:
      • "HAL_DestroyNotifier"
    • setNotifierAlarm

      public static void setNotifierAlarm(int notifierHandle, long alarmTime, long intervalTime, boolean absolute, boolean ack)
      Updates the initial and interval alarm times for a notifier.

      The alarmTime is an absolute time (using the WPI now() time base) if absolute is true, or relative to the current time if absolute is false.

      If intervalTime is non-zero, the notifier will alarm periodically following alarmTime at the given interval.

      If an absolute alarmTime is in the past, the notifier will alarm immediately.

      Parameters:
      notifierHandle - the notifier handle
      alarmTime - the first alarm time (in microseconds)
      intervalTime - the periodic interval time (in microseconds)
      absolute - true if the alarm time is absolute
      ack - true to acknowledge any prior alarm
      See Also:
      • "HAL_SetNotifierAlarm"
    • cancelNotifierAlarm

      public static void cancelNotifierAlarm(int notifierHandle, boolean ack)
      Cancels all future notifier alarms for a notifier.
      Parameters:
      notifierHandle - the notifier handle
      ack - true to acknowledge any prior alarm
      See Also:
      • "HAL_CancelNotifierAlarm"
    • acknowledgeNotifierAlarm

      public static void acknowledgeNotifierAlarm(int notifierHandle)
      Indicates the notifier alarm has been serviced. Makes no change to future alarms.

      One of setNotifierAlarm (with ack=true), cancelNotifierAlarm (with ack=true), or this function must be called before waiting for the next alarm.

      Parameters:
      notifierHandle - the notifier handle
      See Also:
      • "HAL_AcknowledgeNotifierAlarm"
    • getNotifierOverrun

      public static int getNotifierOverrun(int notifierHandle)
      Gets the overrun count for a notifier.

      An overrun occurs when a notifier's alarm is not serviced before the next scheduled alarm time.

      Parameters:
      notifierHandle - the notifier handle
      Returns:
      overrun count