2016-07-10 16:24:57 -07:00
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
/* Copyright (c) FIRST 2016. 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 <cstring>
|
|
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
|
#include <jni.h>
|
2016-07-14 00:17:29 -07:00
|
|
|
#include "HAL/cpp/Log.h"
|
2016-07-10 16:24:57 -07:00
|
|
|
|
|
|
|
|
#include "HAL/HAL.h"
|
2016-12-21 21:55:31 -08:00
|
|
|
#include "HAL/DriverStation.h"
|
2016-07-10 16:24:57 -07:00
|
|
|
#include "edu_wpi_first_wpilibj_hal_HAL.h"
|
|
|
|
|
#include "HALUtil.h"
|
2016-12-23 11:13:17 -08:00
|
|
|
#include "support/jni_util.h"
|
2016-07-10 16:24:57 -07:00
|
|
|
|
2016-10-31 23:04:49 -07:00
|
|
|
using namespace frc;
|
2016-12-23 11:13:17 -08:00
|
|
|
using namespace wpi::java;
|
2016-10-31 23:04:49 -07:00
|
|
|
|
2016-07-10 16:24:57 -07:00
|
|
|
// set the logging level
|
|
|
|
|
static TLogLevel netCommLogLevel = logWARNING;
|
|
|
|
|
|
|
|
|
|
#define NETCOMM_LOG(level) \
|
|
|
|
|
if (level > netCommLogLevel) \
|
|
|
|
|
; \
|
|
|
|
|
else \
|
|
|
|
|
Log().Get(level)
|
|
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_HAL
|
|
|
|
|
* Method: Initialize
|
2017-07-01 00:43:06 -07:00
|
|
|
* Signature: (Z)II
|
2016-07-10 16:24:57 -07:00
|
|
|
*/
|
2017-07-01 00:43:06 -07:00
|
|
|
JNIEXPORT jboolean JNICALL
|
|
|
|
|
Java_edu_wpi_first_wpilibj_hal_HAL_initialize(JNIEnv*, jclass, jint timeout, jint mode) {
|
|
|
|
|
return HAL_Initialize(timeout, mode);
|
2016-07-10 16:24:57 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_HAL
|
|
|
|
|
* Method: observeUserProgramStarting
|
|
|
|
|
* Signature: ()V
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL
|
|
|
|
|
Java_edu_wpi_first_wpilibj_hal_HAL_observeUserProgramStarting(JNIEnv*, jclass) {
|
|
|
|
|
HAL_ObserveUserProgramStarting();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_HAL
|
|
|
|
|
* Method: observeUserProgramDisabled
|
|
|
|
|
* Signature: ()V
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL
|
|
|
|
|
Java_edu_wpi_first_wpilibj_hal_HAL_observeUserProgramDisabled(JNIEnv*, jclass) {
|
|
|
|
|
HAL_ObserveUserProgramDisabled();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_HAL
|
|
|
|
|
* Method: observeUserProgramAutonomous
|
|
|
|
|
* Signature: ()V
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL
|
|
|
|
|
Java_edu_wpi_first_wpilibj_hal_HAL_observeUserProgramAutonomous(
|
|
|
|
|
JNIEnv*, jclass) {
|
|
|
|
|
HAL_ObserveUserProgramAutonomous();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_HAL
|
|
|
|
|
* Method: observeUserProgramTeleop
|
|
|
|
|
* Signature: ()V
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL
|
|
|
|
|
Java_edu_wpi_first_wpilibj_hal_HAL_observeUserProgramTeleop(JNIEnv*, jclass) {
|
|
|
|
|
HAL_ObserveUserProgramTeleop();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_HAL
|
|
|
|
|
* Method: observeUserProgramTest
|
|
|
|
|
* Signature: ()V
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL
|
|
|
|
|
Java_edu_wpi_first_wpilibj_hal_HAL_observeUserProgramTest(JNIEnv*, jclass) {
|
|
|
|
|
HAL_ObserveUserProgramTest();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_HAL
|
|
|
|
|
* Method: HAL_Report
|
|
|
|
|
* Signature: (IIILjava/lang/String;)I
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT jint JNICALL
|
|
|
|
|
Java_edu_wpi_first_wpilibj_hal_HAL_report(
|
|
|
|
|
JNIEnv* paramEnv, jclass, jint paramResource, jint paramInstanceNumber,
|
|
|
|
|
jint paramContext, jstring paramFeature) {
|
2016-12-23 11:13:17 -08:00
|
|
|
JStringRef featureStr{paramEnv, paramFeature};
|
2016-07-10 16:24:57 -07:00
|
|
|
NETCOMM_LOG(logDEBUG) << "Calling HAL report "
|
|
|
|
|
<< "res:" << paramResource
|
|
|
|
|
<< " instance:" << paramInstanceNumber
|
|
|
|
|
<< " context:" << paramContext
|
2016-12-23 11:13:17 -08:00
|
|
|
<< " feature:" << featureStr.c_str();
|
2016-07-10 16:24:57 -07:00
|
|
|
jint returnValue =
|
2016-12-23 11:13:17 -08:00
|
|
|
HAL_Report(paramResource, paramInstanceNumber, paramContext, featureStr.c_str());
|
2016-07-10 16:24:57 -07:00
|
|
|
return returnValue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_HAL
|
|
|
|
|
* Method: NativeGetControlWord
|
|
|
|
|
* Signature: ()I
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT jint JNICALL
|
|
|
|
|
Java_edu_wpi_first_wpilibj_hal_HAL_nativeGetControlWord(JNIEnv*, jclass) {
|
|
|
|
|
NETCOMM_LOG(logDEBUG) << "Calling HAL Control Word";
|
2017-11-09 19:59:29 -08:00
|
|
|
static_assert(sizeof(HAL_ControlWord) == sizeof(jint),
|
2017-07-26 20:59:40 -07:00
|
|
|
"Java int must match the size of control word");
|
2016-07-10 16:24:57 -07:00
|
|
|
HAL_ControlWord controlWord;
|
|
|
|
|
std::memset(&controlWord, 0, sizeof(HAL_ControlWord));
|
|
|
|
|
HAL_GetControlWord(&controlWord);
|
2017-07-26 20:59:40 -07:00
|
|
|
jint retVal = 0;
|
|
|
|
|
std::memcpy(&retVal, &controlWord, sizeof(HAL_ControlWord));
|
|
|
|
|
return retVal;
|
2016-07-10 16:24:57 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_HAL
|
|
|
|
|
* Method: NativeGetAllianceStation
|
|
|
|
|
* Signature: ()I
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT jint JNICALL
|
|
|
|
|
Java_edu_wpi_first_wpilibj_hal_HAL_nativeGetAllianceStation(JNIEnv*, jclass) {
|
|
|
|
|
NETCOMM_LOG(logDEBUG) << "Calling HAL Alliance Station";
|
|
|
|
|
int32_t status = 0;
|
|
|
|
|
auto allianceStation = HAL_GetAllianceStation(&status);
|
2017-07-26 20:59:40 -07:00
|
|
|
return static_cast<jint>(allianceStation);
|
2016-07-10 16:24:57 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_HAL
|
|
|
|
|
* Method: HAL_GetJoystickAxes
|
2016-07-13 23:39:58 -07:00
|
|
|
* Signature: (B[F)S
|
2016-07-10 16:24:57 -07:00
|
|
|
*/
|
|
|
|
|
JNIEXPORT jshort JNICALL
|
|
|
|
|
Java_edu_wpi_first_wpilibj_hal_HAL_getJoystickAxes(JNIEnv* env, jclass,
|
|
|
|
|
jbyte joystickNum,
|
|
|
|
|
jfloatArray axesArray) {
|
|
|
|
|
NETCOMM_LOG(logDEBUG) << "Calling HALJoystickAxes";
|
|
|
|
|
HAL_JoystickAxes axes;
|
|
|
|
|
HAL_GetJoystickAxes(joystickNum, &axes);
|
|
|
|
|
|
|
|
|
|
jsize javaSize = env->GetArrayLength(axesArray);
|
|
|
|
|
if (axes.count > javaSize)
|
|
|
|
|
{
|
|
|
|
|
ThrowIllegalArgumentException(env, "Native array size larger then passed in java array size");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
env->SetFloatArrayRegion(axesArray, 0, axes.count, axes.axes);
|
|
|
|
|
|
|
|
|
|
return axes.count;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_HAL
|
|
|
|
|
* Method: HAL_GetJoystickPOVs
|
|
|
|
|
* Signature: (B[S)S
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT jshort JNICALL
|
|
|
|
|
Java_edu_wpi_first_wpilibj_hal_HAL_getJoystickPOVs(JNIEnv* env, jclass,
|
|
|
|
|
jbyte joystickNum,
|
|
|
|
|
jshortArray povsArray) {
|
|
|
|
|
NETCOMM_LOG(logDEBUG) << "Calling HALJoystickPOVs";
|
|
|
|
|
HAL_JoystickPOVs povs;
|
|
|
|
|
HAL_GetJoystickPOVs(joystickNum, &povs);
|
|
|
|
|
|
|
|
|
|
jsize javaSize = env->GetArrayLength(povsArray);
|
|
|
|
|
if (povs.count > javaSize)
|
|
|
|
|
{
|
|
|
|
|
ThrowIllegalArgumentException(env, "Native array size larger then passed in java array size");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
env->SetShortArrayRegion(povsArray, 0, povs.count, povs.povs);
|
|
|
|
|
|
|
|
|
|
return povs.count;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_HAL
|
|
|
|
|
* Method: HAL_GetJoystickButtons
|
2016-11-10 23:21:54 -05:00
|
|
|
* Signature: (BL)I
|
2016-07-10 16:24:57 -07:00
|
|
|
*/
|
2016-11-10 23:21:54 -05:00
|
|
|
JNIEXPORT jint JNICALL
|
2016-07-10 16:24:57 -07:00
|
|
|
Java_edu_wpi_first_wpilibj_hal_HAL_getJoystickButtons(JNIEnv* env, jclass,
|
|
|
|
|
jbyte joystickNum,
|
|
|
|
|
jobject count) {
|
|
|
|
|
NETCOMM_LOG(logDEBUG) << "Calling HALJoystickButtons";
|
|
|
|
|
HAL_JoystickButtons joystickButtons;
|
|
|
|
|
HAL_GetJoystickButtons(joystickNum, &joystickButtons);
|
|
|
|
|
jbyte *countPtr = (jbyte *)env->GetDirectBufferAddress(count);
|
|
|
|
|
NETCOMM_LOG(logDEBUG) << "Buttons = " << joystickButtons.buttons;
|
|
|
|
|
NETCOMM_LOG(logDEBUG) << "Count = " << (jint)joystickButtons.count;
|
|
|
|
|
*countPtr = joystickButtons.count;
|
|
|
|
|
NETCOMM_LOG(logDEBUG) << "CountBuffer = " << (jint)*countPtr;
|
|
|
|
|
return joystickButtons.buttons;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_HAL
|
|
|
|
|
* Method: HAL_SetJoystickOutputs
|
|
|
|
|
* Signature: (BISS)I
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT jint JNICALL
|
|
|
|
|
Java_edu_wpi_first_wpilibj_hal_HAL_setJoystickOutputs(JNIEnv*, jclass,
|
|
|
|
|
jbyte port, jint outputs,
|
|
|
|
|
jshort leftRumble,
|
|
|
|
|
jshort rightRumble) {
|
|
|
|
|
NETCOMM_LOG(logDEBUG) << "Calling HAL_SetJoystickOutputs on port " << port;
|
|
|
|
|
NETCOMM_LOG(logDEBUG) << "Outputs: " << outputs;
|
|
|
|
|
NETCOMM_LOG(logDEBUG) << "Left Rumble: " << leftRumble
|
|
|
|
|
<< " Right Rumble: " << rightRumble;
|
|
|
|
|
return HAL_SetJoystickOutputs(port, outputs, leftRumble, rightRumble);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_HAL
|
|
|
|
|
* Method: HAL_GetJoystickIsXbox
|
|
|
|
|
* Signature: (B)I
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT jint JNICALL
|
|
|
|
|
Java_edu_wpi_first_wpilibj_hal_HAL_getJoystickIsXbox(JNIEnv*, jclass,
|
|
|
|
|
jbyte port) {
|
|
|
|
|
NETCOMM_LOG(logDEBUG) << "Calling HAL_GetJoystickIsXbox";
|
|
|
|
|
return HAL_GetJoystickIsXbox(port);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_HAL
|
|
|
|
|
* Method: HAL_GetJoystickType
|
|
|
|
|
* Signature: (B)I
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT jint JNICALL
|
|
|
|
|
Java_edu_wpi_first_wpilibj_hal_HAL_getJoystickType(JNIEnv*, jclass,
|
|
|
|
|
jbyte port) {
|
|
|
|
|
NETCOMM_LOG(logDEBUG) << "Calling HAL_GetJoystickType";
|
|
|
|
|
return HAL_GetJoystickType(port);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_HAL
|
|
|
|
|
* Method: HAL_GetJoystickName
|
|
|
|
|
* Signature: (B)Ljava/lang/String;
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT jstring JNICALL
|
|
|
|
|
Java_edu_wpi_first_wpilibj_hal_HAL_getJoystickName(JNIEnv* env, jclass,
|
|
|
|
|
jbyte port) {
|
|
|
|
|
NETCOMM_LOG(logDEBUG) << "Calling HAL_GetJoystickName";
|
|
|
|
|
char *joystickName = HAL_GetJoystickName(port);
|
2016-12-23 11:13:17 -08:00
|
|
|
jstring str = MakeJString(env, joystickName);
|
2017-06-30 16:11:16 -07:00
|
|
|
HAL_FreeJoystickName(joystickName);
|
2016-07-10 16:24:57 -07:00
|
|
|
return str;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_HAL
|
|
|
|
|
* Method: HAL_GetJoystickAxisType
|
|
|
|
|
* Signature: (BB)I
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT jint JNICALL
|
|
|
|
|
Java_edu_wpi_first_wpilibj_hal_HAL_getJoystickAxisType(JNIEnv*, jclass,
|
|
|
|
|
jbyte joystickNum,
|
|
|
|
|
jbyte axis) {
|
|
|
|
|
NETCOMM_LOG(logDEBUG) << "Calling HAL_GetJoystickAxisType";
|
|
|
|
|
return HAL_GetJoystickAxisType(joystickNum, axis);
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-08 20:21:47 -07:00
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_HAL
|
|
|
|
|
* Method: isNewControlData
|
|
|
|
|
* Signature: ()Z
|
|
|
|
|
*/
|
2017-11-09 19:59:29 -08:00
|
|
|
JNIEXPORT jboolean JNICALL
|
2017-05-08 20:21:47 -07:00
|
|
|
Java_edu_wpi_first_wpilibj_hal_HAL_isNewControlData(JNIEnv *, jclass) {
|
|
|
|
|
return static_cast<jboolean>(HAL_IsNewControlData());
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-10 16:24:57 -07:00
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_HAL
|
2017-05-08 20:21:47 -07:00
|
|
|
* Method: waitForDSData
|
2016-07-10 23:10:05 -07:00
|
|
|
* Signature: ()V
|
2016-07-10 16:24:57 -07:00
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL
|
2016-07-10 23:10:05 -07:00
|
|
|
Java_edu_wpi_first_wpilibj_hal_HAL_waitForDSData(JNIEnv* env, jclass) {
|
|
|
|
|
HAL_WaitForDSData();
|
2016-07-10 16:24:57 -07:00
|
|
|
}
|
|
|
|
|
|
2017-05-08 20:21:47 -07:00
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_HAL
|
|
|
|
|
* Method: releaseDSMutex
|
|
|
|
|
* Signature: ()V
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL
|
|
|
|
|
Java_edu_wpi_first_wpilibj_hal_HAL_releaseDSMutex(JNIEnv* env, jclass) {
|
|
|
|
|
HAL_ReleaseDSMutex();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_HAL
|
|
|
|
|
* Method: waitForDSDataTimeout
|
|
|
|
|
* Signature: (D)Z
|
|
|
|
|
*/
|
2017-11-09 19:59:29 -08:00
|
|
|
JNIEXPORT jboolean JNICALL
|
|
|
|
|
Java_edu_wpi_first_wpilibj_hal_HAL_waitForDSDataTimeout(JNIEnv *, jclass,
|
2017-05-08 20:21:47 -07:00
|
|
|
jdouble timeout) {
|
|
|
|
|
return static_cast<jboolean>(HAL_WaitForDSDataTimeout(timeout));
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-10 16:24:57 -07:00
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_HAL
|
|
|
|
|
* Method: HAL_GetMatchTime
|
2016-11-20 07:25:03 -08:00
|
|
|
* Signature: ()D
|
2016-07-10 16:24:57 -07:00
|
|
|
*/
|
2016-11-20 07:25:03 -08:00
|
|
|
JNIEXPORT jdouble JNICALL
|
2016-07-10 16:24:57 -07:00
|
|
|
Java_edu_wpi_first_wpilibj_hal_HAL_getMatchTime(JNIEnv* env, jclass) {
|
|
|
|
|
int32_t status = 0;
|
|
|
|
|
return HAL_GetMatchTime(&status);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_HAL
|
|
|
|
|
* Method: HAL_GetSystemActive
|
|
|
|
|
* Signature: ()Z
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT jboolean JNICALL
|
|
|
|
|
Java_edu_wpi_first_wpilibj_hal_HAL_getSystemActive(JNIEnv* env, jclass) {
|
|
|
|
|
int32_t status = 0;
|
|
|
|
|
bool val = HAL_GetSystemActive(&status);
|
|
|
|
|
CheckStatus(env, status);
|
|
|
|
|
return val;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_HAL
|
|
|
|
|
* Method: HAL_GetBrownedOut
|
|
|
|
|
* Signature: ()Z
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT jboolean JNICALL
|
|
|
|
|
Java_edu_wpi_first_wpilibj_hal_HAL_getBrownedOut(JNIEnv* env, jclass) {
|
|
|
|
|
int32_t status = 0;
|
|
|
|
|
bool val = HAL_GetBrownedOut(&status);
|
|
|
|
|
CheckStatus(env, status);
|
|
|
|
|
return val;
|
|
|
|
|
}
|
|
|
|
|
|
2017-11-09 19:59:29 -08:00
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_HAL
|
|
|
|
|
* Method: getMatchInfo
|
|
|
|
|
* Signature: (Ledu/wpi/first/wpilibj/hal/MatchInfoData;)I
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT jint JNICALL
|
|
|
|
|
Java_edu_wpi_first_wpilibj_hal_HAL_getMatchInfo
|
|
|
|
|
(JNIEnv * env, jclass, jobject info) {
|
|
|
|
|
HAL_MatchInfo matchInfo;
|
|
|
|
|
auto status = HAL_GetMatchInfo(&matchInfo);
|
|
|
|
|
if (status == 0) {
|
|
|
|
|
SetMatchInfoObject(env, info, matchInfo);
|
|
|
|
|
}
|
|
|
|
|
HAL_FreeMatchInfo(&matchInfo);
|
|
|
|
|
return status;
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-10 16:24:57 -07:00
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_HAL
|
|
|
|
|
* Method: HAL_SendError
|
|
|
|
|
* Signature: (ZIZLjava/lang/String;Ljava/lang/String;Ljava/lang/String;Z)I
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT jint JNICALL
|
|
|
|
|
Java_edu_wpi_first_wpilibj_hal_HAL_sendError(JNIEnv* env, jclass,
|
|
|
|
|
jboolean isError, jint errorCode,
|
|
|
|
|
jboolean isLVCode, jstring details,
|
|
|
|
|
jstring location,
|
|
|
|
|
jstring callStack,
|
|
|
|
|
jboolean printMsg) {
|
2016-12-23 11:13:17 -08:00
|
|
|
JStringRef detailsStr{env, details};
|
|
|
|
|
JStringRef locationStr{env, location};
|
|
|
|
|
JStringRef callStackStr{env, callStack};
|
|
|
|
|
|
|
|
|
|
NETCOMM_LOG(logDEBUG) << "Send Error: " << detailsStr.c_str();
|
|
|
|
|
NETCOMM_LOG(logDEBUG) << "Location: " << locationStr.c_str();
|
|
|
|
|
NETCOMM_LOG(logDEBUG) << "Call Stack: " << callStackStr.c_str();
|
|
|
|
|
jint returnValue = HAL_SendError(isError, errorCode, isLVCode, detailsStr.c_str(),
|
|
|
|
|
locationStr.c_str(), callStackStr.c_str(), printMsg);
|
2016-07-10 16:24:57 -07:00
|
|
|
return returnValue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // extern "C"
|