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>
|
|
|
|
|
|
|
|
|
|
#include "CallbackStore.h"
|
2020-06-27 22:11:24 -07:00
|
|
|
#include "edu_wpi_first_hal_simulation_AnalogInDataJNI.h"
|
|
|
|
|
#include "hal/simulation/AnalogInData.h"
|
2018-05-11 12:38:23 -07:00
|
|
|
|
2020-06-26 17:12:55 -07:00
|
|
|
using namespace hal;
|
|
|
|
|
|
2018-05-11 12:38:23 -07:00
|
|
|
extern "C" {
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2020-06-27 22:11:24 -07:00
|
|
|
* Class: edu_wpi_first_hal_simulation_AnalogInDataJNI
|
2018-05-13 17:09:56 -07:00
|
|
|
* Method: registerInitializedCallback
|
|
|
|
|
* Signature: (ILjava/lang/Object;Z)I
|
|
|
|
|
*/
|
2018-05-11 12:38:23 -07:00
|
|
|
JNIEXPORT jint JNICALL
|
2020-06-27 22:11:24 -07:00
|
|
|
Java_edu_wpi_first_hal_simulation_AnalogInDataJNI_registerInitializedCallback
|
2018-05-13 17:09:56 -07:00
|
|
|
(JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
|
|
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
return sim::AllocateCallback(env, index, callback, initialNotify,
|
|
|
|
|
&HALSIM_RegisterAnalogInInitializedCallback);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2020-06-27 22:11:24 -07:00
|
|
|
* Class: edu_wpi_first_hal_simulation_AnalogInDataJNI
|
2018-05-13 17:09:56 -07:00
|
|
|
* Method: cancelInitializedCallback
|
|
|
|
|
* Signature: (II)V
|
|
|
|
|
*/
|
2018-05-11 12:38:23 -07:00
|
|
|
JNIEXPORT void JNICALL
|
2020-06-27 22:11:24 -07:00
|
|
|
Java_edu_wpi_first_hal_simulation_AnalogInDataJNI_cancelInitializedCallback
|
2018-05-13 17:09:56 -07:00
|
|
|
(JNIEnv* env, jclass, jint index, jint handle)
|
|
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
return sim::FreeCallback(env, handle, index,
|
|
|
|
|
&HALSIM_CancelAnalogInInitializedCallback);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2020-06-27 22:11:24 -07:00
|
|
|
* Class: edu_wpi_first_hal_simulation_AnalogInDataJNI
|
2018-05-13 17:09:56 -07:00
|
|
|
* Method: getInitialized
|
|
|
|
|
* Signature: (I)Z
|
|
|
|
|
*/
|
2018-05-11 12:38:23 -07:00
|
|
|
JNIEXPORT jboolean JNICALL
|
2020-06-27 22:11:24 -07:00
|
|
|
Java_edu_wpi_first_hal_simulation_AnalogInDataJNI_getInitialized
|
2018-05-13 17:09:56 -07:00
|
|
|
(JNIEnv*, jclass, jint index)
|
|
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
return HALSIM_GetAnalogInInitialized(index);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2020-06-27 22:11:24 -07:00
|
|
|
* Class: edu_wpi_first_hal_simulation_AnalogInDataJNI
|
2018-05-13 17:09:56 -07:00
|
|
|
* Method: setInitialized
|
|
|
|
|
* Signature: (IZ)V
|
|
|
|
|
*/
|
2018-05-11 12:38:23 -07:00
|
|
|
JNIEXPORT void JNICALL
|
2020-06-27 22:11:24 -07:00
|
|
|
Java_edu_wpi_first_hal_simulation_AnalogInDataJNI_setInitialized
|
2018-05-13 17:09:56 -07:00
|
|
|
(JNIEnv*, jclass, jint index, jboolean value)
|
|
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
HALSIM_SetAnalogInInitialized(index, value);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2020-06-27 22:11:24 -07:00
|
|
|
* Class: edu_wpi_first_hal_simulation_AnalogInDataJNI
|
2018-05-13 17:09:56 -07:00
|
|
|
* Method: registerAverageBitsCallback
|
|
|
|
|
* Signature: (ILjava/lang/Object;Z)I
|
|
|
|
|
*/
|
2018-05-11 12:38:23 -07:00
|
|
|
JNIEXPORT jint JNICALL
|
2020-06-27 22:11:24 -07:00
|
|
|
Java_edu_wpi_first_hal_simulation_AnalogInDataJNI_registerAverageBitsCallback
|
2018-05-13 17:09:56 -07:00
|
|
|
(JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
|
|
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
return sim::AllocateCallback(env, index, callback, initialNotify,
|
|
|
|
|
&HALSIM_RegisterAnalogInAverageBitsCallback);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2020-06-27 22:11:24 -07:00
|
|
|
* Class: edu_wpi_first_hal_simulation_AnalogInDataJNI
|
2018-05-13 17:09:56 -07:00
|
|
|
* Method: cancelAverageBitsCallback
|
|
|
|
|
* Signature: (II)V
|
|
|
|
|
*/
|
2018-05-11 12:38:23 -07:00
|
|
|
JNIEXPORT void JNICALL
|
2020-06-27 22:11:24 -07:00
|
|
|
Java_edu_wpi_first_hal_simulation_AnalogInDataJNI_cancelAverageBitsCallback
|
2018-05-13 17:09:56 -07:00
|
|
|
(JNIEnv* env, jclass, jint index, jint handle)
|
|
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
return sim::FreeCallback(env, handle, index,
|
|
|
|
|
&HALSIM_CancelAnalogInAverageBitsCallback);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2020-06-27 22:11:24 -07:00
|
|
|
* Class: edu_wpi_first_hal_simulation_AnalogInDataJNI
|
2018-05-13 17:09:56 -07:00
|
|
|
* Method: getAverageBits
|
|
|
|
|
* Signature: (I)I
|
|
|
|
|
*/
|
2018-05-11 12:38:23 -07:00
|
|
|
JNIEXPORT jint JNICALL
|
2020-06-27 22:11:24 -07:00
|
|
|
Java_edu_wpi_first_hal_simulation_AnalogInDataJNI_getAverageBits
|
2018-05-13 17:09:56 -07:00
|
|
|
(JNIEnv*, jclass, jint index)
|
|
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
return HALSIM_GetAnalogInAverageBits(index);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2020-06-27 22:11:24 -07:00
|
|
|
* Class: edu_wpi_first_hal_simulation_AnalogInDataJNI
|
2018-05-13 17:09:56 -07:00
|
|
|
* Method: setAverageBits
|
|
|
|
|
* Signature: (II)V
|
|
|
|
|
*/
|
2018-05-11 12:38:23 -07:00
|
|
|
JNIEXPORT void JNICALL
|
2020-06-27 22:11:24 -07:00
|
|
|
Java_edu_wpi_first_hal_simulation_AnalogInDataJNI_setAverageBits
|
2018-05-13 17:09:56 -07:00
|
|
|
(JNIEnv*, jclass, jint index, jint value)
|
|
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
HALSIM_SetAnalogInAverageBits(index, value);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2020-06-27 22:11:24 -07:00
|
|
|
* Class: edu_wpi_first_hal_simulation_AnalogInDataJNI
|
2018-05-13 17:09:56 -07:00
|
|
|
* Method: registerOversampleBitsCallback
|
|
|
|
|
* Signature: (ILjava/lang/Object;Z)I
|
|
|
|
|
*/
|
2018-05-11 12:38:23 -07:00
|
|
|
JNIEXPORT jint JNICALL
|
2020-06-27 22:11:24 -07:00
|
|
|
Java_edu_wpi_first_hal_simulation_AnalogInDataJNI_registerOversampleBitsCallback
|
2018-05-13 17:09:56 -07:00
|
|
|
(JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
|
|
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
return sim::AllocateCallback(env, index, callback, initialNotify,
|
|
|
|
|
&HALSIM_RegisterAnalogInOversampleBitsCallback);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2020-06-27 22:11:24 -07:00
|
|
|
* Class: edu_wpi_first_hal_simulation_AnalogInDataJNI
|
2018-05-13 17:09:56 -07:00
|
|
|
* Method: cancelOversampleBitsCallback
|
|
|
|
|
* Signature: (II)V
|
|
|
|
|
*/
|
2018-05-11 12:38:23 -07:00
|
|
|
JNIEXPORT void JNICALL
|
2020-06-27 22:11:24 -07:00
|
|
|
Java_edu_wpi_first_hal_simulation_AnalogInDataJNI_cancelOversampleBitsCallback
|
2018-05-13 17:09:56 -07:00
|
|
|
(JNIEnv* env, jclass, jint index, jint handle)
|
|
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
return sim::FreeCallback(env, handle, index,
|
|
|
|
|
&HALSIM_CancelAnalogInOversampleBitsCallback);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2020-06-27 22:11:24 -07:00
|
|
|
* Class: edu_wpi_first_hal_simulation_AnalogInDataJNI
|
2018-05-13 17:09:56 -07:00
|
|
|
* Method: getOversampleBits
|
|
|
|
|
* Signature: (I)I
|
|
|
|
|
*/
|
2018-05-11 12:38:23 -07:00
|
|
|
JNIEXPORT jint JNICALL
|
2020-06-27 22:11:24 -07:00
|
|
|
Java_edu_wpi_first_hal_simulation_AnalogInDataJNI_getOversampleBits
|
2018-05-13 17:09:56 -07:00
|
|
|
(JNIEnv*, jclass, jint index)
|
|
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
return HALSIM_GetAnalogInOversampleBits(index);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2020-06-27 22:11:24 -07:00
|
|
|
* Class: edu_wpi_first_hal_simulation_AnalogInDataJNI
|
2018-05-13 17:09:56 -07:00
|
|
|
* Method: setOversampleBits
|
|
|
|
|
* Signature: (II)V
|
|
|
|
|
*/
|
2018-05-11 12:38:23 -07:00
|
|
|
JNIEXPORT void JNICALL
|
2020-06-27 22:11:24 -07:00
|
|
|
Java_edu_wpi_first_hal_simulation_AnalogInDataJNI_setOversampleBits
|
2018-05-13 17:09:56 -07:00
|
|
|
(JNIEnv*, jclass, jint index, jint value)
|
|
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
HALSIM_SetAnalogInOversampleBits(index, value);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2020-06-27 22:11:24 -07:00
|
|
|
* Class: edu_wpi_first_hal_simulation_AnalogInDataJNI
|
2018-05-13 17:09:56 -07:00
|
|
|
* Method: registerVoltageCallback
|
|
|
|
|
* Signature: (ILjava/lang/Object;Z)I
|
|
|
|
|
*/
|
2018-05-11 12:38:23 -07:00
|
|
|
JNIEXPORT jint JNICALL
|
2020-06-27 22:11:24 -07:00
|
|
|
Java_edu_wpi_first_hal_simulation_AnalogInDataJNI_registerVoltageCallback
|
2018-05-13 17:09:56 -07:00
|
|
|
(JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
|
|
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
return sim::AllocateCallback(env, index, callback, initialNotify,
|
|
|
|
|
&HALSIM_RegisterAnalogInVoltageCallback);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2020-06-27 22:11:24 -07:00
|
|
|
* Class: edu_wpi_first_hal_simulation_AnalogInDataJNI
|
2018-05-13 17:09:56 -07:00
|
|
|
* Method: cancelVoltageCallback
|
|
|
|
|
* Signature: (II)V
|
|
|
|
|
*/
|
2018-05-11 12:38:23 -07:00
|
|
|
JNIEXPORT void JNICALL
|
2020-06-27 22:11:24 -07:00
|
|
|
Java_edu_wpi_first_hal_simulation_AnalogInDataJNI_cancelVoltageCallback
|
2018-05-13 17:09:56 -07:00
|
|
|
(JNIEnv* env, jclass, jint index, jint handle)
|
|
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
return sim::FreeCallback(env, handle, index,
|
|
|
|
|
&HALSIM_CancelAnalogInVoltageCallback);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2020-06-27 22:11:24 -07:00
|
|
|
* Class: edu_wpi_first_hal_simulation_AnalogInDataJNI
|
2018-05-13 17:09:56 -07:00
|
|
|
* Method: getVoltage
|
|
|
|
|
* Signature: (I)D
|
|
|
|
|
*/
|
2018-05-11 12:38:23 -07:00
|
|
|
JNIEXPORT jdouble JNICALL
|
2020-06-27 22:11:24 -07:00
|
|
|
Java_edu_wpi_first_hal_simulation_AnalogInDataJNI_getVoltage
|
2018-05-13 17:09:56 -07:00
|
|
|
(JNIEnv*, jclass, jint index)
|
|
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
return HALSIM_GetAnalogInVoltage(index);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2020-06-27 22:11:24 -07:00
|
|
|
* Class: edu_wpi_first_hal_simulation_AnalogInDataJNI
|
2018-05-13 17:09:56 -07:00
|
|
|
* Method: setVoltage
|
|
|
|
|
* Signature: (ID)V
|
|
|
|
|
*/
|
2018-05-11 12:38:23 -07:00
|
|
|
JNIEXPORT void JNICALL
|
2020-06-27 22:11:24 -07:00
|
|
|
Java_edu_wpi_first_hal_simulation_AnalogInDataJNI_setVoltage
|
2018-05-13 17:09:56 -07:00
|
|
|
(JNIEnv*, jclass, jint index, jdouble value)
|
|
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
HALSIM_SetAnalogInVoltage(index, value);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2020-06-27 22:11:24 -07:00
|
|
|
* Class: edu_wpi_first_hal_simulation_AnalogInDataJNI
|
2018-05-13 17:09:56 -07:00
|
|
|
* Method: resetData
|
|
|
|
|
* Signature: (I)V
|
|
|
|
|
*/
|
2018-05-11 12:38:23 -07:00
|
|
|
JNIEXPORT void JNICALL
|
2020-06-27 22:11:24 -07:00
|
|
|
Java_edu_wpi_first_hal_simulation_AnalogInDataJNI_resetData
|
2018-05-13 17:09:56 -07:00
|
|
|
(JNIEnv*, jclass, jint index)
|
|
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
HALSIM_ResetAnalogInData(index);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // extern "C"
|