mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
[hal] Add GetTeamNumber (#5596)
This commit is contained in:
@@ -57,6 +57,15 @@ public final class RobotController {
|
||||
return HALUtil.getComments();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the team number configured for the robot controller.
|
||||
*
|
||||
* @return team number, or 0 if not found.
|
||||
*/
|
||||
public static int getTeamNumber() {
|
||||
return HALUtil.getTeamNumber();
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the microsecond timer from the FPGA.
|
||||
*
|
||||
|
||||
@@ -557,6 +557,38 @@ public final class RoboRioSim {
|
||||
RoboRioDataJNI.setCPUTemp(cpuTemp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a callback to be run whenever the team number changes.
|
||||
*
|
||||
* @param callback the callback
|
||||
* @param initialNotify whether to call the callback with the initial state
|
||||
* @return the {@link CallbackStore} object associated with this callback. Save a reference to
|
||||
* this object so GC doesn't cancel the callback.
|
||||
*/
|
||||
public static CallbackStore registerTeamNumberCallback(
|
||||
NotifyCallback callback, boolean initialNotify) {
|
||||
int uid = RoboRioDataJNI.registerTeamNumberCallback(callback, initialNotify);
|
||||
return new CallbackStore(uid, RoboRioDataJNI::cancelTeamNumberCallback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the team number.
|
||||
*
|
||||
* @return the team number.
|
||||
*/
|
||||
public static int getTeamNumber() {
|
||||
return RoboRioDataJNI.getTeamNumber();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the team number.
|
||||
*
|
||||
* @param teamNumber the new team number.
|
||||
*/
|
||||
public static void setTeamNumber(int teamNumber) {
|
||||
RoboRioDataJNI.setTeamNumber(teamNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the serial number.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user