mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[hal,wpilib] Rename RuntimeType constants to all caps
This commit is contained in:
@@ -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"
|
||||
*/
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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*);
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user