[hal] Rename PowerDistributionPanel to PowerDistribution (#3466)

Makes HAL more generic for the PDP, to enable the Rev PDH in the future.
This commit is contained in:
Thad House
2021-08-04 20:31:17 -07:00
committed by GitHub
parent 2014115bca
commit 1ac73a247e
50 changed files with 1612 additions and 1177 deletions

View File

@@ -1,190 +0,0 @@
// 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 "HALUtil.h"
#include "edu_wpi_first_hal_PDPJNI.h"
#include "hal/PDP.h"
#include "hal/Ports.h"
using namespace hal;
extern "C" {
/*
* Class: edu_wpi_first_hal_PDPJNI
* Method: initializePDP
* Signature: (I)I
*/
JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_PDPJNI_initializePDP
(JNIEnv* env, jclass, jint module)
{
int32_t status = 0;
auto handle = HAL_InitializePDP(module, &status);
CheckStatusRange(env, status, 0, HAL_GetNumPDPModules(), module);
return static_cast<jint>(handle);
}
/*
* Class: edu_wpi_first_hal_PDPJNI
* Method: checkPDPChannel
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_PDPJNI_checkPDPChannel
(JNIEnv* env, jclass, jint channel)
{
return HAL_CheckPDPChannel(channel);
}
/*
* Class: edu_wpi_first_hal_PDPJNI
* Method: checkPDPModule
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_PDPJNI_checkPDPModule
(JNIEnv* env, jclass, jint module)
{
return HAL_CheckPDPModule(module);
}
/*
* Class: edu_wpi_first_hal_PDPJNI
* Method: getPDPTemperature
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_PDPJNI_getPDPTemperature
(JNIEnv* env, jclass, jint handle)
{
int32_t status = 0;
double temperature = HAL_GetPDPTemperature(handle, &status);
CheckStatus(env, status, false);
return temperature;
}
/*
* Class: edu_wpi_first_hal_PDPJNI
* Method: getPDPVoltage
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_PDPJNI_getPDPVoltage
(JNIEnv* env, jclass, jint handle)
{
int32_t status = 0;
double voltage = HAL_GetPDPVoltage(handle, &status);
CheckStatus(env, status, false);
return voltage;
}
/*
* Class: edu_wpi_first_hal_PDPJNI
* Method: getPDPChannelCurrent
* Signature: (BI)D
*/
JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_PDPJNI_getPDPChannelCurrent
(JNIEnv* env, jclass, jbyte channel, jint handle)
{
int32_t status = 0;
double current = HAL_GetPDPChannelCurrent(handle, channel, &status);
CheckStatus(env, status, false);
return current;
}
/*
* Class: edu_wpi_first_hal_PDPJNI
* Method: getPDPAllCurrents
* Signature: (I[D)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_PDPJNI_getPDPAllCurrents
(JNIEnv* env, jclass, jint handle, jdoubleArray jarr)
{
double storage[16];
int32_t status = 0;
HAL_GetPDPAllChannelCurrents(handle, storage, &status);
if (!CheckStatus(env, status, false)) {
return;
}
env->SetDoubleArrayRegion(jarr, 0, 16, storage);
}
/*
* Class: edu_wpi_first_hal_PDPJNI
* Method: getPDPTotalCurrent
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_PDPJNI_getPDPTotalCurrent
(JNIEnv* env, jclass, jint handle)
{
int32_t status = 0;
double current = HAL_GetPDPTotalCurrent(handle, &status);
CheckStatus(env, status, false);
return current;
}
/*
* Class: edu_wpi_first_hal_PDPJNI
* Method: getPDPTotalPower
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_PDPJNI_getPDPTotalPower
(JNIEnv* env, jclass, jint handle)
{
int32_t status = 0;
double power = HAL_GetPDPTotalPower(handle, &status);
CheckStatus(env, status, false);
return power;
}
/*
* Class: edu_wpi_first_hal_PDPJNI
* Method: getPDPTotalEnergy
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_PDPJNI_getPDPTotalEnergy
(JNIEnv* env, jclass, jint handle)
{
int32_t status = 0;
double energy = HAL_GetPDPTotalEnergy(handle, &status);
CheckStatus(env, status, false);
return energy;
}
/*
* Class: edu_wpi_first_hal_PDPJNI
* Method: resetPDPTotalEnergy
* Signature: (I)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_PDPJNI_resetPDPTotalEnergy
(JNIEnv* env, jclass, jint handle)
{
int32_t status = 0;
HAL_ResetPDPTotalEnergy(handle, &status);
CheckStatus(env, status, false);
}
/*
* Class: edu_wpi_first_hal_PDPJNI
* Method: clearPDPStickyFaults
* Signature: (I)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_PDPJNI_clearPDPStickyFaults
(JNIEnv* env, jclass, jint handle)
{
int32_t status = 0;
HAL_ClearPDPStickyFaults(handle, &status);
CheckStatus(env, status, false);
}
} // extern "C"

View File

@@ -0,0 +1,209 @@
// 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 "HALUtil.h"
#include "edu_wpi_first_hal_PowerDistributionJNI.h"
#include "hal/Ports.h"
#include "hal/PowerDistribution.h"
using namespace hal;
extern "C" {
/*
* Class: edu_wpi_first_hal_PowerDistributionJNI
* Method: initialize
* Signature: (II)I
*/
JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_PowerDistributionJNI_initialize
(JNIEnv* env, jclass, jint module, jint type)
{
int32_t status = 0;
auto handle = HAL_InitializePowerDistribution(
module, static_cast<HAL_PowerDistributionType>(type), &status);
CheckStatusForceThrow(env, status);
return static_cast<jint>(handle);
}
/*
* Class: edu_wpi_first_hal_PowerDistributionJNI
* Method: checkChannel
* Signature: (II)Z
*/
JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_PowerDistributionJNI_checkChannel
(JNIEnv* env, jclass, jint handle, jint channel)
{
return HAL_CheckPowerDistributionChannel(handle, channel);
}
/*
* Class: edu_wpi_first_hal_PowerDistributionJNI
* Method: checkModule
* Signature: (II)Z
*/
JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_PowerDistributionJNI_checkModule
(JNIEnv* env, jclass, jint module, jint type)
{
return HAL_CheckPowerDistributionModule(
module, static_cast<HAL_PowerDistributionType>(type));
}
/*
* Class: edu_wpi_first_hal_PowerDistributionJNI
* Method: getType
* Signature: (I)I
*/
JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_PowerDistributionJNI_getType
(JNIEnv* env, jclass, jint handle)
{
int32_t status = 0;
auto result = HAL_GetPowerDistributionType(handle, &status);
CheckStatus(env, status);
return result;
}
/*
* Class: edu_wpi_first_hal_PowerDistributionJNI
* Method: getTemperature
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_PowerDistributionJNI_getTemperature
(JNIEnv* env, jclass, jint handle)
{
int32_t status = 0;
double temperature = HAL_GetPowerDistributionTemperature(handle, &status);
CheckStatus(env, status, false);
return temperature;
}
/*
* Class: edu_wpi_first_hal_PowerDistributionJNI
* Method: getVoltage
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_PowerDistributionJNI_getVoltage
(JNIEnv* env, jclass, jint handle)
{
int32_t status = 0;
double voltage = HAL_GetPowerDistributionVoltage(handle, &status);
CheckStatus(env, status, false);
return voltage;
}
/*
* Class: edu_wpi_first_hal_PowerDistributionJNI
* Method: getChannelCurrent
* Signature: (BI)D
*/
JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_PowerDistributionJNI_getChannelCurrent
(JNIEnv* env, jclass, jbyte channel, jint handle)
{
int32_t status = 0;
double current =
HAL_GetPowerDistributionChannelCurrent(handle, channel, &status);
CheckStatus(env, status, false);
return current;
}
/*
* Class: edu_wpi_first_hal_PowerDistributionJNI
* Method: getAllCurrents
* Signature: (I[D)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_PowerDistributionJNI_getAllCurrents
(JNIEnv* env, jclass, jint handle, jdoubleArray jarr)
{
double storage[16];
int32_t status = 0;
// TODO fix me
HAL_GetPowerDistributionAllChannelCurrents(handle, storage, 16, &status);
if (!CheckStatus(env, status, false)) {
return;
}
env->SetDoubleArrayRegion(jarr, 0, 16, storage);
}
/*
* Class: edu_wpi_first_hal_PowerDistributionJNI
* Method: getTotalCurrent
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_PowerDistributionJNI_getTotalCurrent
(JNIEnv* env, jclass, jint handle)
{
int32_t status = 0;
double current = HAL_GetPowerDistributionTotalCurrent(handle, &status);
CheckStatus(env, status, false);
return current;
}
/*
* Class: edu_wpi_first_hal_PowerDistributionJNI
* Method: getTotalPower
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_PowerDistributionJNI_getTotalPower
(JNIEnv* env, jclass, jint handle)
{
int32_t status = 0;
double power = HAL_GetPowerDistributionTotalPower(handle, &status);
CheckStatus(env, status, false);
return power;
}
/*
* Class: edu_wpi_first_hal_PowerDistributionJNI
* Method: getTotalEnergy
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_PowerDistributionJNI_getTotalEnergy
(JNIEnv* env, jclass, jint handle)
{
int32_t status = 0;
double energy = HAL_GetPowerDistributionTotalEnergy(handle, &status);
CheckStatus(env, status, false);
return energy;
}
/*
* Class: edu_wpi_first_hal_PowerDistributionJNI
* Method: resetTotalEnergy
* Signature: (I)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_PowerDistributionJNI_resetTotalEnergy
(JNIEnv* env, jclass, jint handle)
{
int32_t status = 0;
HAL_ResetPowerDistributionTotalEnergy(handle, &status);
CheckStatus(env, status, false);
}
/*
* Class: edu_wpi_first_hal_PowerDistributionJNI
* Method: clearStickyFaults
* Signature: (I)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_PowerDistributionJNI_clearStickyFaults
(JNIEnv* env, jclass, jint handle)
{
int32_t status = 0;
HAL_ClearPowerDistributionStickyFaults(handle, &status);
CheckStatus(env, status, false);
}
} // extern "C"

View File

@@ -1,229 +0,0 @@
// 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_PDPDataJNI.h"
#include "hal/simulation/PDPData.h"
using namespace hal;
extern "C" {
/*
* Class: edu_wpi_first_hal_simulation_PDPDataJNI
* Method: registerInitializedCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_simulation_PDPDataJNI_registerInitializedCallback
(JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterPDPInitializedCallback);
}
/*
* Class: edu_wpi_first_hal_simulation_PDPDataJNI
* Method: cancelInitializedCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_PDPDataJNI_cancelInitializedCallback
(JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index,
&HALSIM_CancelPDPInitializedCallback);
}
/*
* Class: edu_wpi_first_hal_simulation_PDPDataJNI
* Method: getInitialized
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_simulation_PDPDataJNI_getInitialized
(JNIEnv*, jclass, jint index)
{
return HALSIM_GetPDPInitialized(index);
}
/*
* Class: edu_wpi_first_hal_simulation_PDPDataJNI
* Method: setInitialized
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_PDPDataJNI_setInitialized
(JNIEnv*, jclass, jint index, jboolean value)
{
HALSIM_SetPDPInitialized(index, value);
}
/*
* Class: edu_wpi_first_hal_simulation_PDPDataJNI
* Method: registerTemperatureCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_simulation_PDPDataJNI_registerTemperatureCallback
(JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterPDPTemperatureCallback);
}
/*
* Class: edu_wpi_first_hal_simulation_PDPDataJNI
* Method: cancelTemperatureCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_PDPDataJNI_cancelTemperatureCallback
(JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index,
&HALSIM_CancelPDPTemperatureCallback);
}
/*
* Class: edu_wpi_first_hal_simulation_PDPDataJNI
* Method: getTemperature
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_simulation_PDPDataJNI_getTemperature
(JNIEnv*, jclass, jint index)
{
return HALSIM_GetPDPTemperature(index);
}
/*
* Class: edu_wpi_first_hal_simulation_PDPDataJNI
* Method: setTemperature
* Signature: (ID)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_PDPDataJNI_setTemperature
(JNIEnv*, jclass, jint index, jdouble value)
{
HALSIM_SetPDPTemperature(index, value);
}
/*
* Class: edu_wpi_first_hal_simulation_PDPDataJNI
* Method: registerVoltageCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_simulation_PDPDataJNI_registerVoltageCallback
(JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterPDPVoltageCallback);
}
/*
* Class: edu_wpi_first_hal_simulation_PDPDataJNI
* Method: cancelVoltageCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_PDPDataJNI_cancelVoltageCallback
(JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index,
&HALSIM_CancelPDPVoltageCallback);
}
/*
* Class: edu_wpi_first_hal_simulation_PDPDataJNI
* Method: getVoltage
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_simulation_PDPDataJNI_getVoltage
(JNIEnv*, jclass, jint index)
{
return HALSIM_GetPDPVoltage(index);
}
/*
* Class: edu_wpi_first_hal_simulation_PDPDataJNI
* Method: setVoltage
* Signature: (ID)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_PDPDataJNI_setVoltage
(JNIEnv*, jclass, jint index, jdouble value)
{
HALSIM_SetPDPVoltage(index, value);
}
/*
* Class: edu_wpi_first_hal_simulation_PDPDataJNI
* Method: registerCurrentCallback
* Signature: (IILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_simulation_PDPDataJNI_registerCurrentCallback
(JNIEnv* env, jclass, jint index, jint channel, jobject callback,
jboolean initialNotify)
{
return sim::AllocateChannelCallback(env, index, channel, callback,
initialNotify,
&HALSIM_RegisterPDPCurrentCallback);
}
/*
* Class: edu_wpi_first_hal_simulation_PDPDataJNI
* Method: cancelCurrentCallback
* Signature: (III)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_PDPDataJNI_cancelCurrentCallback
(JNIEnv* env, jclass, jint index, jint channel, jint handle)
{
return sim::FreeChannelCallback(env, handle, index, channel,
&HALSIM_CancelPDPCurrentCallback);
}
/*
* Class: edu_wpi_first_hal_simulation_PDPDataJNI
* Method: getCurrent
* Signature: (II)D
*/
JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_simulation_PDPDataJNI_getCurrent
(JNIEnv*, jclass, jint index, jint channel)
{
return HALSIM_GetPDPCurrent(index, channel);
}
/*
* Class: edu_wpi_first_hal_simulation_PDPDataJNI
* Method: setCurrent
* Signature: (IID)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_PDPDataJNI_setCurrent
(JNIEnv*, jclass, jint index, jint channel, jdouble value)
{
HALSIM_SetPDPCurrent(index, channel, value);
}
/*
* Class: edu_wpi_first_hal_simulation_PDPDataJNI
* Method: resetData
* Signature: (I)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_PDPDataJNI_resetData
(JNIEnv*, jclass, jint index)
{
HALSIM_ResetPDPData(index);
}
} // extern "C"

View File

@@ -0,0 +1,233 @@
// 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_PowerDistributionDataJNI.h"
#include "hal/simulation/PowerDistributionData.h"
using namespace hal;
extern "C" {
/*
* Class: edu_wpi_first_hal_simulation_PowerDistributionDataJNI
* Method: registerInitializedCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_simulation_PowerDistributionDataJNI_registerInitializedCallback
(JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(
env, index, callback, initialNotify,
&HALSIM_RegisterPowerDistributionInitializedCallback);
}
/*
* Class: edu_wpi_first_hal_simulation_PowerDistributionDataJNI
* Method: cancelInitializedCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_PowerDistributionDataJNI_cancelInitializedCallback
(JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index,
&HALSIM_CancelPowerDistributionInitializedCallback);
}
/*
* Class: edu_wpi_first_hal_simulation_PowerDistributionDataJNI
* Method: getInitialized
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_simulation_PowerDistributionDataJNI_getInitialized
(JNIEnv*, jclass, jint index)
{
return HALSIM_GetPowerDistributionInitialized(index);
}
/*
* Class: edu_wpi_first_hal_simulation_PowerDistributionDataJNI
* Method: setInitialized
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_PowerDistributionDataJNI_setInitialized
(JNIEnv*, jclass, jint index, jboolean value)
{
HALSIM_SetPowerDistributionInitialized(index, value);
}
/*
* Class: edu_wpi_first_hal_simulation_PowerDistributionDataJNI
* Method: registerTemperatureCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_simulation_PowerDistributionDataJNI_registerTemperatureCallback
(JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(
env, index, callback, initialNotify,
&HALSIM_RegisterPowerDistributionTemperatureCallback);
}
/*
* Class: edu_wpi_first_hal_simulation_PowerDistributionDataJNI
* Method: cancelTemperatureCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_PowerDistributionDataJNI_cancelTemperatureCallback
(JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index,
&HALSIM_CancelPowerDistributionTemperatureCallback);
}
/*
* Class: edu_wpi_first_hal_simulation_PowerDistributionDataJNI
* Method: getTemperature
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_simulation_PowerDistributionDataJNI_getTemperature
(JNIEnv*, jclass, jint index)
{
return HALSIM_GetPowerDistributionTemperature(index);
}
/*
* Class: edu_wpi_first_hal_simulation_PowerDistributionDataJNI
* Method: setTemperature
* Signature: (ID)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_PowerDistributionDataJNI_setTemperature
(JNIEnv*, jclass, jint index, jdouble value)
{
HALSIM_SetPowerDistributionTemperature(index, value);
}
/*
* Class: edu_wpi_first_hal_simulation_PowerDistributionDataJNI
* Method: registerVoltageCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_simulation_PowerDistributionDataJNI_registerVoltageCallback
(JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(
env, index, callback, initialNotify,
&HALSIM_RegisterPowerDistributionVoltageCallback);
}
/*
* Class: edu_wpi_first_hal_simulation_PowerDistributionDataJNI
* Method: cancelVoltageCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_PowerDistributionDataJNI_cancelVoltageCallback
(JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index,
&HALSIM_CancelPowerDistributionVoltageCallback);
}
/*
* Class: edu_wpi_first_hal_simulation_PowerDistributionDataJNI
* Method: getVoltage
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_simulation_PowerDistributionDataJNI_getVoltage
(JNIEnv*, jclass, jint index)
{
return HALSIM_GetPowerDistributionVoltage(index);
}
/*
* Class: edu_wpi_first_hal_simulation_PowerDistributionDataJNI
* Method: setVoltage
* Signature: (ID)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_PowerDistributionDataJNI_setVoltage
(JNIEnv*, jclass, jint index, jdouble value)
{
HALSIM_SetPowerDistributionVoltage(index, value);
}
/*
* Class: edu_wpi_first_hal_simulation_PowerDistributionDataJNI
* Method: registerCurrentCallback
* Signature: (IILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_simulation_PowerDistributionDataJNI_registerCurrentCallback
(JNIEnv* env, jclass, jint index, jint channel, jobject callback,
jboolean initialNotify)
{
return sim::AllocateChannelCallback(
env, index, channel, callback, initialNotify,
&HALSIM_RegisterPowerDistributionCurrentCallback);
}
/*
* Class: edu_wpi_first_hal_simulation_PowerDistributionDataJNI
* Method: cancelCurrentCallback
* Signature: (III)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_PowerDistributionDataJNI_cancelCurrentCallback
(JNIEnv* env, jclass, jint index, jint channel, jint handle)
{
return sim::FreeChannelCallback(
env, handle, index, channel,
&HALSIM_CancelPowerDistributionCurrentCallback);
}
/*
* Class: edu_wpi_first_hal_simulation_PowerDistributionDataJNI
* Method: getCurrent
* Signature: (II)D
*/
JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_simulation_PowerDistributionDataJNI_getCurrent
(JNIEnv*, jclass, jint index, jint channel)
{
return HALSIM_GetPowerDistributionCurrent(index, channel);
}
/*
* Class: edu_wpi_first_hal_simulation_PowerDistributionDataJNI
* Method: setCurrent
* Signature: (IID)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_PowerDistributionDataJNI_setCurrent
(JNIEnv*, jclass, jint index, jint channel, jdouble value)
{
HALSIM_SetPowerDistributionCurrent(index, channel, value);
}
/*
* Class: edu_wpi_first_hal_simulation_PowerDistributionDataJNI
* Method: resetData
* Signature: (I)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_PowerDistributionDataJNI_resetData
(JNIEnv*, jclass, jint index)
{
HALSIM_ResetPowerDistributionData(index);
}
} // extern "C"