Files
allwpilib/hal/src/main/native/cpp/jni/simulation/PWMDataJNI.cpp

327 lines
8.6 KiB
C++
Raw Normal View History

// 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.
#include <jni.h>
#include "CallbackStore.h"
#include "edu_wpi_first_hal_simulation_PWMDataJNI.h"
#include "hal/simulation/PWMData.h"
using namespace hal;
extern "C" {
2018-05-13 17:09:56 -07:00
/*
* Class: edu_wpi_first_hal_simulation_PWMDataJNI
2018-05-13 17:09:56 -07:00
* Method: registerInitializedCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_simulation_PWMDataJNI_registerInitializedCallback
2018-05-13 17:09:56 -07:00
(JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterPWMInitializedCallback);
}
2018-05-13 17:09:56 -07:00
/*
* Class: edu_wpi_first_hal_simulation_PWMDataJNI
2018-05-13 17:09:56 -07:00
* Method: cancelInitializedCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_PWMDataJNI_cancelInitializedCallback
2018-05-13 17:09:56 -07:00
(JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index,
&HALSIM_CancelPWMInitializedCallback);
}
2018-05-13 17:09:56 -07:00
/*
* Class: edu_wpi_first_hal_simulation_PWMDataJNI
2018-05-13 17:09:56 -07:00
* Method: getInitialized
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_simulation_PWMDataJNI_getInitialized
2018-05-13 17:09:56 -07:00
(JNIEnv*, jclass, jint index)
{
return HALSIM_GetPWMInitialized(index);
}
2018-05-13 17:09:56 -07:00
/*
* Class: edu_wpi_first_hal_simulation_PWMDataJNI
2018-05-13 17:09:56 -07:00
* Method: setInitialized
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_PWMDataJNI_setInitialized
2018-05-13 17:09:56 -07:00
(JNIEnv*, jclass, jint index, jboolean value)
{
HALSIM_SetPWMInitialized(index, value);
}
2018-05-13 17:09:56 -07:00
/*
* Class: edu_wpi_first_hal_simulation_PWMDataJNI
2018-05-13 17:09:56 -07:00
* Method: registerRawValueCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_simulation_PWMDataJNI_registerRawValueCallback
2018-05-13 17:09:56 -07:00
(JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterPWMRawValueCallback);
}
2018-05-13 17:09:56 -07:00
/*
* Class: edu_wpi_first_hal_simulation_PWMDataJNI
2018-05-13 17:09:56 -07:00
* Method: cancelRawValueCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_PWMDataJNI_cancelRawValueCallback
2018-05-13 17:09:56 -07:00
(JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index,
&HALSIM_CancelPWMRawValueCallback);
}
2018-05-13 17:09:56 -07:00
/*
* Class: edu_wpi_first_hal_simulation_PWMDataJNI
2018-05-13 17:09:56 -07:00
* Method: getRawValue
* Signature: (I)I
*/
JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_simulation_PWMDataJNI_getRawValue
2018-05-13 17:09:56 -07:00
(JNIEnv*, jclass, jint index)
{
return HALSIM_GetPWMRawValue(index);
}
2018-05-13 17:09:56 -07:00
/*
* Class: edu_wpi_first_hal_simulation_PWMDataJNI
2018-05-13 17:09:56 -07:00
* Method: setRawValue
* Signature: (II)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_PWMDataJNI_setRawValue
2018-05-13 17:09:56 -07:00
(JNIEnv*, jclass, jint index, jint value)
{
HALSIM_SetPWMRawValue(index, value);
}
2018-05-13 17:09:56 -07:00
/*
* Class: edu_wpi_first_hal_simulation_PWMDataJNI
2018-05-13 17:09:56 -07:00
* Method: registerSpeedCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_simulation_PWMDataJNI_registerSpeedCallback
2018-05-13 17:09:56 -07:00
(JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterPWMSpeedCallback);
}
2018-05-13 17:09:56 -07:00
/*
* Class: edu_wpi_first_hal_simulation_PWMDataJNI
2018-05-13 17:09:56 -07:00
* Method: cancelSpeedCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_PWMDataJNI_cancelSpeedCallback
2018-05-13 17:09:56 -07:00
(JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, &HALSIM_CancelPWMSpeedCallback);
}
2018-05-13 17:09:56 -07:00
/*
* Class: edu_wpi_first_hal_simulation_PWMDataJNI
2018-05-13 17:09:56 -07:00
* Method: getSpeed
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_simulation_PWMDataJNI_getSpeed
2018-05-13 17:09:56 -07:00
(JNIEnv*, jclass, jint index)
{
return HALSIM_GetPWMSpeed(index);
}
2018-05-13 17:09:56 -07:00
/*
* Class: edu_wpi_first_hal_simulation_PWMDataJNI
2018-05-13 17:09:56 -07:00
* Method: setSpeed
* Signature: (ID)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_PWMDataJNI_setSpeed
2018-05-13 17:09:56 -07:00
(JNIEnv*, jclass, jint index, jdouble value)
{
HALSIM_SetPWMSpeed(index, value);
}
2018-05-13 17:09:56 -07:00
/*
* Class: edu_wpi_first_hal_simulation_PWMDataJNI
2018-05-13 17:09:56 -07:00
* Method: registerPositionCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_simulation_PWMDataJNI_registerPositionCallback
2018-05-13 17:09:56 -07:00
(JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterPWMPositionCallback);
}
2018-05-13 17:09:56 -07:00
/*
* Class: edu_wpi_first_hal_simulation_PWMDataJNI
2018-05-13 17:09:56 -07:00
* Method: cancelPositionCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_PWMDataJNI_cancelPositionCallback
2018-05-13 17:09:56 -07:00
(JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index,
&HALSIM_CancelPWMPositionCallback);
}
2018-05-13 17:09:56 -07:00
/*
* Class: edu_wpi_first_hal_simulation_PWMDataJNI
2018-05-13 17:09:56 -07:00
* Method: getPosition
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_simulation_PWMDataJNI_getPosition
2018-05-13 17:09:56 -07:00
(JNIEnv*, jclass, jint index)
{
return HALSIM_GetPWMPosition(index);
}
2018-05-13 17:09:56 -07:00
/*
* Class: edu_wpi_first_hal_simulation_PWMDataJNI
2018-05-13 17:09:56 -07:00
* Method: setPosition
* Signature: (ID)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_PWMDataJNI_setPosition
2018-05-13 17:09:56 -07:00
(JNIEnv*, jclass, jint index, jdouble value)
{
HALSIM_SetPWMPosition(index, value);
}
2018-05-13 17:09:56 -07:00
/*
* Class: edu_wpi_first_hal_simulation_PWMDataJNI
2018-05-13 17:09:56 -07:00
* Method: registerPeriodScaleCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_simulation_PWMDataJNI_registerPeriodScaleCallback
2018-05-13 17:09:56 -07:00
(JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterPWMPeriodScaleCallback);
}
2018-05-13 17:09:56 -07:00
/*
* Class: edu_wpi_first_hal_simulation_PWMDataJNI
2018-05-13 17:09:56 -07:00
* Method: cancelPeriodScaleCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_PWMDataJNI_cancelPeriodScaleCallback
2018-05-13 17:09:56 -07:00
(JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index,
&HALSIM_CancelPWMPeriodScaleCallback);
}
2018-05-13 17:09:56 -07:00
/*
* Class: edu_wpi_first_hal_simulation_PWMDataJNI
2018-05-13 17:09:56 -07:00
* Method: getPeriodScale
* Signature: (I)I
*/
JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_simulation_PWMDataJNI_getPeriodScale
2018-05-13 17:09:56 -07:00
(JNIEnv*, jclass, jint index)
{
return HALSIM_GetPWMPeriodScale(index);
}
2018-05-13 17:09:56 -07:00
/*
* Class: edu_wpi_first_hal_simulation_PWMDataJNI
2018-05-13 17:09:56 -07:00
* Method: setPeriodScale
* Signature: (II)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_PWMDataJNI_setPeriodScale
2018-05-13 17:09:56 -07:00
(JNIEnv*, jclass, jint index, jint value)
{
HALSIM_SetPWMPeriodScale(index, value);
}
2018-05-13 17:09:56 -07:00
/*
* Class: edu_wpi_first_hal_simulation_PWMDataJNI
2018-05-13 17:09:56 -07:00
* Method: registerZeroLatchCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_simulation_PWMDataJNI_registerZeroLatchCallback
2018-05-13 17:09:56 -07:00
(JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterPWMZeroLatchCallback);
}
2018-05-13 17:09:56 -07:00
/*
* Class: edu_wpi_first_hal_simulation_PWMDataJNI
2018-05-13 17:09:56 -07:00
* Method: cancelZeroLatchCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_PWMDataJNI_cancelZeroLatchCallback
2018-05-13 17:09:56 -07:00
(JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index,
&HALSIM_CancelPWMZeroLatchCallback);
}
2018-05-13 17:09:56 -07:00
/*
* Class: edu_wpi_first_hal_simulation_PWMDataJNI
2018-05-13 17:09:56 -07:00
* Method: getZeroLatch
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_simulation_PWMDataJNI_getZeroLatch
2018-05-13 17:09:56 -07:00
(JNIEnv*, jclass, jint index)
{
return HALSIM_GetPWMZeroLatch(index);
}
2018-05-13 17:09:56 -07:00
/*
* Class: edu_wpi_first_hal_simulation_PWMDataJNI
2018-05-13 17:09:56 -07:00
* Method: setZeroLatch
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_PWMDataJNI_setZeroLatch
2018-05-13 17:09:56 -07:00
(JNIEnv*, jclass, jint index, jboolean value)
{
HALSIM_SetPWMZeroLatch(index, value);
}
2018-05-13 17:09:56 -07:00
/*
* Class: edu_wpi_first_hal_simulation_PWMDataJNI
2018-05-13 17:09:56 -07:00
* Method: resetData
* Signature: (I)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_PWMDataJNI_resetData
2018-05-13 17:09:56 -07:00
(JNIEnv*, jclass, jint index)
{
HALSIM_ResetPWMData(index);
}
} // extern "C"