mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
Adds interrupts to Java
Implements the JNI bindings for java Adds integration tests for Digital Inputs and AnalogTriggers. Adds the ability to get the value and message from errno in java using the HALUtil JNI class. Change-Id: I853529fdab9744ce95ee15d4cc73dc3953265552
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
#include "Log.hpp"
|
||||
#include "edu_wpi_first_wpilibj_hal_HALUtil.h"
|
||||
#include "HAL/HAL.hpp"
|
||||
#include "errno.h"
|
||||
#include <string.h>
|
||||
|
||||
// set the logging level
|
||||
TLogLevel halUtilLogLevel = logWARNING;
|
||||
@@ -145,3 +147,27 @@ JNIEXPORT jstring JNICALL Java_edu_wpi_first_wpilibj_hal_HALUtil_getHALErrorMess
|
||||
HALUTIL_LOG(logDEBUG) << "Calling HALUtil getHALErrorMessage id=" << paramId << " msg=" << msg;
|
||||
return paramEnv->NewStringUTF(msg);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_wpilibj_hal_HALUtil
|
||||
* Method: getHALErrno
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_HALUtil_getHALErrno
|
||||
(JNIEnv *, jclass)
|
||||
{
|
||||
return errno;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_wpilibj_hal_HALUtil
|
||||
* Method: getHALstrerror
|
||||
* Signature: (I)Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_edu_wpi_first_wpilibj_hal_HALUtil_getHALstrerror
|
||||
(JNIEnv * env, jclass, jint errorCode)
|
||||
{
|
||||
const char * msg = strerror(errno);
|
||||
HALUTIL_LOG(logDEBUG) << "Calling HALUtil getHALstrerror errorCode=" << errorCode << " msg=" << msg;
|
||||
return env->NewStringUTF(msg);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user