[hal,wpilib] Rename RuntimeType constants to all caps

This commit is contained in:
Peter Johnson
2026-03-14 10:33:36 -07:00
parent 227f01f3bd
commit f6fdae3212
11 changed files with 38 additions and 38 deletions

View File

@@ -38,7 +38,7 @@ public final class HALUtil extends JNIWrapper {
public static final int RUNTIME_ROBORIO = 0;
/** roboRIO 2.0. */
public static final int RUNTIME_ROBORIO2 = 1;
public static final int RUNTIME_ROBORIO_2 = 1;
/** Simulation runtime. */
public static final int RUNTIME_SIMULATION = 2;
@@ -82,7 +82,7 @@ public final class HALUtil extends JNIWrapper {
*
* @return HAL Runtime Type
* @see RUNTIME_ROBORIO
* @see RUNTIME_ROBORIO2
* @see RUNTIME_ROBORIO_2
* @see RUNTIME_SIMULATION
* @see "HAL_GetRuntimeType"
*/

View File

@@ -32,13 +32,13 @@ using namespace wpi::util::java;
#define kRIOStatusResourceNotInitialized -52010
static_assert(org_wpilib_hardware_hal_HALUtil_RUNTIME_ROBORIO ==
HAL_Runtime_RoboRIO);
static_assert(org_wpilib_hardware_hal_HALUtil_RUNTIME_ROBORIO2 ==
HAL_Runtime_RoboRIO2);
HAL_RUNTIME_ROBORIO);
static_assert(org_wpilib_hardware_hal_HALUtil_RUNTIME_ROBORIO_2 ==
HAL_RUNTIME_ROBORIO_2);
static_assert(org_wpilib_hardware_hal_HALUtil_RUNTIME_SIMULATION ==
HAL_Runtime_Simulation);
HAL_RUNTIME_SIMULATION);
static_assert(org_wpilib_hardware_hal_HALUtil_RUNTIME_SYSTEMCORE ==
HAL_Runtime_Systemcore);
HAL_RUNTIME_SYSTEMCORE);
static JavaVM* jvm = nullptr;
static JException illegalArgExCls;

View File

@@ -26,13 +26,13 @@
*/
HAL_ENUM(HAL_RuntimeType) {
/** roboRIO 1.0 */
HAL_Runtime_RoboRIO,
HAL_RUNTIME_ROBORIO,
/** roboRIO 2.0 */
HAL_Runtime_RoboRIO2,
HAL_RUNTIME_ROBORIO_2,
/** Simulation runtime */
HAL_Runtime_Simulation,
HAL_RUNTIME_SIMULATION,
/** Systemcore */
HAL_Runtime_Systemcore,
HAL_RUNTIME_SYSTEMCORE,
};
#ifdef __cplusplus

View File

@@ -54,7 +54,7 @@ class SimPeriodicCallbackRegistry : public impl::SimCallbackRegistryBase {
};
} // namespace
static HAL_RuntimeType runtimeType{HAL_Runtime_Simulation};
static HAL_RuntimeType runtimeType{HAL_RUNTIME_SIMULATION};
static wpi::util::spinlock gOnShutdownMutex;
static std::vector<std::pair<void*, void (*)(void*)>> gOnShutdown;
static SimPeriodicCallbackRegistry gSimPeriodicBefore;

View File

@@ -155,7 +155,7 @@ const char* HAL_GetErrorMessage(int32_t code) {
}
}
static HAL_RuntimeType runtimeType = HAL_Runtime_Systemcore;
static HAL_RuntimeType runtimeType = HAL_RUNTIME_SYSTEMCORE;
HAL_RuntimeType HAL_GetRuntimeType(void) {
return runtimeType;

View File

@@ -8,6 +8,6 @@
namespace wpi::hal {
TEST(HALTest, RuntimeType) {
EXPECT_EQ(HAL_RuntimeType::HAL_Runtime_Simulation, HAL_GetRuntimeType());
EXPECT_EQ(HAL_RuntimeType::HAL_RUNTIME_SIMULATION, HAL_GetRuntimeType());
}
} // namespace wpi::hal

View File

@@ -174,7 +174,7 @@ inline void RemoveRefreshedDataEventHandle(WPI_EventHandle event) {}
} // namespace DriverStation
// #ifdef __FIRST_SYSTEMCORE__
// static constexpr int kRoboRIO = 0;
// static constexpr int ROBORIO = 0;
// namespace RobotBase {
// inline int GetRuntimeType() {
// nLoadOut::tTargetClass targetClass = nLoadOut::getTargetClass();

View File

@@ -29,14 +29,14 @@
#include "wpi/util/print.hpp"
#include "wpi/util/timestamp.hpp"
static_assert(wpi::RuntimeType::kRoboRIO ==
static_cast<wpi::RuntimeType>(HAL_Runtime_RoboRIO));
static_assert(wpi::RuntimeType::kRoboRIO2 ==
static_cast<wpi::RuntimeType>(HAL_Runtime_RoboRIO2));
static_assert(wpi::RuntimeType::kSimulation ==
static_cast<wpi::RuntimeType>(HAL_Runtime_Simulation));
static_assert(wpi::RuntimeType::kSystemcore ==
static_cast<wpi::RuntimeType>(HAL_Runtime_Systemcore));
static_assert(wpi::RuntimeType::ROBORIO ==
static_cast<wpi::RuntimeType>(HAL_RUNTIME_ROBORIO));
static_assert(wpi::RuntimeType::ROBORIO_2 ==
static_cast<wpi::RuntimeType>(HAL_RUNTIME_ROBORIO_2));
static_assert(wpi::RuntimeType::SIMULATION ==
static_cast<wpi::RuntimeType>(HAL_RUNTIME_SIMULATION));
static_assert(wpi::RuntimeType::SYSTEMCORE ==
static_cast<wpi::RuntimeType>(HAL_RUNTIME_SYSTEMCORE));
using SetCameraServerSharedFP = void (*)(wpi::CameraServerShared*);

View File

@@ -8,13 +8,13 @@ namespace wpi {
/**
* Runtime type.
*/
enum RuntimeType {
enum class RuntimeType {
/// roboRIO 1.0.
kRoboRIO,
ROBORIO,
/// roboRIO 2.0.
kRoboRIO2,
ROBORIO_2,
/// Simulation runtime.
kSimulation,
kSystemcore
SIMULATION,
SYSTEMCORE
};
} // namespace wpi

View File

@@ -162,7 +162,7 @@ public abstract class RobotBase implements AutoCloseable {
* @return If the robot is running in simulation.
*/
public static boolean isSimulation() {
return getRuntimeType() == RuntimeType.kSimulation;
return getRuntimeType() == RuntimeType.SIMULATION;
}
/**
@@ -172,7 +172,7 @@ public abstract class RobotBase implements AutoCloseable {
*/
public static boolean isReal() {
RuntimeType runtimeType = getRuntimeType();
return runtimeType == RuntimeType.kSystemcore;
return runtimeType == RuntimeType.SYSTEMCORE;
}
/**

View File

@@ -9,13 +9,13 @@ import org.wpilib.hardware.hal.HALUtil;
/** Runtime type. */
public enum RuntimeType {
/** roboRIO 1.0. */
kRoboRIO(HALUtil.RUNTIME_ROBORIO),
ROBORIO(HALUtil.RUNTIME_ROBORIO),
/** roboRIO 2.0. */
kRoboRIO2(HALUtil.RUNTIME_ROBORIO2),
ROBORIO_2(HALUtil.RUNTIME_ROBORIO_2),
/** Simulation runtime. */
kSimulation(HALUtil.RUNTIME_SIMULATION),
SIMULATION(HALUtil.RUNTIME_SIMULATION),
/** Systemcore. */
kSystemcore(HALUtil.RUNTIME_SYSTEMCORE);
SYSTEMCORE(HALUtil.RUNTIME_SYSTEMCORE);
/** RuntimeType value. */
public final int value;
@@ -32,10 +32,10 @@ public enum RuntimeType {
*/
public static RuntimeType getValue(int type) {
return switch (type) {
case HALUtil.RUNTIME_ROBORIO -> RuntimeType.kRoboRIO;
case HALUtil.RUNTIME_ROBORIO2 -> RuntimeType.kRoboRIO2;
case HALUtil.RUNTIME_SYSTEMCORE -> RuntimeType.kSystemcore;
default -> RuntimeType.kSimulation;
case HALUtil.RUNTIME_ROBORIO -> RuntimeType.ROBORIO;
case HALUtil.RUNTIME_ROBORIO_2 -> RuntimeType.ROBORIO_2;
case HALUtil.RUNTIME_SYSTEMCORE -> RuntimeType.SYSTEMCORE;
default -> RuntimeType.SIMULATION;
};
}
}