001// Copyright (c) FIRST and other WPILib contributors.
002// Open Source Software; you can modify and/or share it under the terms of
003// the WPILib BSD license file in the root directory of this project.
004
005package edu.wpi.first.hal.simulation;
006
007import edu.wpi.first.hal.JNIWrapper;
008
009/** JNI for accelerometer data. */
010public class AccelerometerDataJNI extends JNIWrapper {
011  /**
012   * Register a callback to be run when this accelerometer activates.
013   *
014   * @param index the index
015   * @param callback the callback
016   * @param initialNotify whether to run the callback with the initial state
017   * @return the CallbackStore object associated with this callback
018   */
019  public static native int registerActiveCallback(
020      int index, NotifyCallback callback, boolean initialNotify);
021
022  public static native void cancelActiveCallback(int index, int uid);
023
024  public static native boolean getActive(int index);
025
026  public static native void setActive(int index, boolean active);
027
028  public static native int registerRangeCallback(
029      int index, NotifyCallback callback, boolean initialNotify);
030
031  public static native void cancelRangeCallback(int index, int uid);
032
033  public static native int getRange(int index);
034
035  public static native void setRange(int index, int range);
036
037  public static native int registerXCallback(
038      int index, NotifyCallback callback, boolean initialNotify);
039
040  public static native void cancelXCallback(int index, int uid);
041
042  public static native double getX(int index);
043
044  public static native void setX(int index, double x);
045
046  public static native int registerYCallback(
047      int index, NotifyCallback callback, boolean initialNotify);
048
049  public static native void cancelYCallback(int index, int uid);
050
051  public static native double getY(int index);
052
053  public static native void setY(int index, double y);
054
055  public static native int registerZCallback(
056      int index, NotifyCallback callback, boolean initialNotify);
057
058  public static native void cancelZCallback(int index, int uid);
059
060  public static native double getZ(int index);
061
062  public static native void setZ(int index, double z);
063
064  public static native void resetData(int index);
065
066  /** Utility class. */
067  private AccelerometerDataJNI() {}
068}