001/*----------------------------------------------------------------------------*/
002/* Copyright (c) FIRST 2016-2017. All Rights Reserved.                        */
003/* Open Source Software - may be modified and shared by FRC teams. The code   */
004/* must be accompanied by the FIRST BSD license file in the root directory of */
005/* the project.                                                               */
006/*----------------------------------------------------------------------------*/
007
008package edu.wpi.first.wpilibj.hal;
009
010/**
011 * The NotifierJNI class directly wraps the C++ HAL Notifier.
012 *
013 * <p>This class is not meant for direct use by teams. Instead, the edu.wpi.first.wpilibj.Notifier
014 * class, which corresponds to the C++ Notifier class, should be used.
015 */
016public class NotifierJNI extends JNIWrapper {
017  /**
018   * Callback function.
019   */
020  public interface NotifierJNIHandlerFunction {
021    void apply(long curTime);
022  }
023
024  /**
025   * Initializes the notifier.
026   */
027  public static native int initializeNotifier(NotifierJNIHandlerFunction func);
028
029  /**
030   * Deletes the notifier object when we are done with it.
031   */
032  public static native void cleanNotifier(int notifierHandle);
033
034  /**
035   * Sets the notifier to call the callback in another triggerTime microseconds.
036   */
037  public static native void updateNotifierAlarm(int notifierHandle, long triggerTime);
038
039  /**
040   * Tells the notifier to stop calling the callback.
041   */
042  public static native void stopNotifierAlarm(int notifierHandle);
043}