2020-12-26 14:12:05 -08:00
|
|
|
// Copyright (c) FIRST and other WPILib contributors.
|
|
|
|
|
// Open Source Software; you can modify and/or share it under the terms of
|
|
|
|
|
// the WPILib BSD license file in the root directory of this project.
|
2018-05-11 12:38:23 -07:00
|
|
|
|
|
|
|
|
#include <jni.h>
|
|
|
|
|
|
2025-12-12 21:25:57 -07:00
|
|
|
#include "../HALUtil.h"
|
2018-05-11 12:38:23 -07:00
|
|
|
#include "CallbackStore.h"
|
2025-12-12 21:25:57 -07:00
|
|
|
#include "OpModeOptionsCallbackStore.h"
|
|
|
|
|
#include "SimulatorJNI.h"
|
2025-11-07 19:55:43 -05:00
|
|
|
#include "org_wpilib_hardware_hal_simulation_DriverStationDataJNI.h"
|
2025-11-07 19:56:21 -05:00
|
|
|
#include "wpi/hal/simulation/DriverStationData.h"
|
|
|
|
|
#include "wpi/hal/simulation/MockHooks.h"
|
2025-11-07 19:57:55 -05:00
|
|
|
#include "wpi/util/StringExtras.hpp"
|
|
|
|
|
#include "wpi/util/jni_util.hpp"
|
2018-05-11 12:38:23 -07:00
|
|
|
|
2025-11-07 20:00:05 -05:00
|
|
|
using namespace wpi::hal;
|
|
|
|
|
using namespace wpi::util::java;
|
2018-07-22 22:43:24 -04:00
|
|
|
|
2018-05-11 12:38:23 -07:00
|
|
|
extern "C" {
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2018-05-13 17:09:56 -07:00
|
|
|
* Method: registerEnabledCallback
|
|
|
|
|
* Signature: (Ljava/lang/Object;Z)I
|
|
|
|
|
*/
|
2018-05-11 12:38:23 -07:00
|
|
|
JNIEXPORT jint JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_registerEnabledCallback
|
2018-05-13 17:09:56 -07:00
|
|
|
(JNIEnv* env, jclass, jobject callback, jboolean initialNotify)
|
|
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
return sim::AllocateCallbackNoIndex(
|
|
|
|
|
env, callback, initialNotify,
|
|
|
|
|
&HALSIM_RegisterDriverStationEnabledCallback);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2018-05-13 17:09:56 -07:00
|
|
|
* Method: cancelEnabledCallback
|
|
|
|
|
* Signature: (I)V
|
|
|
|
|
*/
|
2018-05-11 12:38:23 -07:00
|
|
|
JNIEXPORT void JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_cancelEnabledCallback
|
2018-05-13 17:09:56 -07:00
|
|
|
(JNIEnv* env, jclass, jint handle)
|
|
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
return sim::FreeCallbackNoIndex(env, handle,
|
|
|
|
|
&HALSIM_CancelDriverStationEnabledCallback);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2018-05-13 17:09:56 -07:00
|
|
|
* Method: getEnabled
|
|
|
|
|
* Signature: ()Z
|
|
|
|
|
*/
|
2018-05-11 12:38:23 -07:00
|
|
|
JNIEXPORT jboolean JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_getEnabled
|
2018-05-13 17:09:56 -07:00
|
|
|
(JNIEnv*, jclass)
|
|
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
return HALSIM_GetDriverStationEnabled();
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2018-05-13 17:09:56 -07:00
|
|
|
* Method: setEnabled
|
|
|
|
|
* Signature: (Z)V
|
|
|
|
|
*/
|
2018-05-11 12:38:23 -07:00
|
|
|
JNIEXPORT void JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_setEnabled
|
2018-05-13 17:09:56 -07:00
|
|
|
(JNIEnv*, jclass, jboolean value)
|
|
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
HALSIM_SetDriverStationEnabled(value);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2025-12-12 21:25:57 -07:00
|
|
|
* Method: registerRobotModeCallback
|
2018-05-13 17:09:56 -07:00
|
|
|
* Signature: (Ljava/lang/Object;Z)I
|
|
|
|
|
*/
|
2018-05-11 12:38:23 -07:00
|
|
|
JNIEXPORT jint JNICALL
|
2025-12-12 21:25:57 -07:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_registerRobotModeCallback
|
2018-05-13 17:09:56 -07:00
|
|
|
(JNIEnv* env, jclass, jobject callback, jboolean initialNotify)
|
|
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
return sim::AllocateCallbackNoIndex(
|
|
|
|
|
env, callback, initialNotify,
|
2025-12-12 21:25:57 -07:00
|
|
|
&HALSIM_RegisterDriverStationRobotModeCallback);
|
2018-05-11 12:38:23 -07:00
|
|
|
}
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2025-12-12 21:25:57 -07:00
|
|
|
* Method: cancelRobotModeCallback
|
2018-05-13 17:09:56 -07:00
|
|
|
* Signature: (I)V
|
|
|
|
|
*/
|
2018-05-11 12:38:23 -07:00
|
|
|
JNIEXPORT void JNICALL
|
2025-12-12 21:25:57 -07:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_cancelRobotModeCallback
|
2018-05-13 17:09:56 -07:00
|
|
|
(JNIEnv* env, jclass, jint handle)
|
|
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
return sim::FreeCallbackNoIndex(env, handle,
|
2025-12-12 21:25:57 -07:00
|
|
|
&HALSIM_CancelDriverStationRobotModeCallback);
|
2018-05-11 12:38:23 -07:00
|
|
|
}
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2025-12-12 21:25:57 -07:00
|
|
|
* Method: nativeGetRobotMode
|
|
|
|
|
* Signature: ()I
|
2018-05-13 17:09:56 -07:00
|
|
|
*/
|
2025-12-12 21:25:57 -07:00
|
|
|
JNIEXPORT jint JNICALL
|
|
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_nativeGetRobotMode
|
2018-05-13 17:09:56 -07:00
|
|
|
(JNIEnv*, jclass)
|
|
|
|
|
{
|
2025-12-12 21:25:57 -07:00
|
|
|
return HALSIM_GetDriverStationRobotMode();
|
2018-05-11 12:38:23 -07:00
|
|
|
}
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2025-12-12 21:25:57 -07:00
|
|
|
* Method: nativeSetRobotMode
|
|
|
|
|
* Signature: (I)V
|
2018-05-13 17:09:56 -07:00
|
|
|
*/
|
2018-05-11 12:38:23 -07:00
|
|
|
JNIEXPORT void JNICALL
|
2025-12-12 21:25:57 -07:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_nativeSetRobotMode
|
|
|
|
|
(JNIEnv*, jclass, jint value)
|
2018-05-13 17:09:56 -07:00
|
|
|
{
|
2025-12-12 21:25:57 -07:00
|
|
|
HALSIM_SetDriverStationRobotMode(static_cast<HAL_RobotMode>(value));
|
2018-05-11 12:38:23 -07:00
|
|
|
}
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2018-05-13 17:09:56 -07:00
|
|
|
* Method: registerEStopCallback
|
|
|
|
|
* Signature: (Ljava/lang/Object;Z)I
|
|
|
|
|
*/
|
2018-05-11 12:38:23 -07:00
|
|
|
JNIEXPORT jint JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_registerEStopCallback
|
2018-05-13 17:09:56 -07:00
|
|
|
(JNIEnv* env, jclass, jobject callback, jboolean initialNotify)
|
|
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
return sim::AllocateCallbackNoIndex(
|
|
|
|
|
env, callback, initialNotify, &HALSIM_RegisterDriverStationEStopCallback);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2018-05-13 17:09:56 -07:00
|
|
|
* Method: cancelEStopCallback
|
|
|
|
|
* Signature: (I)V
|
|
|
|
|
*/
|
2018-05-11 12:38:23 -07:00
|
|
|
JNIEXPORT void JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_cancelEStopCallback
|
2018-05-13 17:09:56 -07:00
|
|
|
(JNIEnv* env, jclass, jint handle)
|
|
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
return sim::FreeCallbackNoIndex(env, handle,
|
|
|
|
|
&HALSIM_CancelDriverStationEStopCallback);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2018-05-13 17:09:56 -07:00
|
|
|
* Method: getEStop
|
|
|
|
|
* Signature: ()Z
|
|
|
|
|
*/
|
2018-05-11 12:38:23 -07:00
|
|
|
JNIEXPORT jboolean JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_getEStop
|
2018-05-13 17:09:56 -07:00
|
|
|
(JNIEnv*, jclass)
|
|
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
return HALSIM_GetDriverStationEStop();
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2018-05-13 17:09:56 -07:00
|
|
|
* Method: setEStop
|
|
|
|
|
* Signature: (Z)V
|
|
|
|
|
*/
|
2018-05-11 12:38:23 -07:00
|
|
|
JNIEXPORT void JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_setEStop
|
2018-05-13 17:09:56 -07:00
|
|
|
(JNIEnv*, jclass, jboolean value)
|
|
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
HALSIM_SetDriverStationEStop(value);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2018-05-13 17:09:56 -07:00
|
|
|
* Method: registerFmsAttachedCallback
|
|
|
|
|
* Signature: (Ljava/lang/Object;Z)I
|
|
|
|
|
*/
|
2018-05-11 12:38:23 -07:00
|
|
|
JNIEXPORT jint JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_registerFmsAttachedCallback
|
2018-05-13 17:09:56 -07:00
|
|
|
(JNIEnv* env, jclass, jobject callback, jboolean initialNotify)
|
|
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
return sim::AllocateCallbackNoIndex(
|
|
|
|
|
env, callback, initialNotify,
|
|
|
|
|
&HALSIM_RegisterDriverStationFmsAttachedCallback);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2018-05-13 17:09:56 -07:00
|
|
|
* Method: cancelFmsAttachedCallback
|
|
|
|
|
* Signature: (I)V
|
|
|
|
|
*/
|
2018-05-11 12:38:23 -07:00
|
|
|
JNIEXPORT void JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_cancelFmsAttachedCallback
|
2018-05-13 17:09:56 -07:00
|
|
|
(JNIEnv* env, jclass, jint handle)
|
|
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
return sim::FreeCallbackNoIndex(
|
|
|
|
|
env, handle, &HALSIM_CancelDriverStationFmsAttachedCallback);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2018-05-13 17:09:56 -07:00
|
|
|
* Method: getFmsAttached
|
|
|
|
|
* Signature: ()Z
|
|
|
|
|
*/
|
2018-05-11 12:38:23 -07:00
|
|
|
JNIEXPORT jboolean JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_getFmsAttached
|
2018-05-13 17:09:56 -07:00
|
|
|
(JNIEnv*, jclass)
|
|
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
return HALSIM_GetDriverStationFmsAttached();
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2018-05-13 17:09:56 -07:00
|
|
|
* Method: setFmsAttached
|
|
|
|
|
* Signature: (Z)V
|
|
|
|
|
*/
|
2018-05-11 12:38:23 -07:00
|
|
|
JNIEXPORT void JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_setFmsAttached
|
2018-05-13 17:09:56 -07:00
|
|
|
(JNIEnv*, jclass, jboolean value)
|
|
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
HALSIM_SetDriverStationFmsAttached(value);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2018-05-13 17:09:56 -07:00
|
|
|
* Method: registerDsAttachedCallback
|
|
|
|
|
* Signature: (Ljava/lang/Object;Z)I
|
|
|
|
|
*/
|
2018-05-11 12:38:23 -07:00
|
|
|
JNIEXPORT jint JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_registerDsAttachedCallback
|
2018-05-13 17:09:56 -07:00
|
|
|
(JNIEnv* env, jclass, jobject callback, jboolean initialNotify)
|
|
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
return sim::AllocateCallbackNoIndex(
|
|
|
|
|
env, callback, initialNotify,
|
|
|
|
|
&HALSIM_RegisterDriverStationDsAttachedCallback);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2018-05-13 17:09:56 -07:00
|
|
|
* Method: cancelDsAttachedCallback
|
|
|
|
|
* Signature: (I)V
|
|
|
|
|
*/
|
2018-05-11 12:38:23 -07:00
|
|
|
JNIEXPORT void JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_cancelDsAttachedCallback
|
2018-05-13 17:09:56 -07:00
|
|
|
(JNIEnv* env, jclass, jint handle)
|
|
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
return sim::FreeCallbackNoIndex(
|
|
|
|
|
env, handle, &HALSIM_CancelDriverStationDsAttachedCallback);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2018-05-13 17:09:56 -07:00
|
|
|
* Method: getDsAttached
|
|
|
|
|
* Signature: ()Z
|
|
|
|
|
*/
|
2018-05-11 12:38:23 -07:00
|
|
|
JNIEXPORT jboolean JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_getDsAttached
|
2018-05-13 17:09:56 -07:00
|
|
|
(JNIEnv*, jclass)
|
|
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
return HALSIM_GetDriverStationDsAttached();
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2018-05-13 17:09:56 -07:00
|
|
|
* Method: setDsAttached
|
|
|
|
|
* Signature: (Z)V
|
|
|
|
|
*/
|
2018-05-11 12:38:23 -07:00
|
|
|
JNIEXPORT void JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_setDsAttached
|
2018-05-13 17:09:56 -07:00
|
|
|
(JNIEnv*, jclass, jboolean value)
|
|
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
HALSIM_SetDriverStationDsAttached(value);
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-15 00:33:57 -07:00
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2020-07-15 00:33:57 -07:00
|
|
|
* Method: registerAllianceStationIdCallback
|
|
|
|
|
* Signature: (Ljava/lang/Object;Z)I
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT jint JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_registerAllianceStationIdCallback
|
2020-07-15 00:33:57 -07:00
|
|
|
(JNIEnv* env, jclass, jobject callback, jboolean initialNotify)
|
|
|
|
|
{
|
|
|
|
|
return sim::AllocateCallbackNoIndex(
|
|
|
|
|
env, callback, initialNotify,
|
|
|
|
|
&HALSIM_RegisterDriverStationAllianceStationIdCallback);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2020-07-15 00:33:57 -07:00
|
|
|
* Method: cancelAllianceStationIdCallback
|
|
|
|
|
* Signature: (I)V
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_cancelAllianceStationIdCallback
|
2020-07-15 00:33:57 -07:00
|
|
|
(JNIEnv* env, jclass, jint handle)
|
|
|
|
|
{
|
|
|
|
|
return sim::FreeCallbackNoIndex(
|
|
|
|
|
env, handle, &HALSIM_CancelDriverStationAllianceStationIdCallback);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2020-07-15 00:33:57 -07:00
|
|
|
* Method: getAllianceStationId
|
|
|
|
|
* Signature: ()I
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT jint JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_getAllianceStationId
|
2020-07-15 00:33:57 -07:00
|
|
|
(JNIEnv*, jclass)
|
|
|
|
|
{
|
|
|
|
|
return HALSIM_GetDriverStationAllianceStationId();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2020-07-15 00:33:57 -07:00
|
|
|
* Method: setAllianceStationId
|
|
|
|
|
* Signature: (I)V
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_setAllianceStationId
|
2020-07-15 00:33:57 -07:00
|
|
|
(JNIEnv*, jclass, jint value)
|
|
|
|
|
{
|
|
|
|
|
HALSIM_SetDriverStationAllianceStationId(
|
|
|
|
|
static_cast<HAL_AllianceStationID>(value));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2020-07-15 00:33:57 -07:00
|
|
|
* Method: registerMatchTimeCallback
|
|
|
|
|
* Signature: (Ljava/lang/Object;Z)I
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT jint JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_registerMatchTimeCallback
|
2020-07-15 00:33:57 -07:00
|
|
|
(JNIEnv* env, jclass, jobject callback, jboolean initialNotify)
|
|
|
|
|
{
|
|
|
|
|
return sim::AllocateCallbackNoIndex(
|
|
|
|
|
env, callback, initialNotify,
|
|
|
|
|
&HALSIM_RegisterDriverStationMatchTimeCallback);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2020-07-15 00:33:57 -07:00
|
|
|
* Method: cancelMatchTimeCallback
|
|
|
|
|
* Signature: (I)V
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_cancelMatchTimeCallback
|
2020-07-15 00:33:57 -07:00
|
|
|
(JNIEnv* env, jclass, jint handle)
|
|
|
|
|
{
|
|
|
|
|
return sim::FreeCallbackNoIndex(env, handle,
|
|
|
|
|
&HALSIM_CancelDriverStationMatchTimeCallback);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2020-07-15 00:33:57 -07:00
|
|
|
* Method: getMatchTime
|
|
|
|
|
* Signature: ()D
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT jdouble JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_getMatchTime
|
2020-07-15 00:33:57 -07:00
|
|
|
(JNIEnv*, jclass)
|
|
|
|
|
{
|
|
|
|
|
return HALSIM_GetDriverStationMatchTime();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2020-07-15 00:33:57 -07:00
|
|
|
* Method: setMatchTime
|
|
|
|
|
* Signature: (D)V
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_setMatchTime
|
2020-07-15 00:33:57 -07:00
|
|
|
(JNIEnv*, jclass, jdouble value)
|
|
|
|
|
{
|
|
|
|
|
HALSIM_SetDriverStationMatchTime(value);
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-12 21:25:57 -07:00
|
|
|
/*
|
|
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
|
|
|
|
* Method: registerOpModeCallback
|
|
|
|
|
* Signature: (Ljava/lang/Object;Z)I
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT jint JNICALL
|
|
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_registerOpModeCallback
|
|
|
|
|
(JNIEnv* env, jclass, jobject callback, jboolean initialNotify)
|
|
|
|
|
{
|
|
|
|
|
return sim::AllocateCallbackNoIndex(
|
|
|
|
|
env, callback, initialNotify,
|
|
|
|
|
&HALSIM_RegisterDriverStationOpModeCallback);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
|
|
|
|
* Method: cancelOpModeCallback
|
|
|
|
|
* Signature: (I)V
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL
|
|
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_cancelOpModeCallback
|
|
|
|
|
(JNIEnv* env, jclass, jint handle)
|
|
|
|
|
{
|
|
|
|
|
return sim::FreeCallbackNoIndex(env, handle,
|
|
|
|
|
&HALSIM_CancelDriverStationOpModeCallback);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
|
|
|
|
* Method: getOpMode
|
|
|
|
|
* Signature: ()J
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT jlong JNICALL
|
|
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_getOpMode
|
|
|
|
|
(JNIEnv* env, jclass)
|
|
|
|
|
{
|
|
|
|
|
return HALSIM_GetDriverStationOpMode();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
|
|
|
|
* Method: setOpMode
|
|
|
|
|
* Signature: (J)V
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL
|
|
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_setOpMode
|
|
|
|
|
(JNIEnv* env, jclass, jlong value)
|
|
|
|
|
{
|
|
|
|
|
HALSIM_SetDriverStationOpMode(value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
|
|
|
|
* Method: registerOpModeOptionsCallback
|
|
|
|
|
* Signature: (Ljava/lang/Object;Z)I
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT jint JNICALL
|
|
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_registerOpModeOptionsCallback
|
|
|
|
|
(JNIEnv* env, jclass, jobject callback, jboolean initialNotify)
|
|
|
|
|
{
|
|
|
|
|
return sim::AllocateOpModeOptionsCallback(
|
|
|
|
|
env, callback, initialNotify, &HALSIM_RegisterOpModeOptionsCallback);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
|
|
|
|
* Method: cancelOpModeOptionsCallback
|
|
|
|
|
* Signature: (I)V
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL
|
|
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_cancelOpModeOptionsCallback
|
|
|
|
|
(JNIEnv* env, jclass, jint handle)
|
|
|
|
|
{
|
|
|
|
|
sim::FreeOpModeOptionsCallback(env, handle,
|
|
|
|
|
&HALSIM_CancelOpModeOptionsCallback);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
|
|
|
|
* Method: getOpModeOptions
|
|
|
|
|
* Signature: ()[Ljava/lang/Object;
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT jobjectArray JNICALL
|
|
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_getOpModeOptions
|
|
|
|
|
(JNIEnv* env, jclass)
|
|
|
|
|
{
|
|
|
|
|
int32_t count;
|
|
|
|
|
HAL_OpModeOption* options = HALSIM_GetOpModeOptions(&count);
|
|
|
|
|
auto rv = CreateOpModeOptionArray(env, {options, options + count});
|
|
|
|
|
HALSIM_FreeOpModeOptionsArray(options, count);
|
|
|
|
|
return rv;
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-11 12:38:23 -07:00
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2018-05-11 12:38:23 -07:00
|
|
|
* Method: setJoystickAxes
|
2025-10-25 23:03:50 -07:00
|
|
|
* Signature: (B[FS)V
|
2018-05-11 12:38:23 -07:00
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_setJoystickAxes
|
2025-10-25 23:03:50 -07:00
|
|
|
(JNIEnv* env, jclass, jbyte joystickNum, jfloatArray axesArray,
|
|
|
|
|
jshort availableAxes)
|
2018-05-13 17:09:56 -07:00
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
HAL_JoystickAxes axes;
|
|
|
|
|
{
|
2023-08-24 00:02:56 -07:00
|
|
|
JSpan<const jfloat> jArrayRef(env, axesArray);
|
2018-05-11 12:38:23 -07:00
|
|
|
auto arrayRef = jArrayRef.array();
|
|
|
|
|
auto arraySize = arrayRef.size();
|
|
|
|
|
int maxCount =
|
|
|
|
|
arraySize < HAL_kMaxJoystickAxes ? arraySize : HAL_kMaxJoystickAxes;
|
2025-10-25 23:03:50 -07:00
|
|
|
axes.available = availableAxes;
|
2018-05-11 12:38:23 -07:00
|
|
|
for (int i = 0; i < maxCount; i++) {
|
|
|
|
|
axes.axes[i] = arrayRef[i];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
HALSIM_SetJoystickAxes(joystickNum, &axes);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2018-05-11 12:38:23 -07:00
|
|
|
* Method: setJoystickPOVs
|
2025-10-25 23:03:50 -07:00
|
|
|
* Signature: (B[BS)V
|
2018-05-11 12:38:23 -07:00
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_setJoystickPOVs
|
2025-10-25 23:03:50 -07:00
|
|
|
(JNIEnv* env, jclass, jbyte joystickNum, jbyteArray povsArray,
|
|
|
|
|
jshort availablePovs)
|
2018-05-13 17:09:56 -07:00
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
HAL_JoystickPOVs povs;
|
|
|
|
|
{
|
2025-05-16 22:15:14 -07:00
|
|
|
JSpan<const jbyte> jArrayRef(env, povsArray);
|
2018-05-11 12:38:23 -07:00
|
|
|
auto arrayRef = jArrayRef.array();
|
|
|
|
|
auto arraySize = arrayRef.size();
|
|
|
|
|
int maxCount =
|
|
|
|
|
arraySize < HAL_kMaxJoystickPOVs ? arraySize : HAL_kMaxJoystickPOVs;
|
2025-10-25 23:03:50 -07:00
|
|
|
povs.available = availablePovs;
|
2018-05-11 12:38:23 -07:00
|
|
|
for (int i = 0; i < maxCount; i++) {
|
2025-06-29 18:32:26 -07:00
|
|
|
povs.povs[i] = static_cast<HAL_JoystickPOV>(arrayRef[i]);
|
2018-05-11 12:38:23 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
HALSIM_SetJoystickPOVs(joystickNum, &povs);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2018-05-11 12:38:23 -07:00
|
|
|
* Method: setJoystickButtons
|
2025-10-25 23:03:50 -07:00
|
|
|
* Signature: (BJJ)V
|
2018-05-11 12:38:23 -07:00
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_setJoystickButtons
|
2025-10-25 23:03:50 -07:00
|
|
|
(JNIEnv* env, jclass, jbyte joystickNum, jlong buttons,
|
|
|
|
|
jlong availableButtons)
|
2018-05-13 17:09:56 -07:00
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
HAL_JoystickButtons joystickButtons;
|
2025-10-25 23:03:50 -07:00
|
|
|
joystickButtons.available = availableButtons;
|
2018-05-11 12:38:23 -07:00
|
|
|
joystickButtons.buttons = buttons;
|
|
|
|
|
HALSIM_SetJoystickButtons(joystickNum, &joystickButtons);
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-15 00:33:57 -07:00
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2025-11-17 14:36:14 -08:00
|
|
|
* Method: getJoystickLeds
|
|
|
|
|
* Signature: (I)I
|
2020-07-15 00:33:57 -07:00
|
|
|
*/
|
2025-11-17 14:36:14 -08:00
|
|
|
JNIEXPORT jint JNICALL
|
|
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_getJoystickLeds
|
2020-07-15 00:33:57 -07:00
|
|
|
(JNIEnv* env, jclass, jint stick)
|
|
|
|
|
{
|
2025-11-17 14:36:14 -08:00
|
|
|
int32_t leds = 0;
|
|
|
|
|
HALSIM_GetJoystickLeds(stick, &leds);
|
|
|
|
|
return leds;
|
2020-07-15 00:33:57 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2020-07-15 00:33:57 -07:00
|
|
|
* Method: getJoystickRumble
|
|
|
|
|
* Signature: (II)I
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT jint JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_getJoystickRumble
|
2020-07-15 00:33:57 -07:00
|
|
|
(JNIEnv* env, jclass, jint stick, jint rumbleNum)
|
|
|
|
|
{
|
|
|
|
|
int32_t leftRumble = 0;
|
|
|
|
|
int32_t rightRumble = 0;
|
2025-11-17 14:36:14 -08:00
|
|
|
int32_t leftTriggerRumble = 0;
|
|
|
|
|
int32_t rightTriggerRumble = 0;
|
|
|
|
|
HALSIM_GetJoystickRumbles(stick, &leftRumble, &rightRumble,
|
|
|
|
|
&leftTriggerRumble, &rightTriggerRumble);
|
|
|
|
|
switch (rumbleNum) {
|
|
|
|
|
case 0:
|
|
|
|
|
return leftRumble;
|
|
|
|
|
case 1:
|
|
|
|
|
return rightRumble;
|
|
|
|
|
case 2:
|
|
|
|
|
return leftTriggerRumble;
|
|
|
|
|
case 3:
|
|
|
|
|
return rightTriggerRumble;
|
|
|
|
|
default:
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2020-07-15 00:33:57 -07:00
|
|
|
}
|
|
|
|
|
|
2018-05-11 12:38:23 -07:00
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2018-05-11 12:38:23 -07:00
|
|
|
* Method: setMatchInfo
|
2018-07-22 22:43:24 -04:00
|
|
|
* Signature: (Ljava/lang/String;Ljava/lang/String;III)V
|
2018-05-11 12:38:23 -07:00
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_setMatchInfo
|
2018-07-22 22:43:24 -04:00
|
|
|
(JNIEnv* env, jclass, jstring eventName, jstring gameSpecificMessage,
|
|
|
|
|
jint matchNumber, jint replayNumber, jint matchType)
|
|
|
|
|
{
|
|
|
|
|
JStringRef eventNameRef{env, eventName};
|
|
|
|
|
JStringRef gameSpecificMessageRef{env, gameSpecificMessage};
|
|
|
|
|
|
|
|
|
|
HAL_MatchInfo halMatchInfo;
|
2025-11-07 20:01:58 -05:00
|
|
|
wpi::util::format_to_n_c_str(halMatchInfo.eventName,
|
|
|
|
|
sizeof(halMatchInfo.eventName), "{}",
|
|
|
|
|
eventNameRef.str());
|
2025-11-07 20:00:05 -05:00
|
|
|
wpi::util::format_to_n_c_str(
|
2023-09-17 20:00:16 -07:00
|
|
|
reinterpret_cast<char*>(halMatchInfo.gameSpecificMessage),
|
|
|
|
|
sizeof(halMatchInfo.gameSpecificMessage), "{}",
|
|
|
|
|
gameSpecificMessageRef.str());
|
2018-07-22 22:43:24 -04:00
|
|
|
halMatchInfo.gameSpecificMessageSize = gameSpecificMessageRef.size();
|
|
|
|
|
halMatchInfo.matchType = (HAL_MatchType)matchType;
|
|
|
|
|
halMatchInfo.matchNumber = matchNumber;
|
|
|
|
|
halMatchInfo.replayNumber = replayNumber;
|
|
|
|
|
HALSIM_SetMatchInfo(&halMatchInfo);
|
|
|
|
|
}
|
2018-05-11 12:38:23 -07:00
|
|
|
|
|
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2018-05-11 12:38:23 -07:00
|
|
|
* Method: registerAllCallbacks
|
2018-05-13 17:09:56 -07:00
|
|
|
* Signature: (Ljava/lang/Object;Z)V
|
2018-05-11 12:38:23 -07:00
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_registerAllCallbacks
|
2018-05-13 17:09:56 -07:00
|
|
|
(JNIEnv* env, jclass, jobject callback, jboolean initialNotify)
|
|
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
sim::AllocateCallbackNoIndex(
|
|
|
|
|
env, callback, initialNotify,
|
|
|
|
|
[](HAL_NotifyCallback cb, void* param, HAL_Bool in) {
|
|
|
|
|
HALSIM_RegisterDriverStationAllCallbacks(cb, param, in);
|
|
|
|
|
return 0;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2018-05-11 12:38:23 -07:00
|
|
|
* Method: notifyNewData
|
|
|
|
|
* Signature: ()V
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_notifyNewData
|
2018-05-13 17:09:56 -07:00
|
|
|
(JNIEnv*, jclass)
|
|
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
HALSIM_NotifyDriverStationNewData();
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-27 19:11:26 -08:00
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2019-12-27 19:11:26 -08:00
|
|
|
* Method: setSendError
|
|
|
|
|
* Signature: (Z)V
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_setSendError
|
2019-12-27 19:11:26 -08:00
|
|
|
(JNIEnv*, jclass, jboolean shouldSend)
|
|
|
|
|
{
|
|
|
|
|
if (shouldSend) {
|
|
|
|
|
HALSIM_SetSendError(nullptr);
|
|
|
|
|
} else {
|
|
|
|
|
HALSIM_SetSendError([](HAL_Bool isError, int32_t errorCode,
|
|
|
|
|
HAL_Bool isLVCode, const char* details,
|
|
|
|
|
const char* location, const char* callStack,
|
2020-02-18 20:44:40 -08:00
|
|
|
HAL_Bool printMsg) { return 0; });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2020-02-18 20:44:40 -08:00
|
|
|
* Method: setSendConsoleLine
|
|
|
|
|
* Signature: (Z)V
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_setSendConsoleLine
|
2020-02-18 20:44:40 -08:00
|
|
|
(JNIEnv*, jclass, jboolean shouldSend)
|
|
|
|
|
{
|
|
|
|
|
if (shouldSend) {
|
|
|
|
|
HALSIM_SetSendConsoleLine(nullptr);
|
|
|
|
|
} else {
|
|
|
|
|
HALSIM_SetSendConsoleLine([](const char* line) { return 0; });
|
2019-12-27 19:11:26 -08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-15 00:33:57 -07:00
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2020-07-15 00:33:57 -07:00
|
|
|
* Method: setJoystickButton
|
|
|
|
|
* Signature: (IIZ)V
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_setJoystickButton
|
2020-07-15 00:33:57 -07:00
|
|
|
(JNIEnv*, jclass, jint stick, jint button, jboolean state)
|
|
|
|
|
{
|
|
|
|
|
HALSIM_SetJoystickButton(stick, button, state);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2020-07-15 00:33:57 -07:00
|
|
|
* Method: setJoystickAxis
|
|
|
|
|
* Signature: (IID)V
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_setJoystickAxis
|
2020-07-15 00:33:57 -07:00
|
|
|
(JNIEnv*, jclass, jint stick, jint axis, jdouble value)
|
|
|
|
|
{
|
|
|
|
|
HALSIM_SetJoystickAxis(stick, axis, value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2020-07-15 00:33:57 -07:00
|
|
|
* Method: setJoystickPOV
|
2025-06-29 18:32:26 -07:00
|
|
|
* Signature: (IIB)V
|
2020-07-15 00:33:57 -07:00
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_setJoystickPOV
|
2025-06-29 18:32:26 -07:00
|
|
|
(JNIEnv*, jclass, jint stick, jint pov, jbyte value)
|
2020-07-15 00:33:57 -07:00
|
|
|
{
|
2025-06-29 18:32:26 -07:00
|
|
|
HALSIM_SetJoystickPOV(stick, pov, static_cast<HAL_JoystickPOV>(value));
|
2020-07-15 00:33:57 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2020-07-15 00:33:57 -07:00
|
|
|
* Method: setJoystickButtonsValue
|
2025-10-25 23:03:50 -07:00
|
|
|
* Signature: (IJ)V
|
2020-07-15 00:33:57 -07:00
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_setJoystickButtonsValue
|
2025-10-25 23:03:50 -07:00
|
|
|
(JNIEnv*, jclass, jint stick, jlong buttons)
|
2020-07-15 00:33:57 -07:00
|
|
|
{
|
|
|
|
|
HALSIM_SetJoystickButtonsValue(stick, buttons);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2025-10-25 23:03:50 -07:00
|
|
|
* Method: setJoystickAxesAvailable
|
2020-07-15 00:33:57 -07:00
|
|
|
* Signature: (II)V
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_setJoystickAxesAvailable
|
2025-10-25 23:03:50 -07:00
|
|
|
(JNIEnv*, jclass, jint stick, jint available)
|
2020-07-15 00:33:57 -07:00
|
|
|
{
|
2025-10-25 23:03:50 -07:00
|
|
|
HALSIM_SetJoystickAxesAvailable(stick, available);
|
2020-07-15 00:33:57 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2025-10-25 23:03:50 -07:00
|
|
|
* Method: setJoystickPOVsAvailable
|
2020-07-15 00:33:57 -07:00
|
|
|
* Signature: (II)V
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_setJoystickPOVsAvailable
|
2025-10-25 23:03:50 -07:00
|
|
|
(JNIEnv*, jclass, jint stick, jint available)
|
2020-07-15 00:33:57 -07:00
|
|
|
{
|
2025-10-25 23:03:50 -07:00
|
|
|
HALSIM_SetJoystickPOVsAvailable(stick, available);
|
2020-07-15 00:33:57 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2025-10-25 23:03:50 -07:00
|
|
|
* Method: setJoystickButtonsAvailable
|
|
|
|
|
* Signature: (IJ)V
|
2020-07-15 00:33:57 -07:00
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_setJoystickButtonsAvailable
|
2025-10-25 23:03:50 -07:00
|
|
|
(JNIEnv*, jclass, jint stick, jlong available)
|
2020-07-15 00:33:57 -07:00
|
|
|
{
|
2025-10-25 23:03:50 -07:00
|
|
|
HALSIM_SetJoystickButtonsAvailable(stick, available);
|
2020-07-15 00:33:57 -07:00
|
|
|
}
|
|
|
|
|
|
2025-11-21 13:57:11 -08:00
|
|
|
/*
|
|
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
|
|
|
|
* Method: setTouchpadCounts
|
|
|
|
|
* Signature: (II[I)V
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL
|
|
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_setTouchpadCounts
|
|
|
|
|
(JNIEnv* env, jclass, jint stick, jint touchpadCount, jintArray fingerCounts)
|
|
|
|
|
{
|
|
|
|
|
JSpan<const jint> jArrayRef(env, fingerCounts);
|
|
|
|
|
uint8_t fingerCountsLocal[2];
|
|
|
|
|
size_t toCopy = (std::min)(jArrayRef.size(), static_cast<size_t>(2));
|
|
|
|
|
for (size_t i = 0; i < toCopy; ++i) {
|
|
|
|
|
fingerCountsLocal[i] = static_cast<uint8_t>(jArrayRef[i]);
|
|
|
|
|
}
|
|
|
|
|
HALSIM_SetJoystickTouchpadCounts(stick, touchpadCount, fingerCountsLocal);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
|
|
|
|
* Method: setTouchpadFinger
|
|
|
|
|
* Signature: (IIIZFF)V
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL
|
|
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_setTouchpadFinger
|
|
|
|
|
(JNIEnv*, jclass, jint stick, jint touchpadIndex, jint fingerIndex,
|
|
|
|
|
jboolean down, jfloat x, jfloat y)
|
|
|
|
|
{
|
|
|
|
|
HALSIM_SetJoystickTouchpadFinger(stick, touchpadIndex, fingerIndex, down, x,
|
|
|
|
|
y);
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-15 00:33:57 -07:00
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2025-05-16 22:15:14 -07:00
|
|
|
* Method: setJoystickIsGamepad
|
2020-07-15 00:33:57 -07:00
|
|
|
* Signature: (IZ)V
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_setJoystickIsGamepad
|
2025-05-16 22:15:14 -07:00
|
|
|
(JNIEnv*, jclass, jint stick, jboolean isGamepad)
|
2020-07-15 00:33:57 -07:00
|
|
|
{
|
2025-05-16 22:15:14 -07:00
|
|
|
HALSIM_SetJoystickIsGamepad(stick, isGamepad);
|
2020-07-15 00:33:57 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2025-11-17 14:36:14 -08:00
|
|
|
* Method: setJoystickGamepadType
|
2020-07-15 00:33:57 -07:00
|
|
|
* Signature: (II)V
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL
|
2025-11-17 14:36:14 -08:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_setJoystickGamepadType
|
2020-07-15 00:33:57 -07:00
|
|
|
(JNIEnv*, jclass, jint stick, jint type)
|
|
|
|
|
{
|
2025-11-17 14:36:14 -08:00
|
|
|
HALSIM_SetJoystickGamepadType(stick, type);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
|
|
|
|
* Method: setJoystickSupportedOutputs
|
|
|
|
|
* Signature: (II)V
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL
|
|
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_setJoystickSupportedOutputs
|
|
|
|
|
(JNIEnv*, jclass, jint stick, jint supportedOutputs)
|
|
|
|
|
{
|
|
|
|
|
HALSIM_SetJoystickSupportedOutputs(stick, supportedOutputs);
|
2020-07-15 00:33:57 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2020-07-15 00:33:57 -07:00
|
|
|
* Method: setJoystickName
|
|
|
|
|
* Signature: (ILjava/lang/String;)V
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_setJoystickName
|
2020-07-15 00:33:57 -07:00
|
|
|
(JNIEnv* env, jclass, jint stick, jstring name)
|
|
|
|
|
{
|
2022-12-09 16:10:23 -05:00
|
|
|
JStringRef nameJString{env, name};
|
2025-11-07 20:00:05 -05:00
|
|
|
auto str = wpi::util::make_string(nameJString);
|
Change C APIs to a unified string implementation (#6299)
Currently in the entire C API of WPILib we have ~8 different ways of handling strings. The C API actually isn't built for pure C callers (We don't actually have any of those). Instead, they're built for interop between languages like LabVIEW and C# which can talk to C API's directly.
For output parameters, the choice was fairly obvious. An output struct containing a const string pointer and a length makes the most sense. Its easy to use these from most other languages, and doesn't require special null termination handling. Freeing these is also easy, as if you ever receive one of these string structures, theres just a single function call to free it.
Input parameters are a bit more complex. To be used from pure C, and from LabVIEW, a null terminated string is the best in most cases. However, null terminated strings in general have a lot of downsides. Additionally, from LabVIEW there are other considerations around encoding that having a wrapper struct helps make a bit easier. From a language like C#, a wrapper struct is by far the easiest, as custom marshalling can make it trivial to marshal both UTF8 and UTF16 strings down.
The final consideration is its nice to have an identical concept for both input and output. It makes the rules fairly easy to understand.
WPILib will not have any APIs that manipulate a string allocated externally. This means WPI_String can be const, as across the boundary it is always const.
If a WPILib API takes a const WPI_String*, WPILib will not manipulate or attempt to free that string, and that string is treated as an input. It is up to the caller to handle that memory, WPILib will never hold onto that memory longer than the call.
If a WPILib API takes a WPI_String*, that string is an output. WPILib will allocate that API with WPI_AllocateString(), fill in the string, and return to the caller. When the caller is done with the string, they must free it with WPI_FreeString().
If an output struct contains a WPI_String member, that member is considered read only, and should not be explicitly freed. The caller should call the free function for that struct.
If an array of WPI_Strings are returned, each individual string is considered read only, and should not be explicitly freed. The free function for that array should be called by the caller.
If an input struct containing a WPI_String, or an input array of WPI_Strings is passed to WPILib, the individual strings will not be manipulated or freed by WPILib, and the caller owns and should free that memory.
Callbacks also follow these rules. The most common is a callback either getting passed a const WPI_String* or a struct containing a WPI_String. In both of these cases, the callback target should consider these strings read only, and not attempt to free them or manipulate them.
2024-05-13 05:35:14 -07:00
|
|
|
HALSIM_SetJoystickName(stick, &str);
|
2020-07-15 00:33:57 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2020-07-15 00:33:57 -07:00
|
|
|
* Method: setGameSpecificMessage
|
|
|
|
|
* Signature: (Ljava/lang/String;)V
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_setGameSpecificMessage
|
2020-07-15 00:33:57 -07:00
|
|
|
(JNIEnv* env, jclass, jstring message)
|
|
|
|
|
{
|
2022-12-09 16:10:23 -05:00
|
|
|
JStringRef messageJString{env, message};
|
2025-11-07 20:00:05 -05:00
|
|
|
auto str = wpi::util::make_string(messageJString);
|
Change C APIs to a unified string implementation (#6299)
Currently in the entire C API of WPILib we have ~8 different ways of handling strings. The C API actually isn't built for pure C callers (We don't actually have any of those). Instead, they're built for interop between languages like LabVIEW and C# which can talk to C API's directly.
For output parameters, the choice was fairly obvious. An output struct containing a const string pointer and a length makes the most sense. Its easy to use these from most other languages, and doesn't require special null termination handling. Freeing these is also easy, as if you ever receive one of these string structures, theres just a single function call to free it.
Input parameters are a bit more complex. To be used from pure C, and from LabVIEW, a null terminated string is the best in most cases. However, null terminated strings in general have a lot of downsides. Additionally, from LabVIEW there are other considerations around encoding that having a wrapper struct helps make a bit easier. From a language like C#, a wrapper struct is by far the easiest, as custom marshalling can make it trivial to marshal both UTF8 and UTF16 strings down.
The final consideration is its nice to have an identical concept for both input and output. It makes the rules fairly easy to understand.
WPILib will not have any APIs that manipulate a string allocated externally. This means WPI_String can be const, as across the boundary it is always const.
If a WPILib API takes a const WPI_String*, WPILib will not manipulate or attempt to free that string, and that string is treated as an input. It is up to the caller to handle that memory, WPILib will never hold onto that memory longer than the call.
If a WPILib API takes a WPI_String*, that string is an output. WPILib will allocate that API with WPI_AllocateString(), fill in the string, and return to the caller. When the caller is done with the string, they must free it with WPI_FreeString().
If an output struct contains a WPI_String member, that member is considered read only, and should not be explicitly freed. The caller should call the free function for that struct.
If an array of WPI_Strings are returned, each individual string is considered read only, and should not be explicitly freed. The free function for that array should be called by the caller.
If an input struct containing a WPI_String, or an input array of WPI_Strings is passed to WPILib, the individual strings will not be manipulated or freed by WPILib, and the caller owns and should free that memory.
Callbacks also follow these rules. The most common is a callback either getting passed a const WPI_String* or a struct containing a WPI_String. In both of these cases, the callback target should consider these strings read only, and not attempt to free them or manipulate them.
2024-05-13 05:35:14 -07:00
|
|
|
HALSIM_SetGameSpecificMessage(&str);
|
2020-07-15 00:33:57 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2020-07-15 00:33:57 -07:00
|
|
|
* Method: setEventName
|
|
|
|
|
* Signature: (Ljava/lang/String;)V
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_setEventName
|
2020-07-15 00:33:57 -07:00
|
|
|
(JNIEnv* env, jclass, jstring name)
|
|
|
|
|
{
|
2022-12-09 16:10:23 -05:00
|
|
|
JStringRef nameJString{env, name};
|
2025-11-07 20:00:05 -05:00
|
|
|
auto str = wpi::util::make_string(nameJString);
|
Change C APIs to a unified string implementation (#6299)
Currently in the entire C API of WPILib we have ~8 different ways of handling strings. The C API actually isn't built for pure C callers (We don't actually have any of those). Instead, they're built for interop between languages like LabVIEW and C# which can talk to C API's directly.
For output parameters, the choice was fairly obvious. An output struct containing a const string pointer and a length makes the most sense. Its easy to use these from most other languages, and doesn't require special null termination handling. Freeing these is also easy, as if you ever receive one of these string structures, theres just a single function call to free it.
Input parameters are a bit more complex. To be used from pure C, and from LabVIEW, a null terminated string is the best in most cases. However, null terminated strings in general have a lot of downsides. Additionally, from LabVIEW there are other considerations around encoding that having a wrapper struct helps make a bit easier. From a language like C#, a wrapper struct is by far the easiest, as custom marshalling can make it trivial to marshal both UTF8 and UTF16 strings down.
The final consideration is its nice to have an identical concept for both input and output. It makes the rules fairly easy to understand.
WPILib will not have any APIs that manipulate a string allocated externally. This means WPI_String can be const, as across the boundary it is always const.
If a WPILib API takes a const WPI_String*, WPILib will not manipulate or attempt to free that string, and that string is treated as an input. It is up to the caller to handle that memory, WPILib will never hold onto that memory longer than the call.
If a WPILib API takes a WPI_String*, that string is an output. WPILib will allocate that API with WPI_AllocateString(), fill in the string, and return to the caller. When the caller is done with the string, they must free it with WPI_FreeString().
If an output struct contains a WPI_String member, that member is considered read only, and should not be explicitly freed. The caller should call the free function for that struct.
If an array of WPI_Strings are returned, each individual string is considered read only, and should not be explicitly freed. The free function for that array should be called by the caller.
If an input struct containing a WPI_String, or an input array of WPI_Strings is passed to WPILib, the individual strings will not be manipulated or freed by WPILib, and the caller owns and should free that memory.
Callbacks also follow these rules. The most common is a callback either getting passed a const WPI_String* or a struct containing a WPI_String. In both of these cases, the callback target should consider these strings read only, and not attempt to free them or manipulate them.
2024-05-13 05:35:14 -07:00
|
|
|
HALSIM_SetEventName(&str);
|
2020-07-15 00:33:57 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2020-07-15 00:33:57 -07:00
|
|
|
* Method: setMatchType
|
|
|
|
|
* Signature: (I)V
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_setMatchType
|
2020-07-15 00:33:57 -07:00
|
|
|
(JNIEnv*, jclass, jint type)
|
|
|
|
|
{
|
|
|
|
|
HALSIM_SetMatchType(static_cast<HAL_MatchType>(static_cast<int>(type)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2020-07-15 00:33:57 -07:00
|
|
|
* Method: setMatchNumber
|
|
|
|
|
* Signature: (I)V
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_setMatchNumber
|
2020-07-15 00:33:57 -07:00
|
|
|
(JNIEnv*, jclass, jint matchNumber)
|
|
|
|
|
{
|
|
|
|
|
HALSIM_SetMatchNumber(matchNumber);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2020-07-15 00:33:57 -07:00
|
|
|
* Method: setReplayNumber
|
|
|
|
|
* Signature: (I)V
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_setReplayNumber
|
2020-07-15 00:33:57 -07:00
|
|
|
(JNIEnv*, jclass, jint replayNumber)
|
|
|
|
|
{
|
|
|
|
|
HALSIM_SetReplayNumber(replayNumber);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
2018-05-13 17:09:56 -07:00
|
|
|
* Method: resetData
|
|
|
|
|
* Signature: ()V
|
|
|
|
|
*/
|
2018-05-11 12:38:23 -07:00
|
|
|
JNIEXPORT void JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_resetData
|
2018-05-13 17:09:56 -07:00
|
|
|
(JNIEnv*, jclass)
|
|
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
HALSIM_ResetDriverStationData();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // extern "C"
|