[hal,wpilib] Switch to new game data (#8584)

Game data is now limited to 8 bytes, and comes through the UDP packets.
This commit is contained in:
Thad House
2026-02-06 21:38:15 -08:00
committed by GitHub
parent ac45c694f3
commit 85adbf990e
45 changed files with 820 additions and 695 deletions

View File

@@ -18,7 +18,7 @@ class MatchInfoDataTest {
@Test
void testSetMatchInfo() {
MatchType matchType = MatchType.Qualification;
DriverStationDataJNI.setMatchInfo("Event Name", "Game Message", 174, 191, matchType.ordinal());
DriverStationDataJNI.setMatchInfo("Event Name", 174, 191, matchType.ordinal());
DriverStationSim.notifyNewData();
@@ -29,7 +29,6 @@ class MatchInfoDataTest {
() -> assertEquals("Event Name", outMatchInfo.eventName),
() -> assertEquals(matchType.ordinal(), outMatchInfo.matchType),
() -> assertEquals(174, outMatchInfo.matchNumber),
() -> assertEquals(191, outMatchInfo.replayNumber),
() -> assertEquals("Game Message", outMatchInfo.gameSpecificMessage));
() -> assertEquals(191, outMatchInfo.replayNumber));
}
}

View File

@@ -262,14 +262,36 @@ class DriverStationSimTest {
}
@Test
void testSetGameSpecificMessage() {
void testSetGameData() {
HAL.initialize(500, 0);
DriverStationSim.resetData();
final String message = "Hello World!";
DriverStationSim.setGameSpecificMessage(message);
final String message = "Hello";
DriverStationSim.setGameData(message);
DriverStationSim.notifyNewData();
assertEquals(message, DriverStation.getGameSpecificMessage());
var gameData = DriverStation.getGameData();
assertTrue(gameData.isPresent());
assertEquals(message, gameData.get());
}
@Test
void testSetGameDataEmpty() {
HAL.initialize(500, 0);
DriverStationSim.resetData();
DriverStationSim.setGameData("");
DriverStationSim.notifyNewData();
assertTrue(DriverStation.getGameData().isEmpty());
}
@Test
void testSetGameDataNull() {
HAL.initialize(500, 0);
DriverStationSim.resetData();
DriverStationSim.setGameData(null);
DriverStationSim.notifyNewData();
assertTrue(DriverStation.getGameData().isEmpty());
}
@Test