2018-05-11 12:38:23 -07:00
|
|
|
/*----------------------------------------------------------------------------*/
|
2020-06-26 17:12:55 -07:00
|
|
|
/* Copyright (c) 2018-2020 FIRST. All Rights Reserved. */
|
2018-05-11 12:38:23 -07:00
|
|
|
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
|
|
|
|
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
|
|
|
|
/* the project. */
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
#include <jni.h>
|
|
|
|
|
|
|
|
|
|
#include "CallbackStore.h"
|
2020-06-27 22:11:24 -07:00
|
|
|
#include "edu_wpi_first_hal_simulation_AnalogOutDataJNI.h"
|
|
|
|
|
#include "hal/simulation/AnalogOutData.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_AnalogOutDataJNI
|
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_AnalogOutDataJNI_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_RegisterAnalogOutVoltageCallback);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2020-06-27 22:11:24 -07:00
|
|
|
* Class: edu_wpi_first_hal_simulation_AnalogOutDataJNI
|
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_AnalogOutDataJNI_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_CancelAnalogOutVoltageCallback);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2020-06-27 22:11:24 -07:00
|
|
|
* Class: edu_wpi_first_hal_simulation_AnalogOutDataJNI
|
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_AnalogOutDataJNI_getVoltage
|
2018-05-13 17:09:56 -07:00
|
|
|
(JNIEnv*, jclass, jint index)
|
|
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
return HALSIM_GetAnalogOutVoltage(index);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2020-06-27 22:11:24 -07:00
|
|
|
* Class: edu_wpi_first_hal_simulation_AnalogOutDataJNI
|
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_AnalogOutDataJNI_setVoltage
|
2018-05-13 17:09:56 -07:00
|
|
|
(JNIEnv*, jclass, jint index, jdouble value)
|
|
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
HALSIM_SetAnalogOutVoltage(index, value);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2020-06-27 22:11:24 -07:00
|
|
|
* Class: edu_wpi_first_hal_simulation_AnalogOutDataJNI
|
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_AnalogOutDataJNI_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_RegisterAnalogOutInitializedCallback);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2020-06-27 22:11:24 -07:00
|
|
|
* Class: edu_wpi_first_hal_simulation_AnalogOutDataJNI
|
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_AnalogOutDataJNI_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_CancelAnalogOutInitializedCallback);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2020-06-27 22:11:24 -07:00
|
|
|
* Class: edu_wpi_first_hal_simulation_AnalogOutDataJNI
|
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_AnalogOutDataJNI_getInitialized
|
2018-05-13 17:09:56 -07:00
|
|
|
(JNIEnv*, jclass, jint index)
|
|
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
return HALSIM_GetAnalogOutInitialized(index);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2020-06-27 22:11:24 -07:00
|
|
|
* Class: edu_wpi_first_hal_simulation_AnalogOutDataJNI
|
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_AnalogOutDataJNI_setInitialized
|
2018-05-13 17:09:56 -07:00
|
|
|
(JNIEnv*, jclass, jint index, jboolean value)
|
|
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
HALSIM_SetAnalogOutInitialized(index, value);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/*
|
2020-06-27 22:11:24 -07:00
|
|
|
* Class: edu_wpi_first_hal_simulation_AnalogOutDataJNI
|
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_AnalogOutDataJNI_resetData
|
2018-05-13 17:09:56 -07:00
|
|
|
(JNIEnv*, jclass, jint index)
|
|
|
|
|
{
|
2018-05-11 12:38:23 -07:00
|
|
|
HALSIM_ResetAnalogOutData(index);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // extern "C"
|