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

134 lines
3.8 KiB
C++
Raw Normal View History

/*----------------------------------------------------------------------------*/
/* Copyright (c) 2018-2020 FIRST. All Rights Reserved. */
/* 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 "BufferCallbackStore.h"
#include "CallbackStore.h"
#include "ConstBufferCallbackStore.h"
#include "edu_wpi_first_hal_simulation_I2CDataJNI.h"
#include "hal/simulation/I2CData.h"
using namespace hal;
extern "C" {
/*
* Class: edu_wpi_first_hal_simulation_I2CDataJNI
* Method: registerInitializedCallback
2018-05-13 17:09:56 -07:00
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_simulation_I2CDataJNI_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_RegisterI2CInitializedCallback);
}
/*
* Class: edu_wpi_first_hal_simulation_I2CDataJNI
* Method: cancelInitializedCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_I2CDataJNI_cancelInitializedCallback
2018-05-13 17:09:56 -07:00
(JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index,
&HALSIM_CancelI2CInitializedCallback);
}
/*
* Class: edu_wpi_first_hal_simulation_I2CDataJNI
* Method: getInitialized
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_simulation_I2CDataJNI_getInitialized
2018-05-13 17:09:56 -07:00
(JNIEnv*, jclass, jint index)
{
return HALSIM_GetI2CInitialized(index);
}
/*
* Class: edu_wpi_first_hal_simulation_I2CDataJNI
* Method: setInitialized
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_I2CDataJNI_setInitialized
2018-05-13 17:09:56 -07:00
(JNIEnv*, jclass, jint index, jboolean value)
{
HALSIM_SetI2CInitialized(index, value);
}
/*
* Class: edu_wpi_first_hal_simulation_I2CDataJNI
* Method: registerReadCallback
2018-05-13 17:09:56 -07:00
* Signature: (ILjava/lang/Object;)I
*/
JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_simulation_I2CDataJNI_registerReadCallback
2018-05-13 17:09:56 -07:00
(JNIEnv* env, jclass, jint index, jobject callback)
{
return sim::AllocateBufferCallback(env, index, callback,
&HALSIM_RegisterI2CReadCallback);
}
/*
* Class: edu_wpi_first_hal_simulation_I2CDataJNI
* Method: cancelReadCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_I2CDataJNI_cancelReadCallback
2018-05-13 17:09:56 -07:00
(JNIEnv* env, jclass, jint index, jint handle)
{
sim::FreeBufferCallback(env, handle, index, &HALSIM_CancelI2CReadCallback);
}
/*
* Class: edu_wpi_first_hal_simulation_I2CDataJNI
* Method: registerWriteCallback
2018-05-13 17:09:56 -07:00
* Signature: (ILjava/lang/Object;)I
*/
JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_simulation_I2CDataJNI_registerWriteCallback
2018-05-13 17:09:56 -07:00
(JNIEnv* env, jclass, jint index, jobject callback)
{
return sim::AllocateConstBufferCallback(env, index, callback,
&HALSIM_RegisterI2CWriteCallback);
}
/*
* Class: edu_wpi_first_hal_simulation_I2CDataJNI
* Method: cancelWriteCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_I2CDataJNI_cancelWriteCallback
2018-05-13 17:09:56 -07:00
(JNIEnv* env, jclass, jint index, jint handle)
{
sim::FreeConstBufferCallback(env, handle, index,
&HALSIM_CancelI2CWriteCallback);
}
/*
* Class: edu_wpi_first_hal_simulation_I2CDataJNI
* Method: resetData
* Signature: (I)V
*/
2018-05-13 17:09:56 -07:00
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_I2CDataJNI_resetData
2018-05-13 17:09:56 -07:00
(JNIEnv*, jclass, jint index)
{
HALSIM_ResetI2CData(index);
}
} // extern "C"