mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
[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:
@@ -312,6 +312,29 @@ Java_org_wpilib_hardware_hal_DriverStationJNI_getMatchInfo
|
||||
return status;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_wpilib_hardware_hal_DriverStationJNI
|
||||
* Method: getGameData
|
||||
* Signature: (Ljava/lang/String;)Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_org_wpilib_hardware_hal_DriverStationJNI_getGameData
|
||||
(JNIEnv* env, jclass, jstring existing)
|
||||
{
|
||||
HAL_GameData gameData;
|
||||
HAL_GetGameData(&gameData);
|
||||
std::string_view newView{gameData.gameData};
|
||||
if (existing != nullptr) {
|
||||
// Load existing, see if it matches return old
|
||||
JStringRef existingStr{env, existing};
|
||||
std::string_view existingView{existingStr};
|
||||
if (existingView == newView) {
|
||||
return existing;
|
||||
}
|
||||
}
|
||||
return MakeJString(env, newView);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_wpilib_hardware_hal_DriverStationJNI
|
||||
* Method: sendError
|
||||
|
||||
Reference in New Issue
Block a user