mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
[sim] Remove index from RoboRIO simulation interface (#2567)
This commit is contained in:
@@ -10,180 +10,192 @@ package edu.wpi.first.wpilibj.simulation;
|
||||
import edu.wpi.first.hal.simulation.NotifyCallback;
|
||||
import edu.wpi.first.hal.simulation.RoboRioDataJNI;
|
||||
|
||||
@SuppressWarnings({"PMD.ExcessivePublicCount", "PMD.TooManyMethods"})
|
||||
/**
|
||||
* Class to control a simulated RoboRIO.
|
||||
*/
|
||||
@SuppressWarnings({"PMD.ExcessivePublicCount", "PMD.TooManyMethods", "PMD.UseUtilityClass"})
|
||||
public class RoboRioSim {
|
||||
private final int m_index;
|
||||
|
||||
public RoboRioSim(int index) {
|
||||
m_index = index;
|
||||
public static CallbackStore registerFPGAButtonCallback(NotifyCallback callback,
|
||||
boolean initialNotify) {
|
||||
int uid = RoboRioDataJNI.registerFPGAButtonCallback(callback, initialNotify);
|
||||
return new CallbackStore(uid, RoboRioDataJNI::cancelFPGAButtonCallback);
|
||||
}
|
||||
public static boolean getFPGAButton() {
|
||||
return RoboRioDataJNI.getFPGAButton();
|
||||
}
|
||||
public static void setFPGAButton(boolean fPGAButton) {
|
||||
RoboRioDataJNI.setFPGAButton(fPGAButton);
|
||||
}
|
||||
|
||||
public CallbackStore registerFPGAButtonCallback(NotifyCallback callback, boolean initialNotify) {
|
||||
int uid = RoboRioDataJNI.registerFPGAButtonCallback(m_index, callback, initialNotify);
|
||||
return new CallbackStore(m_index, uid, RoboRioDataJNI::cancelFPGAButtonCallback);
|
||||
public static CallbackStore registerVInVoltageCallback(NotifyCallback callback,
|
||||
boolean initialNotify) {
|
||||
int uid = RoboRioDataJNI.registerVInVoltageCallback(callback, initialNotify);
|
||||
return new CallbackStore(uid, RoboRioDataJNI::cancelVInVoltageCallback);
|
||||
}
|
||||
public boolean getFPGAButton() {
|
||||
return RoboRioDataJNI.getFPGAButton(m_index);
|
||||
public static double getVInVoltage() {
|
||||
return RoboRioDataJNI.getVInVoltage();
|
||||
}
|
||||
public void setFPGAButton(boolean fPGAButton) {
|
||||
RoboRioDataJNI.setFPGAButton(m_index, fPGAButton);
|
||||
public static void setVInVoltage(double vInVoltage) {
|
||||
RoboRioDataJNI.setVInVoltage(vInVoltage);
|
||||
}
|
||||
|
||||
public CallbackStore registerVInVoltageCallback(NotifyCallback callback, boolean initialNotify) {
|
||||
int uid = RoboRioDataJNI.registerVInVoltageCallback(m_index, callback, initialNotify);
|
||||
return new CallbackStore(m_index, uid, RoboRioDataJNI::cancelVInVoltageCallback);
|
||||
public static CallbackStore registerVInCurrentCallback(NotifyCallback callback,
|
||||
boolean initialNotify) {
|
||||
int uid = RoboRioDataJNI.registerVInCurrentCallback(callback, initialNotify);
|
||||
return new CallbackStore(uid, RoboRioDataJNI::cancelVInCurrentCallback);
|
||||
}
|
||||
public double getVInVoltage() {
|
||||
return RoboRioDataJNI.getVInVoltage(m_index);
|
||||
public static double getVInCurrent() {
|
||||
return RoboRioDataJNI.getVInCurrent();
|
||||
}
|
||||
public void setVInVoltage(double vInVoltage) {
|
||||
RoboRioDataJNI.setVInVoltage(m_index, vInVoltage);
|
||||
public static void setVInCurrent(double vInCurrent) {
|
||||
RoboRioDataJNI.setVInCurrent(vInCurrent);
|
||||
}
|
||||
|
||||
public CallbackStore registerVInCurrentCallback(NotifyCallback callback, boolean initialNotify) {
|
||||
int uid = RoboRioDataJNI.registerVInCurrentCallback(m_index, callback, initialNotify);
|
||||
return new CallbackStore(m_index, uid, RoboRioDataJNI::cancelVInCurrentCallback);
|
||||
public static CallbackStore registerUserVoltage6VCallback(NotifyCallback callback,
|
||||
boolean initialNotify) {
|
||||
int uid = RoboRioDataJNI.registerUserVoltage6VCallback(callback, initialNotify);
|
||||
return new CallbackStore(uid, RoboRioDataJNI::cancelUserVoltage6VCallback);
|
||||
}
|
||||
public double getVInCurrent() {
|
||||
return RoboRioDataJNI.getVInCurrent(m_index);
|
||||
public static double getUserVoltage6V() {
|
||||
return RoboRioDataJNI.getUserVoltage6V();
|
||||
}
|
||||
public void setVInCurrent(double vInCurrent) {
|
||||
RoboRioDataJNI.setVInCurrent(m_index, vInCurrent);
|
||||
public static void setUserVoltage6V(double userVoltage6V) {
|
||||
RoboRioDataJNI.setUserVoltage6V(userVoltage6V);
|
||||
}
|
||||
|
||||
public CallbackStore registerUserVoltage6VCallback(NotifyCallback callback, boolean initialNotify) {
|
||||
int uid = RoboRioDataJNI.registerUserVoltage6VCallback(m_index, callback, initialNotify);
|
||||
return new CallbackStore(m_index, uid, RoboRioDataJNI::cancelUserVoltage6VCallback);
|
||||
public static CallbackStore registerUserCurrent6VCallback(NotifyCallback callback,
|
||||
boolean initialNotify) {
|
||||
int uid = RoboRioDataJNI.registerUserCurrent6VCallback(callback, initialNotify);
|
||||
return new CallbackStore(uid, RoboRioDataJNI::cancelUserCurrent6VCallback);
|
||||
}
|
||||
public double getUserVoltage6V() {
|
||||
return RoboRioDataJNI.getUserVoltage6V(m_index);
|
||||
public static double getUserCurrent6V() {
|
||||
return RoboRioDataJNI.getUserCurrent6V();
|
||||
}
|
||||
public void setUserVoltage6V(double userVoltage6V) {
|
||||
RoboRioDataJNI.setUserVoltage6V(m_index, userVoltage6V);
|
||||
public static void setUserCurrent6V(double userCurrent6V) {
|
||||
RoboRioDataJNI.setUserCurrent6V(userCurrent6V);
|
||||
}
|
||||
|
||||
public CallbackStore registerUserCurrent6VCallback(NotifyCallback callback, boolean initialNotify) {
|
||||
int uid = RoboRioDataJNI.registerUserCurrent6VCallback(m_index, callback, initialNotify);
|
||||
return new CallbackStore(m_index, uid, RoboRioDataJNI::cancelUserCurrent6VCallback);
|
||||
public static CallbackStore registerUserActive6VCallback(NotifyCallback callback,
|
||||
boolean initialNotify) {
|
||||
int uid = RoboRioDataJNI.registerUserActive6VCallback(callback, initialNotify);
|
||||
return new CallbackStore(uid, RoboRioDataJNI::cancelUserActive6VCallback);
|
||||
}
|
||||
public double getUserCurrent6V() {
|
||||
return RoboRioDataJNI.getUserCurrent6V(m_index);
|
||||
public static boolean getUserActive6V() {
|
||||
return RoboRioDataJNI.getUserActive6V();
|
||||
}
|
||||
public void setUserCurrent6V(double userCurrent6V) {
|
||||
RoboRioDataJNI.setUserCurrent6V(m_index, userCurrent6V);
|
||||
public static void setUserActive6V(boolean userActive6V) {
|
||||
RoboRioDataJNI.setUserActive6V(userActive6V);
|
||||
}
|
||||
|
||||
public CallbackStore registerUserActive6VCallback(NotifyCallback callback, boolean initialNotify) {
|
||||
int uid = RoboRioDataJNI.registerUserActive6VCallback(m_index, callback, initialNotify);
|
||||
return new CallbackStore(m_index, uid, RoboRioDataJNI::cancelUserActive6VCallback);
|
||||
public static CallbackStore registerUserVoltage5VCallback(NotifyCallback callback,
|
||||
boolean initialNotify) {
|
||||
int uid = RoboRioDataJNI.registerUserVoltage5VCallback(callback, initialNotify);
|
||||
return new CallbackStore(uid, RoboRioDataJNI::cancelUserVoltage5VCallback);
|
||||
}
|
||||
public boolean getUserActive6V() {
|
||||
return RoboRioDataJNI.getUserActive6V(m_index);
|
||||
public static double getUserVoltage5V() {
|
||||
return RoboRioDataJNI.getUserVoltage5V();
|
||||
}
|
||||
public void setUserActive6V(boolean userActive6V) {
|
||||
RoboRioDataJNI.setUserActive6V(m_index, userActive6V);
|
||||
public static void setUserVoltage5V(double userVoltage5V) {
|
||||
RoboRioDataJNI.setUserVoltage5V(userVoltage5V);
|
||||
}
|
||||
|
||||
public CallbackStore registerUserVoltage5VCallback(NotifyCallback callback, boolean initialNotify) {
|
||||
int uid = RoboRioDataJNI.registerUserVoltage5VCallback(m_index, callback, initialNotify);
|
||||
return new CallbackStore(m_index, uid, RoboRioDataJNI::cancelUserVoltage5VCallback);
|
||||
public static CallbackStore registerUserCurrent5VCallback(NotifyCallback callback,
|
||||
boolean initialNotify) {
|
||||
int uid = RoboRioDataJNI.registerUserCurrent5VCallback(callback, initialNotify);
|
||||
return new CallbackStore(uid, RoboRioDataJNI::cancelUserCurrent5VCallback);
|
||||
}
|
||||
public double getUserVoltage5V() {
|
||||
return RoboRioDataJNI.getUserVoltage5V(m_index);
|
||||
public static double getUserCurrent5V() {
|
||||
return RoboRioDataJNI.getUserCurrent5V();
|
||||
}
|
||||
public void setUserVoltage5V(double userVoltage5V) {
|
||||
RoboRioDataJNI.setUserVoltage5V(m_index, userVoltage5V);
|
||||
public static void setUserCurrent5V(double userCurrent5V) {
|
||||
RoboRioDataJNI.setUserCurrent5V(userCurrent5V);
|
||||
}
|
||||
|
||||
public CallbackStore registerUserCurrent5VCallback(NotifyCallback callback, boolean initialNotify) {
|
||||
int uid = RoboRioDataJNI.registerUserCurrent5VCallback(m_index, callback, initialNotify);
|
||||
return new CallbackStore(m_index, uid, RoboRioDataJNI::cancelUserCurrent5VCallback);
|
||||
public static CallbackStore registerUserActive5VCallback(NotifyCallback callback,
|
||||
boolean initialNotify) {
|
||||
int uid = RoboRioDataJNI.registerUserActive5VCallback(callback, initialNotify);
|
||||
return new CallbackStore(uid, RoboRioDataJNI::cancelUserActive5VCallback);
|
||||
}
|
||||
public double getUserCurrent5V() {
|
||||
return RoboRioDataJNI.getUserCurrent5V(m_index);
|
||||
public static boolean getUserActive5V() {
|
||||
return RoboRioDataJNI.getUserActive5V();
|
||||
}
|
||||
public void setUserCurrent5V(double userCurrent5V) {
|
||||
RoboRioDataJNI.setUserCurrent5V(m_index, userCurrent5V);
|
||||
public static void setUserActive5V(boolean userActive5V) {
|
||||
RoboRioDataJNI.setUserActive5V(userActive5V);
|
||||
}
|
||||
|
||||
public CallbackStore registerUserActive5VCallback(NotifyCallback callback, boolean initialNotify) {
|
||||
int uid = RoboRioDataJNI.registerUserActive5VCallback(m_index, callback, initialNotify);
|
||||
return new CallbackStore(m_index, uid, RoboRioDataJNI::cancelUserActive5VCallback);
|
||||
public static CallbackStore registerUserVoltage3V3Callback(NotifyCallback callback,
|
||||
boolean initialNotify) {
|
||||
int uid = RoboRioDataJNI.registerUserVoltage3V3Callback(callback, initialNotify);
|
||||
return new CallbackStore(uid, RoboRioDataJNI::cancelUserVoltage3V3Callback);
|
||||
}
|
||||
public boolean getUserActive5V() {
|
||||
return RoboRioDataJNI.getUserActive5V(m_index);
|
||||
public static double getUserVoltage3V3() {
|
||||
return RoboRioDataJNI.getUserVoltage3V3();
|
||||
}
|
||||
public void setUserActive5V(boolean userActive5V) {
|
||||
RoboRioDataJNI.setUserActive5V(m_index, userActive5V);
|
||||
public static void setUserVoltage3V3(double userVoltage3V3) {
|
||||
RoboRioDataJNI.setUserVoltage3V3(userVoltage3V3);
|
||||
}
|
||||
|
||||
public CallbackStore registerUserVoltage3V3Callback(NotifyCallback callback, boolean initialNotify) {
|
||||
int uid = RoboRioDataJNI.registerUserVoltage3V3Callback(m_index, callback, initialNotify);
|
||||
return new CallbackStore(m_index, uid, RoboRioDataJNI::cancelUserVoltage3V3Callback);
|
||||
public static CallbackStore registerUserCurrent3V3Callback(NotifyCallback callback,
|
||||
boolean initialNotify) {
|
||||
int uid = RoboRioDataJNI.registerUserCurrent3V3Callback(callback, initialNotify);
|
||||
return new CallbackStore(uid, RoboRioDataJNI::cancelUserCurrent3V3Callback);
|
||||
}
|
||||
public double getUserVoltage3V3() {
|
||||
return RoboRioDataJNI.getUserVoltage3V3(m_index);
|
||||
public static double getUserCurrent3V3() {
|
||||
return RoboRioDataJNI.getUserCurrent3V3();
|
||||
}
|
||||
public void setUserVoltage3V3(double userVoltage3V3) {
|
||||
RoboRioDataJNI.setUserVoltage3V3(m_index, userVoltage3V3);
|
||||
public static void setUserCurrent3V3(double userCurrent3V3) {
|
||||
RoboRioDataJNI.setUserCurrent3V3(userCurrent3V3);
|
||||
}
|
||||
|
||||
public CallbackStore registerUserCurrent3V3Callback(NotifyCallback callback, boolean initialNotify) {
|
||||
int uid = RoboRioDataJNI.registerUserCurrent3V3Callback(m_index, callback, initialNotify);
|
||||
return new CallbackStore(m_index, uid, RoboRioDataJNI::cancelUserCurrent3V3Callback);
|
||||
public static CallbackStore registerUserActive3V3Callback(NotifyCallback callback,
|
||||
boolean initialNotify) {
|
||||
int uid = RoboRioDataJNI.registerUserActive3V3Callback(callback, initialNotify);
|
||||
return new CallbackStore(uid, RoboRioDataJNI::cancelUserActive3V3Callback);
|
||||
}
|
||||
public double getUserCurrent3V3() {
|
||||
return RoboRioDataJNI.getUserCurrent3V3(m_index);
|
||||
public static boolean getUserActive3V3() {
|
||||
return RoboRioDataJNI.getUserActive3V3();
|
||||
}
|
||||
public void setUserCurrent3V3(double userCurrent3V3) {
|
||||
RoboRioDataJNI.setUserCurrent3V3(m_index, userCurrent3V3);
|
||||
public static void setUserActive3V3(boolean userActive3V3) {
|
||||
RoboRioDataJNI.setUserActive3V3(userActive3V3);
|
||||
}
|
||||
|
||||
public CallbackStore registerUserActive3V3Callback(NotifyCallback callback, boolean initialNotify) {
|
||||
int uid = RoboRioDataJNI.registerUserActive3V3Callback(m_index, callback, initialNotify);
|
||||
return new CallbackStore(m_index, uid, RoboRioDataJNI::cancelUserActive3V3Callback);
|
||||
public static CallbackStore registerUserFaults6VCallback(NotifyCallback callback,
|
||||
boolean initialNotify) {
|
||||
int uid = RoboRioDataJNI.registerUserFaults6VCallback(callback, initialNotify);
|
||||
return new CallbackStore(uid, RoboRioDataJNI::cancelUserFaults6VCallback);
|
||||
}
|
||||
public boolean getUserActive3V3() {
|
||||
return RoboRioDataJNI.getUserActive3V3(m_index);
|
||||
public static int getUserFaults6V() {
|
||||
return RoboRioDataJNI.getUserFaults6V();
|
||||
}
|
||||
public void setUserActive3V3(boolean userActive3V3) {
|
||||
RoboRioDataJNI.setUserActive3V3(m_index, userActive3V3);
|
||||
public static void setUserFaults6V(int userFaults6V) {
|
||||
RoboRioDataJNI.setUserFaults6V(userFaults6V);
|
||||
}
|
||||
|
||||
public CallbackStore registerUserFaults6VCallback(NotifyCallback callback, boolean initialNotify) {
|
||||
int uid = RoboRioDataJNI.registerUserFaults6VCallback(m_index, callback, initialNotify);
|
||||
return new CallbackStore(m_index, uid, RoboRioDataJNI::cancelUserFaults6VCallback);
|
||||
public static CallbackStore registerUserFaults5VCallback(NotifyCallback callback,
|
||||
boolean initialNotify) {
|
||||
int uid = RoboRioDataJNI.registerUserFaults5VCallback(callback, initialNotify);
|
||||
return new CallbackStore(uid, RoboRioDataJNI::cancelUserFaults5VCallback);
|
||||
}
|
||||
public int getUserFaults6V() {
|
||||
return RoboRioDataJNI.getUserFaults6V(m_index);
|
||||
public static int getUserFaults5V() {
|
||||
return RoboRioDataJNI.getUserFaults5V();
|
||||
}
|
||||
public void setUserFaults6V(int userFaults6V) {
|
||||
RoboRioDataJNI.setUserFaults6V(m_index, userFaults6V);
|
||||
public static void setUserFaults5V(int userFaults5V) {
|
||||
RoboRioDataJNI.setUserFaults5V(userFaults5V);
|
||||
}
|
||||
|
||||
public CallbackStore registerUserFaults5VCallback(NotifyCallback callback, boolean initialNotify) {
|
||||
int uid = RoboRioDataJNI.registerUserFaults5VCallback(m_index, callback, initialNotify);
|
||||
return new CallbackStore(m_index, uid, RoboRioDataJNI::cancelUserFaults5VCallback);
|
||||
public static CallbackStore registerUserFaults3V3Callback(NotifyCallback callback,
|
||||
boolean initialNotify) {
|
||||
int uid = RoboRioDataJNI.registerUserFaults3V3Callback(callback, initialNotify);
|
||||
return new CallbackStore(uid, RoboRioDataJNI::cancelUserFaults3V3Callback);
|
||||
}
|
||||
public int getUserFaults5V() {
|
||||
return RoboRioDataJNI.getUserFaults5V(m_index);
|
||||
public static int getUserFaults3V3() {
|
||||
return RoboRioDataJNI.getUserFaults3V3();
|
||||
}
|
||||
public void setUserFaults5V(int userFaults5V) {
|
||||
RoboRioDataJNI.setUserFaults5V(m_index, userFaults5V);
|
||||
public static void setUserFaults3V3(int userFaults3V3) {
|
||||
RoboRioDataJNI.setUserFaults3V3(userFaults3V3);
|
||||
}
|
||||
|
||||
public CallbackStore registerUserFaults3V3Callback(NotifyCallback callback, boolean initialNotify) {
|
||||
int uid = RoboRioDataJNI.registerUserFaults3V3Callback(m_index, callback, initialNotify);
|
||||
return new CallbackStore(m_index, uid, RoboRioDataJNI::cancelUserFaults3V3Callback);
|
||||
}
|
||||
public int getUserFaults3V3() {
|
||||
return RoboRioDataJNI.getUserFaults3V3(m_index);
|
||||
}
|
||||
public void setUserFaults3V3(int userFaults3V3) {
|
||||
RoboRioDataJNI.setUserFaults3V3(m_index, userFaults3V3);
|
||||
}
|
||||
|
||||
public void resetData() {
|
||||
RoboRioDataJNI.resetData(m_index);
|
||||
public static void resetData() {
|
||||
RoboRioDataJNI.resetData();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user