From 8992dcdc99360f083bb7a90be769ce6f5641d599 Mon Sep 17 00:00:00 2001 From: Jade Date: Thu, 23 Oct 2025 09:43:29 +0800 Subject: [PATCH] [wpilib] Remove Driverstation.waitForDsConnection (#8288) Signed-off-by: Jade Turner --- wpilibc/src/main/native/cpp/DriverStation.cpp | 14 ---------- .../main/native/include/frc/DriverStation.h | 8 ------ .../edu/wpi/first/wpilibj/DriverStation.java | 27 ------------------- 3 files changed, 49 deletions(-) diff --git a/wpilibc/src/main/native/cpp/DriverStation.cpp b/wpilibc/src/main/native/cpp/DriverStation.cpp index 5facc78925..6aa5f57b40 100644 --- a/wpilibc/src/main/native/cpp/DriverStation.cpp +++ b/wpilibc/src/main/native/cpp/DriverStation.cpp @@ -575,20 +575,6 @@ std::optional DriverStation::GetLocation() { } } -bool DriverStation::WaitForDsConnection(units::second_t timeout) { - wpi::Event event{true, false}; - HAL_ProvideNewDataEventHandle(event.GetHandle()); - bool result = false; - if (timeout == 0_s) { - result = wpi::WaitForObject(event.GetHandle()); - } else { - result = wpi::WaitForObject(event.GetHandle(), timeout.value(), nullptr); - } - - HAL_RemoveNewDataEventHandle(event.GetHandle()); - return result; -} - units::second_t DriverStation::GetMatchTime() { int32_t status = 0; return units::second_t{HAL_GetMatchTime(&status)}; diff --git a/wpilibc/src/main/native/include/frc/DriverStation.h b/wpilibc/src/main/native/include/frc/DriverStation.h index e5e1de1d95..fd8d449afc 100644 --- a/wpilibc/src/main/native/include/frc/DriverStation.h +++ b/wpilibc/src/main/native/include/frc/DriverStation.h @@ -377,14 +377,6 @@ class DriverStation final { */ static std::optional GetLocation(); - /** - * Wait for a DS connection. - * - * @param timeout timeout in seconds. 0 for infinite. - * @return true if connected, false if timeout - */ - static bool WaitForDsConnection(units::second_t timeout); - /** * Return the approximate match time. The FMS does not send an official match * time to the robots, but does send an approximate match time. The value will diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/DriverStation.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/DriverStation.java index 2a0f59adde..937c53484d 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/DriverStation.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/DriverStation.java @@ -1218,33 +1218,6 @@ public final class DriverStation { return DriverStationJNI.getAllianceStation(); } - /** - * Wait for a DS connection. - * - * @param timeout timeout in seconds. 0 for infinite. - * @return true if connected, false if timeout - */ - public static boolean waitForDsConnection(double timeout) { - int event = WPIUtilJNI.createEvent(true, false); - DriverStationJNI.provideNewDataEventHandle(event); - boolean result; - try { - if (timeout == 0) { - WPIUtilJNI.waitForObject(event); - result = true; - } else { - result = !WPIUtilJNI.waitForObjectTimeout(event, timeout); - } - } catch (InterruptedException ex) { - Thread.currentThread().interrupt(); - result = false; - } finally { - DriverStationJNI.removeNewDataEventHandle(event); - WPIUtilJNI.destroyEvent(event); - } - return result; - } - /** * Return the approximate match time. The FMS does not send an official match time to the robots, * but does send an approximate match time. The value will count down the time remaining in the