Run wpiformat on merged repo (#1021)

This commit is contained in:
Tyler Veness
2018-05-13 17:09:56 -07:00
committed by Peter Johnson
parent 0babbf317c
commit 6729a7d6b1
481 changed files with 9581 additions and 6828 deletions

View File

@@ -9,33 +9,25 @@ cppSrcFileInclude {
} }
generatedFileExclude { generatedFileExclude {
gmock/ gtest/
ni-libraries/include/ ni-libraries/include/
ni-libraries/lib/ ni-libraries/lib/
hal/src/main/native/athena/ctre/
hal/src/main/native/athena/frccansae/
hal/src/main/native/athena/visa/
hal/src/main/native/include/ctre/
UsageReporting\.h$
} }
modifiableFileExclude { modifiableFileExclude {
wpilibj/src/arm-linux-jni/ shared/arm-linux-jni/
wpilibj/src/main/native/cpp/
\.patch$
\.png$
\.py$ \.py$
\.so$ \.so$
} }
repoRootNameOverride {
wpilib
}
includeOtherLibs { includeOtherLibs {
^HAL/ ^HAL/
^llvm/
^networktables/ ^networktables/
^opencv2/ ^opencv2/
^support/ ^support/
} ^wpi/
includeProject {
^ctre/
} }

View File

@@ -37,4 +37,4 @@ cache:
script: script:
- python3.5 -m wpiformat -y 2018 -clang 5.0 - python3.5 -m wpiformat -y 2018 -clang 5.0
- git --no-pager diff --exit-code HEAD # Ensure formatter made no changes - git --no-pager diff --exit-code HEAD # Ensure formatter made no changes
- ./gradlew --no-daemon --console=plain -PskipAthena :hal:halSimSharedLibrary :wpilibc:wpilibcSharedLibrary :wpilibj:wpilibJNISharedSharedLibrary :wpilibj:jar - ./gradlew --no-daemon --console=plain -PskipAthena :hal:halSharedLibrary :hal:halJNISharedLibrary :wpilibc:wpilibcSharedLibrary :wpilibj:jar

View File

@@ -37,7 +37,7 @@ So you want to contribute your changes back to WPILib. Great! We have a few cont
## Coding Guidelines ## Coding Guidelines
WPILib uses modified Google style guides for both C++ and Java, which can be found in the [styleguide repository](https://github.com/wpilibsuite/styleguide). Autoformatters are available for many popular editors at https://github.com/google/styleguide. Running wpiformat is required for all contributions and is enforced by our continuous integration system. WPILib uses modified Google style guides for both C++ and Java, which can be found in the [styleguide repository](https://github.com/wpilibsuite/styleguide). Autoformatters are available for many popular editors at https://github.com/google/styleguide. Running wpiformat is required for all contributions and is enforced by our continuous integration system. We currently use clang-format 5.0 with wpiformat.
While the library should be fully formatted according to the styles, additional elements of the style guide were not followed when the library was initially created. All new code should follow the guidelines. If you are looking for some easy ramp-up tasks, finding areas that don't follow the style guide and fixing them is very welcome. While the library should be fully formatted according to the styles, additional elements of the style guide were not followed when the library was initially created. All new code should follow the guidelines. If you are looking for some easy ramp-up tasks, finding areas that don't follow the style guide and fixing them is very welcome.

28
cameraserver/.styleguide Normal file
View File

@@ -0,0 +1,28 @@
cppHeaderFileInclude {
\.h$
\.inc$
}
cppSrcFileInclude {
\.cpp$
}
modifiableFileExclude {
\.so$
}
repoRootNameOverride {
cameraserver
}
includeOtherLibs {
^HAL/
^networktables/
^opencv2/
^support/
^wpi/
}
includeGuardRoots {
cameraserver/src/main/native/include/
}

View File

@@ -193,8 +193,7 @@ static std::vector<std::string> GetSourceModeValues(int source) {
return rv; return rv;
} }
static inline wpi::StringRef Concatenate(wpi::StringRef lhs, static inline wpi::StringRef Concatenate(wpi::StringRef lhs, wpi::StringRef rhs,
wpi::StringRef rhs,
wpi::SmallVectorImpl<char>& buf) { wpi::SmallVectorImpl<char>& buf) {
buf.clear(); buf.clear();
wpi::raw_svector_ostream oss{buf}; wpi::raw_svector_ostream oss{buf};

View File

@@ -80,8 +80,7 @@ class CameraServer {
* @param name The name to give the camera * @param name The name to give the camera
* @param path The device path (e.g. "/dev/video0") of the camera * @param path The device path (e.g. "/dev/video0") of the camera
*/ */
cs::UsbCamera StartAutomaticCapture(wpi::StringRef name, cs::UsbCamera StartAutomaticCapture(wpi::StringRef name, wpi::StringRef path);
wpi::StringRef path);
#endif #endif
/** /**

View File

@@ -1,5 +1,9 @@
cHeaderFileInclude {
_c\.h$
}
cppHeaderFileInclude { cppHeaderFileInclude {
\.h$ (?<!_c)\.h$
\.hpp$ \.hpp$
\.inc$ \.inc$
} }
@@ -8,12 +12,6 @@ cppSrcFileInclude {
\.cpp$ \.cpp$
} }
generatedFileExclude {
gmock/
src/arm-linux-jni/
src/main/native/cpp/jni/CameraServerJNI\.cpp$
}
licenseUpdateExclude { licenseUpdateExclude {
src/main/native/cpp/default_init_allocator\.h$ src/main/native/cpp/default_init_allocator\.h$
} }
@@ -21,11 +19,16 @@ licenseUpdateExclude {
includeGuardRoots { includeGuardRoots {
cscore/src/main/native/cpp/ cscore/src/main/native/cpp/
cscore/src/main/native/include/ cscore/src/main/native/include/
cscore/src/main/test/native/cpp/
}
repoRootNameOverride {
cscore
} }
includeOtherLibs { includeOtherLibs {
^llvm/
^opencv2/ ^opencv2/
^support/ ^support/
^tcpsockets/ ^tcpsockets/
^wpi/
} }

View File

@@ -173,7 +173,7 @@ std::string GetSinkError(CS_Sink sink, CS_Status* status) {
} }
wpi::StringRef GetSinkError(CS_Sink sink, wpi::SmallVectorImpl<char>& buf, wpi::StringRef GetSinkError(CS_Sink sink, wpi::SmallVectorImpl<char>& buf,
CS_Status* status) { CS_Status* status) {
auto data = Sinks::GetInstance().Get(sink); auto data = Sinks::GetInstance().Get(sink);
if (!data || data->kind != CS_SINK_CV) { if (!data || data->kind != CS_SINK_CV) {
*status = CS_INVALID_HANDLE; *status = CS_INVALID_HANDLE;

View File

@@ -494,8 +494,7 @@ CS_Source CreateHttpCamera(wpi::StringRef name, wpi::StringRef url,
return handle; return handle;
} }
CS_Source CreateHttpCamera(wpi::StringRef name, CS_Source CreateHttpCamera(wpi::StringRef name, wpi::ArrayRef<std::string> urls,
wpi::ArrayRef<std::string> urls,
CS_HttpCameraKind kind, CS_Status* status) { CS_HttpCameraKind kind, CS_Status* status) {
if (urls.empty()) { if (urls.empty()) {
*status = CS_EMPTY_VALUE; *status = CS_EMPTY_VALUE;

View File

@@ -93,9 +93,9 @@ bool JpegNeedsDHT(const char* data, size_t* size, size_t* locSOF) {
for (;;) { for (;;) {
if (sdata.size() < 4) return false; // EOF if (sdata.size() < 4) return false; // EOF
bytes = sdata.bytes_begin(); bytes = sdata.bytes_begin();
if (bytes[0] != 0xff) return false; // not a tag if (bytes[0] != 0xff) return false; // not a tag
if (bytes[1] == 0xda) break; // SOS if (bytes[1] == 0xda) break; // SOS
if (bytes[1] == 0xc4) return false; // DHT if (bytes[1] == 0xc4) return false; // DHT
if (bytes[1] == 0xc0) *locSOF = sdata.data() - data; // SOF if (bytes[1] == 0xc0) *locSOF = sdata.data() - data; // SOF
// Go to the next block // Go to the next block
sdata = sdata.substr(bytes[2] * 256 + bytes[3] + 2); sdata = sdata.substr(bytes[2] * 256 + bytes[3] + 2);
@@ -111,7 +111,7 @@ bool JpegNeedsDHT(const char* data, size_t* size, size_t* locSOF) {
wpi::StringRef JpegGetDHT() { wpi::StringRef JpegGetDHT() {
return wpi::StringRef(reinterpret_cast<const char*>(dhtData), return wpi::StringRef(reinterpret_cast<const char*>(dhtData),
sizeof(dhtData)); sizeof(dhtData));
} }
static inline void ReadInto(wpi::raw_istream& is, std::string& buf, static inline void ReadInto(wpi::raw_istream& is, std::string& buf,

View File

@@ -124,8 +124,8 @@ class MjpegServerImpl::ConnThread : public wpi::SafeThread {
// A browser should connect for each file and not serve files from its cache. // A browser should connect for each file and not serve files from its cache.
// Using cached pictures would lead to showing old/outdated pictures. // Using cached pictures would lead to showing old/outdated pictures.
// Many browsers seem to ignore, or at least not always obey, those headers. // Many browsers seem to ignore, or at least not always obey, those headers.
static void SendHeader(wpi::raw_ostream& os, int code, static void SendHeader(wpi::raw_ostream& os, int code, wpi::StringRef codeText,
wpi::StringRef codeText, wpi::StringRef contentType, wpi::StringRef contentType,
wpi::StringRef extra = wpi::StringRef{}) { wpi::StringRef extra = wpi::StringRef{}) {
os << "HTTP/1.0 " << code << ' ' << codeText << "\r\n"; os << "HTTP/1.0 " << code << ' ' << codeText << "\r\n";
os << "Connection: close\r\n" os << "Connection: close\r\n"
@@ -143,8 +143,7 @@ static void SendHeader(wpi::raw_ostream& os, int code,
// Send error header and message // Send error header and message
// @param code HTTP error code (e.g. 404) // @param code HTTP error code (e.g. 404)
// @param message Additional message text // @param message Additional message text
static void SendError(wpi::raw_ostream& os, int code, static void SendError(wpi::raw_ostream& os, int code, wpi::StringRef message) {
wpi::StringRef message) {
wpi::StringRef codeText, extra, baseMessage; wpi::StringRef codeText, extra, baseMessage;
switch (code) { switch (code) {
case 401: case 401:
@@ -733,8 +732,7 @@ void MjpegServerImpl::ConnThread::ProcessRequest() {
} else if (req.find("GET /output") != wpi::StringRef::npos && } else if (req.find("GET /output") != wpi::StringRef::npos &&
req.find(".json") != wpi::StringRef::npos) { req.find(".json") != wpi::StringRef::npos) {
kind = kGetSettings; kind = kGetSettings;
} else if ((pos = req.find("GET /?action=command")) != } else if ((pos = req.find("GET /?action=command")) != wpi::StringRef::npos) {
wpi::StringRef::npos) {
kind = kCommand; kind = kCommand;
parameters = req.substr(req.find('&', pos + 20)).substr(1); parameters = req.substr(req.find('&', pos + 20)).substr(1);
} else if (req.find("GET / ") != wpi::StringRef::npos || req == "GET /\n") { } else if (req.find("GET / ") != wpi::StringRef::npos || req == "GET /\n") {

View File

@@ -26,8 +26,7 @@ void SinkImpl::SetDescription(wpi::StringRef description) {
m_description = description; m_description = description;
} }
wpi::StringRef SinkImpl::GetDescription( wpi::StringRef SinkImpl::GetDescription(wpi::SmallVectorImpl<char>& buf) const {
wpi::SmallVectorImpl<char>& buf) const {
std::lock_guard<wpi::mutex> lock(m_mutex); std::lock_guard<wpi::mutex> lock(m_mutex);
buf.append(m_description.begin(), m_description.end()); buf.append(m_description.begin(), m_description.end());
return wpi::StringRef{buf.data(), buf.size()}; return wpi::StringRef{buf.data(), buf.size()};

View File

@@ -131,8 +131,7 @@ CS_PropertyKind SourceImpl::GetPropertyKind(int property) const {
wpi::StringRef SourceImpl::GetPropertyName(int property, wpi::StringRef SourceImpl::GetPropertyName(int property,
wpi::SmallVectorImpl<char>& buf, wpi::SmallVectorImpl<char>& buf,
CS_Status* status) const { CS_Status* status) const {
if (!m_properties_cached && !CacheProperties(status)) if (!m_properties_cached && !CacheProperties(status)) return wpi::StringRef{};
return wpi::StringRef{};
std::lock_guard<wpi::mutex> lock(m_mutex); std::lock_guard<wpi::mutex> lock(m_mutex);
auto prop = GetProperty(property); auto prop = GetProperty(property);
if (!prop) { if (!prop) {
@@ -206,8 +205,7 @@ int SourceImpl::GetPropertyDefault(int property, CS_Status* status) const {
wpi::StringRef SourceImpl::GetStringProperty(int property, wpi::StringRef SourceImpl::GetStringProperty(int property,
wpi::SmallVectorImpl<char>& buf, wpi::SmallVectorImpl<char>& buf,
CS_Status* status) const { CS_Status* status) const {
if (!m_properties_cached && !CacheProperties(status)) if (!m_properties_cached && !CacheProperties(status)) return wpi::StringRef{};
return wpi::StringRef{};
std::lock_guard<wpi::mutex> lock(m_mutex); std::lock_guard<wpi::mutex> lock(m_mutex);
auto prop = GetProperty(property); auto prop = GetProperty(property);
if (!prop) { if (!prop) {

View File

@@ -94,8 +94,7 @@ class SourceImpl {
wpi::ArrayRef<int> EnumerateProperties(wpi::SmallVectorImpl<int>& vec, wpi::ArrayRef<int> EnumerateProperties(wpi::SmallVectorImpl<int>& vec,
CS_Status* status) const; CS_Status* status) const;
CS_PropertyKind GetPropertyKind(int property) const; CS_PropertyKind GetPropertyKind(int property) const;
wpi::StringRef GetPropertyName(int property, wpi::StringRef GetPropertyName(int property, wpi::SmallVectorImpl<char>& buf,
wpi::SmallVectorImpl<char>& buf,
CS_Status* status) const; CS_Status* status) const;
int GetProperty(int property, CS_Status* status) const; int GetProperty(int property, CS_Status* status) const;
virtual void SetProperty(int property, int value, CS_Status* status) = 0; virtual void SetProperty(int property, int value, CS_Status* status) = 0;

View File

@@ -28,8 +28,8 @@
#include <algorithm> #include <algorithm>
#include <wpi/SmallString.h> #include <wpi/SmallString.h>
#include <wpi/raw_ostream.h>
#include <wpi/memory.h> #include <wpi/memory.h>
#include <wpi/raw_ostream.h>
#include <wpi/timestamp.h> #include <wpi/timestamp.h>
#include "Handle.h" #include "Handle.h"
@@ -389,7 +389,7 @@ void UsbCameraImpl::CameraThreadMain() {
DeviceStreamOff(); DeviceStreamOff();
DeviceDisconnect(); DeviceDisconnect();
notified = true; // device wasn't deleted, just error'ed notified = true; // device wasn't deleted, just error'ed
continue; // will reconnect continue; // will reconnect
} }
if ((buf.flags & V4L2_BUF_FLAG_ERROR) == 0) { if ((buf.flags & V4L2_BUF_FLAG_ERROR) == 0) {
@@ -415,7 +415,7 @@ void UsbCameraImpl::CameraThreadMain() {
DeviceStreamOff(); DeviceStreamOff();
DeviceDisconnect(); DeviceDisconnect();
notified = true; // device wasn't deleted, just error'ed notified = true; // device wasn't deleted, just error'ed
continue; // will reconnect continue; // will reconnect
} }
} }
} }

View File

@@ -75,7 +75,7 @@ class UsbCameraImpl : public SourceImpl {
kCmdSetFPS, kCmdSetFPS,
kCmdSetProperty, kCmdSetProperty,
kCmdSetPropertyStr, kCmdSetPropertyStr,
kNumSinksChanged, // no response kNumSinksChanged, // no response
kNumSinksEnabledChanged, // no response kNumSinksEnabledChanged, // no response
// Responses // Responses
kOk, kOk,

View File

@@ -62,7 +62,7 @@ class UsbCameraProperty : public PropertyImpl {
int propPair{0}; int propPair{0};
unsigned id{0}; // implementation-level id unsigned id{0}; // implementation-level id
int type{0}; // implementation type, not CS_PropertyKind! int type{0}; // implementation type, not CS_PropertyKind!
}; };
} // namespace cs } // namespace cs

View File

@@ -171,8 +171,7 @@ std::string GetSourceName(CS_Source source, CS_Status* status) {
return data->source->GetName(); return data->source->GetName();
} }
wpi::StringRef GetSourceName(CS_Source source, wpi::StringRef GetSourceName(CS_Source source, wpi::SmallVectorImpl<char>& buf,
wpi::SmallVectorImpl<char>& buf,
CS_Status* status) { CS_Status* status) {
auto data = Sources::GetInstance().Get(source); auto data = Sources::GetInstance().Get(source);
if (!data) { if (!data) {
@@ -309,8 +308,9 @@ std::vector<VideoMode> EnumerateSourceVideoModes(CS_Source source,
return data->source->EnumerateVideoModes(status); return data->source->EnumerateVideoModes(status);
} }
wpi::ArrayRef<CS_Sink> EnumerateSourceSinks( wpi::ArrayRef<CS_Sink> EnumerateSourceSinks(CS_Source source,
CS_Source source, wpi::SmallVectorImpl<CS_Sink>& vec, CS_Status* status) { wpi::SmallVectorImpl<CS_Sink>& vec,
CS_Status* status) {
auto data = Sources::GetInstance().Get(source); auto data = Sources::GetInstance().Get(source);
if (!data) { if (!data) {
*status = CS_INVALID_HANDLE; *status = CS_INVALID_HANDLE;
@@ -468,8 +468,7 @@ std::string GetSinkDescription(CS_Sink sink, CS_Status* status) {
return data->sink->GetDescription(buf); return data->sink->GetDescription(buf);
} }
wpi::StringRef GetSinkDescription(CS_Sink sink, wpi::StringRef GetSinkDescription(CS_Sink sink, wpi::SmallVectorImpl<char>& buf,
wpi::SmallVectorImpl<char>& buf,
CS_Status* status) { CS_Status* status) {
auto data = Sinks::GetInstance().Get(sink); auto data = Sinks::GetInstance().Get(sink);
if (!data) { if (!data) {
@@ -630,8 +629,8 @@ wpi::ArrayRef<CS_Source> EnumerateSourceHandles(
return Sources::GetInstance().GetAll(vec); return Sources::GetInstance().GetAll(vec);
} }
wpi::ArrayRef<CS_Sink> EnumerateSinkHandles( wpi::ArrayRef<CS_Sink> EnumerateSinkHandles(wpi::SmallVectorImpl<CS_Sink>& vec,
wpi::SmallVectorImpl<CS_Sink>& vec, CS_Status* status) { CS_Status* status) {
return Sinks::GetInstance().GetAll(vec); return Sinks::GetInstance().GetAll(vec);
} }
@@ -642,7 +641,7 @@ std::string GetHostname() {
name[255] = '\0'; // Per POSIX, may not be null terminated if too long name[255] = '\0'; // Per POSIX, may not be null terminated if too long
return name; return name;
#else #else
return ""; // TODO return ""; // TODO
#endif #endif
} }
@@ -654,7 +653,7 @@ std::vector<std::string> GetNetworkInterfaces() {
std::vector<std::string> rv; std::vector<std::string> rv;
char buf[256]; char buf[256];
for (struct ifaddrs* i = ifa; i; i = i->ifa_next) { for (struct ifaddrs* i = ifa; i; i = i->ifa_next) {
if (!i->ifa_addr) continue; // no address if (!i->ifa_addr) continue; // no address
if (i->ifa_addr->sa_family != AF_INET) continue; // only return IPv4 if (i->ifa_addr->sa_family != AF_INET) continue; // only return IPv4
struct sockaddr_in* addr_in = reinterpret_cast<sockaddr_in*>(i->ifa_addr); struct sockaddr_in* addr_in = reinterpret_cast<sockaddr_in*>(i->ifa_addr);
const char* addr = const char* addr =

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) 2016-2017 FIRST. All Rights Reserved. */ /* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */
@@ -106,7 +106,8 @@ JNIEXPORT void JNICALL JNI_OnUnload(JavaVM* vm, void* reserved) {
template <typename T> template <typename T>
class JCSGlobal { class JCSGlobal {
public: public:
JCSGlobal(JNIEnv* env, T obj) : m_obj(static_cast<T>(env->NewGlobalRef(obj))) {} JCSGlobal(JNIEnv* env, T obj)
: m_obj(static_cast<T>(env->NewGlobalRef(obj))) {}
~JCSGlobal() { ~JCSGlobal() {
if (!jvm || cs::NotifierDestroyed()) return; if (!jvm || cs::NotifierDestroyed()) return;
JNIEnv* env; JNIEnv* env;
@@ -179,7 +180,7 @@ static inline bool CheckStatus(JNIEnv* env, CS_Status status) {
} }
#ifdef __linux__ #ifdef __linux__
static jobject MakeJObject(JNIEnv* env, const cs::UsbCameraInfo &info) { static jobject MakeJObject(JNIEnv* env, const cs::UsbCameraInfo& info) {
static jmethodID constructor = env->GetMethodID( static jmethodID constructor = env->GetMethodID(
usbCameraInfoCls, "<init>", "(ILjava/lang/String;Ljava/lang/String;)V"); usbCameraInfoCls, "<init>", "(ILjava/lang/String;Ljava/lang/String;)V");
JLocal<jstring> path(env, MakeJString(env, info.path)); JLocal<jstring> path(env, MakeJString(env, info.path));
@@ -230,7 +231,8 @@ extern "C" {
* Method: getPropertyKind * Method: getPropertyKind
* Signature: (I)I * Signature: (I)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getPropertyKind JNIEXPORT jint JNICALL
Java_edu_wpi_cscore_CameraServerJNI_getPropertyKind
(JNIEnv* env, jclass, jint property) (JNIEnv* env, jclass, jint property)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -244,7 +246,8 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getPropertyKind
* Method: getPropertyName * Method: getPropertyName
* Signature: (I)Ljava/lang/String; * Signature: (I)Ljava/lang/String;
*/ */
JNIEXPORT jstring JNICALL Java_edu_wpi_cscore_CameraServerJNI_getPropertyName JNIEXPORT jstring JNICALL
Java_edu_wpi_cscore_CameraServerJNI_getPropertyName
(JNIEnv* env, jclass, jint property) (JNIEnv* env, jclass, jint property)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -259,7 +262,8 @@ JNIEXPORT jstring JNICALL Java_edu_wpi_cscore_CameraServerJNI_getPropertyName
* Method: getProperty * Method: getProperty
* Signature: (I)I * Signature: (I)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getProperty JNIEXPORT jint JNICALL
Java_edu_wpi_cscore_CameraServerJNI_getProperty
(JNIEnv* env, jclass, jint property) (JNIEnv* env, jclass, jint property)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -273,7 +277,8 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getProperty
* Method: setProperty * Method: setProperty
* Signature: (II)V * Signature: (II)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setProperty JNIEXPORT void JNICALL
Java_edu_wpi_cscore_CameraServerJNI_setProperty
(JNIEnv* env, jclass, jint property, jint value) (JNIEnv* env, jclass, jint property, jint value)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -286,7 +291,8 @@ JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setProperty
* Method: getPropertyMin * Method: getPropertyMin
* Signature: (I)I * Signature: (I)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getPropertyMin JNIEXPORT jint JNICALL
Java_edu_wpi_cscore_CameraServerJNI_getPropertyMin
(JNIEnv* env, jclass, jint property) (JNIEnv* env, jclass, jint property)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -300,7 +306,8 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getPropertyMin
* Method: getPropertyMax * Method: getPropertyMax
* Signature: (I)I * Signature: (I)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getPropertyMax JNIEXPORT jint JNICALL
Java_edu_wpi_cscore_CameraServerJNI_getPropertyMax
(JNIEnv* env, jclass, jint property) (JNIEnv* env, jclass, jint property)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -314,7 +321,8 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getPropertyMax
* Method: getPropertyStep * Method: getPropertyStep
* Signature: (I)I * Signature: (I)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getPropertyStep JNIEXPORT jint JNICALL
Java_edu_wpi_cscore_CameraServerJNI_getPropertyStep
(JNIEnv* env, jclass, jint property) (JNIEnv* env, jclass, jint property)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -328,7 +336,8 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getPropertyStep
* Method: getPropertyDefault * Method: getPropertyDefault
* Signature: (I)I * Signature: (I)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getPropertyDefault JNIEXPORT jint JNICALL
Java_edu_wpi_cscore_CameraServerJNI_getPropertyDefault
(JNIEnv* env, jclass, jint property) (JNIEnv* env, jclass, jint property)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -342,7 +351,8 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getPropertyDefault
* Method: getStringProperty * Method: getStringProperty
* Signature: (I)Ljava/lang/String; * Signature: (I)Ljava/lang/String;
*/ */
JNIEXPORT jstring JNICALL Java_edu_wpi_cscore_CameraServerJNI_getStringProperty JNIEXPORT jstring JNICALL
Java_edu_wpi_cscore_CameraServerJNI_getStringProperty
(JNIEnv* env, jclass, jint property) (JNIEnv* env, jclass, jint property)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -357,7 +367,8 @@ JNIEXPORT jstring JNICALL Java_edu_wpi_cscore_CameraServerJNI_getStringProperty
* Method: setStringProperty * Method: setStringProperty
* Signature: (ILjava/lang/String;)V * Signature: (ILjava/lang/String;)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setStringProperty JNIEXPORT void JNICALL
Java_edu_wpi_cscore_CameraServerJNI_setStringProperty
(JNIEnv* env, jclass, jint property, jstring value) (JNIEnv* env, jclass, jint property, jstring value)
{ {
if (!value) { if (!value) {
@@ -372,9 +383,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setStringProperty
/* /*
* Class: edu_wpi_cscore_CameraServerJNI * Class: edu_wpi_cscore_CameraServerJNI
* Method: getEnumPropertyChoices * Method: getEnumPropertyChoices
* Signature: (I)[Ljava/lang/String; * Signature: (I)[Ljava/lang/Object;
*/ */
JNIEXPORT jobjectArray JNICALL Java_edu_wpi_cscore_CameraServerJNI_getEnumPropertyChoices JNIEXPORT jobjectArray JNICALL
Java_edu_wpi_cscore_CameraServerJNI_getEnumPropertyChoices
(JNIEnv* env, jclass, jint property) (JNIEnv* env, jclass, jint property)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -388,7 +400,8 @@ JNIEXPORT jobjectArray JNICALL Java_edu_wpi_cscore_CameraServerJNI_getEnumProper
* Method: createUsbCameraDev * Method: createUsbCameraDev
* Signature: (Ljava/lang/String;I)I * Signature: (Ljava/lang/String;I)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_createUsbCameraDev JNIEXPORT jint JNICALL
Java_edu_wpi_cscore_CameraServerJNI_createUsbCameraDev
(JNIEnv* env, jclass, jstring name, jint dev) (JNIEnv* env, jclass, jstring name, jint dev)
{ {
#ifndef __linux__ #ifndef __linux__
@@ -411,7 +424,8 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_createUsbCameraDev
* Method: createUsbCameraPath * Method: createUsbCameraPath
* Signature: (Ljava/lang/String;Ljava/lang/String;)I * Signature: (Ljava/lang/String;Ljava/lang/String;)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_createUsbCameraPath JNIEXPORT jint JNICALL
Java_edu_wpi_cscore_CameraServerJNI_createUsbCameraPath
(JNIEnv* env, jclass, jstring name, jstring path) (JNIEnv* env, jclass, jstring name, jstring path)
{ {
#ifndef __linux__ #ifndef __linux__
@@ -439,7 +453,8 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_createUsbCameraPath
* Method: createHttpCamera * Method: createHttpCamera
* Signature: (Ljava/lang/String;Ljava/lang/String;I)I * Signature: (Ljava/lang/String;Ljava/lang/String;I)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_createHttpCamera JNIEXPORT jint JNICALL
Java_edu_wpi_cscore_CameraServerJNI_createHttpCamera
(JNIEnv* env, jclass, jstring name, jstring url, jint kind) (JNIEnv* env, jclass, jstring name, jstring url, jint kind)
{ {
if (!name) { if (!name) {
@@ -461,9 +476,10 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_createHttpCamera
/* /*
* Class: edu_wpi_cscore_CameraServerJNI * Class: edu_wpi_cscore_CameraServerJNI
* Method: createHttpCameraMulti * Method: createHttpCameraMulti
* Signature: (Ljava/lang/String;[Ljava/lang/String;I)I * Signature: (Ljava/lang/String;[Ljava/lang/Object;I)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_createHttpCameraMulti JNIEXPORT jint JNICALL
Java_edu_wpi_cscore_CameraServerJNI_createHttpCameraMulti
(JNIEnv* env, jclass, jstring name, jobjectArray urls, jint kind) (JNIEnv* env, jclass, jstring name, jobjectArray urls, jint kind)
{ {
if (!name) { if (!name) {
@@ -499,9 +515,10 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_createHttpCameraMulti
* Method: createCvSource * Method: createCvSource
* Signature: (Ljava/lang/String;IIII)I * Signature: (Ljava/lang/String;IIII)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_createCvSource JNIEXPORT jint JNICALL
(JNIEnv* env, jclass, jstring name, jint pixelFormat, jint width, Java_edu_wpi_cscore_CameraServerJNI_createCvSource
jint height, jint fps) (JNIEnv* env, jclass, jstring name, jint pixelFormat, jint width, jint height,
jint fps)
{ {
if (!name) { if (!name) {
nullPointerEx.Throw(env, "name cannot be null"); nullPointerEx.Throw(env, "name cannot be null");
@@ -523,7 +540,8 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_createCvSource
* Method: getSourceKind * Method: getSourceKind
* Signature: (I)I * Signature: (I)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSourceKind JNIEXPORT jint JNICALL
Java_edu_wpi_cscore_CameraServerJNI_getSourceKind
(JNIEnv* env, jclass, jint source) (JNIEnv* env, jclass, jint source)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -537,7 +555,8 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSourceKind
* Method: getSourceName * Method: getSourceName
* Signature: (I)Ljava/lang/String; * Signature: (I)Ljava/lang/String;
*/ */
JNIEXPORT jstring JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSourceName JNIEXPORT jstring JNICALL
Java_edu_wpi_cscore_CameraServerJNI_getSourceName
(JNIEnv* env, jclass, jint source) (JNIEnv* env, jclass, jint source)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -552,7 +571,8 @@ JNIEXPORT jstring JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSourceName
* Method: getSourceDescription * Method: getSourceDescription
* Signature: (I)Ljava/lang/String; * Signature: (I)Ljava/lang/String;
*/ */
JNIEXPORT jstring JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSourceDescription JNIEXPORT jstring JNICALL
Java_edu_wpi_cscore_CameraServerJNI_getSourceDescription
(JNIEnv* env, jclass, jint source) (JNIEnv* env, jclass, jint source)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -567,7 +587,8 @@ JNIEXPORT jstring JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSourceDescripti
* Method: getSourceLastFrameTime * Method: getSourceLastFrameTime
* Signature: (I)J * Signature: (I)J
*/ */
JNIEXPORT jlong JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSourceLastFrameTime JNIEXPORT jlong JNICALL
Java_edu_wpi_cscore_CameraServerJNI_getSourceLastFrameTime
(JNIEnv* env, jclass, jint source) (JNIEnv* env, jclass, jint source)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -581,7 +602,8 @@ JNIEXPORT jlong JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSourceLastFrameTi
* Method: isSourceConnected * Method: isSourceConnected
* Signature: (I)Z * Signature: (I)Z
*/ */
JNIEXPORT jboolean JNICALL Java_edu_wpi_cscore_CameraServerJNI_isSourceConnected JNIEXPORT jboolean JNICALL
Java_edu_wpi_cscore_CameraServerJNI_isSourceConnected
(JNIEnv* env, jclass, jint source) (JNIEnv* env, jclass, jint source)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -595,7 +617,8 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_cscore_CameraServerJNI_isSourceConnected
* Method: getSourceProperty * Method: getSourceProperty
* Signature: (ILjava/lang/String;)I * Signature: (ILjava/lang/String;)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSourceProperty JNIEXPORT jint JNICALL
Java_edu_wpi_cscore_CameraServerJNI_getSourceProperty
(JNIEnv* env, jclass, jint source, jstring name) (JNIEnv* env, jclass, jint source, jstring name)
{ {
if (!name) { if (!name) {
@@ -613,7 +636,8 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSourceProperty
* Method: enumerateSourceProperties * Method: enumerateSourceProperties
* Signature: (I)[I * Signature: (I)[I
*/ */
JNIEXPORT jintArray JNICALL Java_edu_wpi_cscore_CameraServerJNI_enumerateSourceProperties JNIEXPORT jintArray JNICALL
Java_edu_wpi_cscore_CameraServerJNI_enumerateSourceProperties
(JNIEnv* env, jclass, jint source) (JNIEnv* env, jclass, jint source)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -626,9 +650,10 @@ JNIEXPORT jintArray JNICALL Java_edu_wpi_cscore_CameraServerJNI_enumerateSourceP
/* /*
* Class: edu_wpi_cscore_CameraServerJNI * Class: edu_wpi_cscore_CameraServerJNI
* Method: getSourceVideoMode * Method: getSourceVideoMode
* Signature: (I)Ledu/wpi/cameraserver/VideoMode; * Signature: (I)Ljava/lang/Object;
*/ */
JNIEXPORT jobject JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSourceVideoMode JNIEXPORT jobject JNICALL
Java_edu_wpi_cscore_CameraServerJNI_getSourceVideoMode
(JNIEnv* env, jclass, jint source) (JNIEnv* env, jclass, jint source)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -642,7 +667,8 @@ JNIEXPORT jobject JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSourceVideoMode
* Method: setSourceVideoMode * Method: setSourceVideoMode
* Signature: (IIIII)Z * Signature: (IIIII)Z
*/ */
JNIEXPORT jboolean JNICALL Java_edu_wpi_cscore_CameraServerJNI_setSourceVideoMode JNIEXPORT jboolean JNICALL
Java_edu_wpi_cscore_CameraServerJNI_setSourceVideoMode
(JNIEnv* env, jclass, jint source, jint pixelFormat, jint width, jint height, (JNIEnv* env, jclass, jint source, jint pixelFormat, jint width, jint height,
jint fps) jint fps)
{ {
@@ -661,7 +687,8 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_cscore_CameraServerJNI_setSourceVideoMod
* Method: setSourcePixelFormat * Method: setSourcePixelFormat
* Signature: (II)Z * Signature: (II)Z
*/ */
JNIEXPORT jboolean JNICALL Java_edu_wpi_cscore_CameraServerJNI_setSourcePixelFormat JNIEXPORT jboolean JNICALL
Java_edu_wpi_cscore_CameraServerJNI_setSourcePixelFormat
(JNIEnv* env, jclass, jint source, jint pixelFormat) (JNIEnv* env, jclass, jint source, jint pixelFormat)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -676,7 +703,8 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_cscore_CameraServerJNI_setSourcePixelFor
* Method: setSourceResolution * Method: setSourceResolution
* Signature: (III)Z * Signature: (III)Z
*/ */
JNIEXPORT jboolean JNICALL Java_edu_wpi_cscore_CameraServerJNI_setSourceResolution JNIEXPORT jboolean JNICALL
Java_edu_wpi_cscore_CameraServerJNI_setSourceResolution
(JNIEnv* env, jclass, jint source, jint width, jint height) (JNIEnv* env, jclass, jint source, jint width, jint height)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -690,7 +718,8 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_cscore_CameraServerJNI_setSourceResoluti
* Method: setSourceFPS * Method: setSourceFPS
* Signature: (II)Z * Signature: (II)Z
*/ */
JNIEXPORT jboolean JNICALL Java_edu_wpi_cscore_CameraServerJNI_setSourceFPS JNIEXPORT jboolean JNICALL
Java_edu_wpi_cscore_CameraServerJNI_setSourceFPS
(JNIEnv* env, jclass, jint source, jint fps) (JNIEnv* env, jclass, jint source, jint fps)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -702,9 +731,10 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_cscore_CameraServerJNI_setSourceFPS
/* /*
* Class: edu_wpi_cscore_CameraServerJNI * Class: edu_wpi_cscore_CameraServerJNI
* Method: enumerateSourceVideoModes * Method: enumerateSourceVideoModes
* Signature: (I)[Ledu/wpi/cameraserver/VideoMode; * Signature: (I)[Ljava/lang/Object;
*/ */
JNIEXPORT jobjectArray JNICALL Java_edu_wpi_cscore_CameraServerJNI_enumerateSourceVideoModes JNIEXPORT jobjectArray JNICALL
Java_edu_wpi_cscore_CameraServerJNI_enumerateSourceVideoModes
(JNIEnv* env, jclass, jint source) (JNIEnv* env, jclass, jint source)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -724,7 +754,8 @@ JNIEXPORT jobjectArray JNICALL Java_edu_wpi_cscore_CameraServerJNI_enumerateSour
* Method: enumerateSourceSinks * Method: enumerateSourceSinks
* Signature: (I)[I * Signature: (I)[I
*/ */
JNIEXPORT jintArray JNICALL Java_edu_wpi_cscore_CameraServerJNI_enumerateSourceSinks JNIEXPORT jintArray JNICALL
Java_edu_wpi_cscore_CameraServerJNI_enumerateSourceSinks
(JNIEnv* env, jclass, jint source) (JNIEnv* env, jclass, jint source)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -739,7 +770,8 @@ JNIEXPORT jintArray JNICALL Java_edu_wpi_cscore_CameraServerJNI_enumerateSourceS
* Method: copySource * Method: copySource
* Signature: (I)I * Signature: (I)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_copySource JNIEXPORT jint JNICALL
Java_edu_wpi_cscore_CameraServerJNI_copySource
(JNIEnv* env, jclass, jint source) (JNIEnv* env, jclass, jint source)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -753,7 +785,8 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_copySource
* Method: releaseSource * Method: releaseSource
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_releaseSource JNIEXPORT void JNICALL
Java_edu_wpi_cscore_CameraServerJNI_releaseSource
(JNIEnv* env, jclass, jint source) (JNIEnv* env, jclass, jint source)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -766,7 +799,8 @@ JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_releaseSource
* Method: setCameraBrightness * Method: setCameraBrightness
* Signature: (II)V * Signature: (II)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setCameraBrightness JNIEXPORT void JNICALL
Java_edu_wpi_cscore_CameraServerJNI_setCameraBrightness
(JNIEnv* env, jclass, jint source, jint brightness) (JNIEnv* env, jclass, jint source, jint brightness)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -779,7 +813,8 @@ JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setCameraBrightness
* Method: getCameraBrightness * Method: getCameraBrightness
* Signature: (I)I * Signature: (I)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getCameraBrightness JNIEXPORT jint JNICALL
Java_edu_wpi_cscore_CameraServerJNI_getCameraBrightness
(JNIEnv* env, jclass, jint source) (JNIEnv* env, jclass, jint source)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -793,7 +828,8 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getCameraBrightness
* Method: setCameraWhiteBalanceAuto * Method: setCameraWhiteBalanceAuto
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setCameraWhiteBalanceAuto JNIEXPORT void JNICALL
Java_edu_wpi_cscore_CameraServerJNI_setCameraWhiteBalanceAuto
(JNIEnv* env, jclass, jint source) (JNIEnv* env, jclass, jint source)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -806,7 +842,8 @@ JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setCameraWhiteBalance
* Method: setCameraWhiteBalanceHoldCurrent * Method: setCameraWhiteBalanceHoldCurrent
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setCameraWhiteBalanceHoldCurrent JNIEXPORT void JNICALL
Java_edu_wpi_cscore_CameraServerJNI_setCameraWhiteBalanceHoldCurrent
(JNIEnv* env, jclass, jint source) (JNIEnv* env, jclass, jint source)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -819,7 +856,8 @@ JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setCameraWhiteBalance
* Method: setCameraWhiteBalanceManual * Method: setCameraWhiteBalanceManual
* Signature: (II)V * Signature: (II)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setCameraWhiteBalanceManual JNIEXPORT void JNICALL
Java_edu_wpi_cscore_CameraServerJNI_setCameraWhiteBalanceManual
(JNIEnv* env, jclass, jint source, jint value) (JNIEnv* env, jclass, jint source, jint value)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -832,7 +870,8 @@ JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setCameraWhiteBalance
* Method: setCameraExposureAuto * Method: setCameraExposureAuto
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setCameraExposureAuto JNIEXPORT void JNICALL
Java_edu_wpi_cscore_CameraServerJNI_setCameraExposureAuto
(JNIEnv* env, jclass, jint source) (JNIEnv* env, jclass, jint source)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -845,7 +884,8 @@ JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setCameraExposureAuto
* Method: setCameraExposureHoldCurrent * Method: setCameraExposureHoldCurrent
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setCameraExposureHoldCurrent JNIEXPORT void JNICALL
Java_edu_wpi_cscore_CameraServerJNI_setCameraExposureHoldCurrent
(JNIEnv* env, jclass, jint source) (JNIEnv* env, jclass, jint source)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -858,7 +898,8 @@ JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setCameraExposureHold
* Method: setCameraExposureManual * Method: setCameraExposureManual
* Signature: (II)V * Signature: (II)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setCameraExposureManual JNIEXPORT void JNICALL
Java_edu_wpi_cscore_CameraServerJNI_setCameraExposureManual
(JNIEnv* env, jclass, jint source, jint value) (JNIEnv* env, jclass, jint source, jint value)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -871,7 +912,8 @@ JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setCameraExposureManu
* Method: getUsbCameraPath * Method: getUsbCameraPath
* Signature: (I)Ljava/lang/String; * Signature: (I)Ljava/lang/String;
*/ */
JNIEXPORT jstring JNICALL Java_edu_wpi_cscore_CameraServerJNI_getUsbCameraPath JNIEXPORT jstring JNICALL
Java_edu_wpi_cscore_CameraServerJNI_getUsbCameraPath
(JNIEnv* env, jclass, jint source) (JNIEnv* env, jclass, jint source)
{ {
#ifndef __linux__ #ifndef __linux__
@@ -890,7 +932,8 @@ JNIEXPORT jstring JNICALL Java_edu_wpi_cscore_CameraServerJNI_getUsbCameraPath
* Method: getHttpCameraKind * Method: getHttpCameraKind
* Signature: (I)I * Signature: (I)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getHttpCameraKind JNIEXPORT jint JNICALL
Java_edu_wpi_cscore_CameraServerJNI_getHttpCameraKind
(JNIEnv* env, jclass, jint source) (JNIEnv* env, jclass, jint source)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -902,9 +945,10 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getHttpCameraKind
/* /*
* Class: edu_wpi_cscore_CameraServerJNI * Class: edu_wpi_cscore_CameraServerJNI
* Method: setHttpCameraUrls * Method: setHttpCameraUrls
* Signature: (I[Ljava/lang/String;)V * Signature: (I[Ljava/lang/Object;)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setHttpCameraUrls JNIEXPORT void JNICALL
Java_edu_wpi_cscore_CameraServerJNI_setHttpCameraUrls
(JNIEnv* env, jclass, jint source, jobjectArray urls) (JNIEnv* env, jclass, jint source, jobjectArray urls)
{ {
if (!urls) { if (!urls) {
@@ -931,9 +975,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setHttpCameraUrls
/* /*
* Class: edu_wpi_cscore_CameraServerJNI * Class: edu_wpi_cscore_CameraServerJNI
* Method: getHttpCameraUrls * Method: getHttpCameraUrls
* Signature: (I)[Ljava/lang/String; * Signature: (I)[Ljava/lang/Object;
*/ */
JNIEXPORT jobjectArray JNICALL Java_edu_wpi_cscore_CameraServerJNI_getHttpCameraUrls JNIEXPORT jobjectArray JNICALL
Java_edu_wpi_cscore_CameraServerJNI_getHttpCameraUrls
(JNIEnv* env, jclass, jint source) (JNIEnv* env, jclass, jint source)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -947,7 +992,8 @@ JNIEXPORT jobjectArray JNICALL Java_edu_wpi_cscore_CameraServerJNI_getHttpCamera
* Method: putSourceFrame * Method: putSourceFrame
* Signature: (IJ)V * Signature: (IJ)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_putSourceFrame JNIEXPORT void JNICALL
Java_edu_wpi_cscore_CameraServerJNI_putSourceFrame
(JNIEnv* env, jclass, jint source, jlong imageNativeObj) (JNIEnv* env, jclass, jint source, jlong imageNativeObj)
{ {
cv::Mat& image = *((cv::Mat*)imageNativeObj); cv::Mat& image = *((cv::Mat*)imageNativeObj);
@@ -961,7 +1007,8 @@ JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_putSourceFrame
* Method: notifySourceError * Method: notifySourceError
* Signature: (ILjava/lang/String;)V * Signature: (ILjava/lang/String;)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_notifySourceError JNIEXPORT void JNICALL
Java_edu_wpi_cscore_CameraServerJNI_notifySourceError
(JNIEnv* env, jclass, jint source, jstring msg) (JNIEnv* env, jclass, jint source, jstring msg)
{ {
if (!msg) { if (!msg) {
@@ -978,7 +1025,8 @@ JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_notifySourceError
* Method: setSourceConnected * Method: setSourceConnected
* Signature: (IZ)V * Signature: (IZ)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setSourceConnected JNIEXPORT void JNICALL
Java_edu_wpi_cscore_CameraServerJNI_setSourceConnected
(JNIEnv* env, jclass, jint source, jboolean connected) (JNIEnv* env, jclass, jint source, jboolean connected)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -991,7 +1039,8 @@ JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setSourceConnected
* Method: setSourceDescription * Method: setSourceDescription
* Signature: (ILjava/lang/String;)V * Signature: (ILjava/lang/String;)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setSourceDescription JNIEXPORT void JNICALL
Java_edu_wpi_cscore_CameraServerJNI_setSourceDescription
(JNIEnv* env, jclass, jint source, jstring description) (JNIEnv* env, jclass, jint source, jstring description)
{ {
if (!description) { if (!description) {
@@ -1008,7 +1057,8 @@ JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setSourceDescription
* Method: createSourceProperty * Method: createSourceProperty
* Signature: (ILjava/lang/String;IIIIII)I * Signature: (ILjava/lang/String;IIIIII)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_createSourceProperty JNIEXPORT jint JNICALL
Java_edu_wpi_cscore_CameraServerJNI_createSourceProperty
(JNIEnv* env, jclass, jint source, jstring name, jint kind, jint minimum, (JNIEnv* env, jclass, jint source, jstring name, jint kind, jint minimum,
jint maximum, jint step, jint defaultValue, jint value) jint maximum, jint step, jint defaultValue, jint value)
{ {
@@ -1023,9 +1073,10 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_createSourceProperty
/* /*
* Class: edu_wpi_cscore_CameraServerJNI * Class: edu_wpi_cscore_CameraServerJNI
* Method: setSourceEnumPropertyChoices * Method: setSourceEnumPropertyChoices
* Signature: (II[Ljava/lang/String;)V * Signature: (II[Ljava/lang/Object;)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setSourceEnumPropertyChoices JNIEXPORT void JNICALL
Java_edu_wpi_cscore_CameraServerJNI_setSourceEnumPropertyChoices
(JNIEnv* env, jclass, jint source, jint property, jobjectArray choices) (JNIEnv* env, jclass, jint source, jint property, jobjectArray choices)
{ {
if (!choices) { if (!choices) {
@@ -1054,7 +1105,8 @@ JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setSourceEnumProperty
* Method: createMjpegServer * Method: createMjpegServer
* Signature: (Ljava/lang/String;Ljava/lang/String;I)I * Signature: (Ljava/lang/String;Ljava/lang/String;I)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_createMjpegServer JNIEXPORT jint JNICALL
Java_edu_wpi_cscore_CameraServerJNI_createMjpegServer
(JNIEnv* env, jclass, jstring name, jstring listenAddress, jint port) (JNIEnv* env, jclass, jstring name, jstring listenAddress, jint port)
{ {
if (!name) { if (!name) {
@@ -1077,7 +1129,8 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_createMjpegServer
* Method: createCvSink * Method: createCvSink
* Signature: (Ljava/lang/String;)I * Signature: (Ljava/lang/String;)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_createCvSink JNIEXPORT jint JNICALL
Java_edu_wpi_cscore_CameraServerJNI_createCvSink
(JNIEnv* env, jclass, jstring name) (JNIEnv* env, jclass, jstring name)
{ {
if (!name) { if (!name) {
@@ -1095,7 +1148,8 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_createCvSink
* Method: getSinkKind * Method: getSinkKind
* Signature: (I)I * Signature: (I)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSinkKind JNIEXPORT jint JNICALL
Java_edu_wpi_cscore_CameraServerJNI_getSinkKind
(JNIEnv* env, jclass, jint sink) (JNIEnv* env, jclass, jint sink)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -1109,7 +1163,8 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSinkKind
* Method: getSinkName * Method: getSinkName
* Signature: (I)Ljava/lang/String; * Signature: (I)Ljava/lang/String;
*/ */
JNIEXPORT jstring JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSinkName JNIEXPORT jstring JNICALL
Java_edu_wpi_cscore_CameraServerJNI_getSinkName
(JNIEnv* env, jclass, jint sink) (JNIEnv* env, jclass, jint sink)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -1124,7 +1179,8 @@ JNIEXPORT jstring JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSinkName
* Method: getSinkDescription * Method: getSinkDescription
* Signature: (I)Ljava/lang/String; * Signature: (I)Ljava/lang/String;
*/ */
JNIEXPORT jstring JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSinkDescription JNIEXPORT jstring JNICALL
Java_edu_wpi_cscore_CameraServerJNI_getSinkDescription
(JNIEnv* env, jclass, jint sink) (JNIEnv* env, jclass, jint sink)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -1139,7 +1195,8 @@ JNIEXPORT jstring JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSinkDescription
* Method: setSinkSource * Method: setSinkSource
* Signature: (II)V * Signature: (II)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setSinkSource JNIEXPORT void JNICALL
Java_edu_wpi_cscore_CameraServerJNI_setSinkSource
(JNIEnv* env, jclass, jint sink, jint source) (JNIEnv* env, jclass, jint sink, jint source)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -1152,7 +1209,8 @@ JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setSinkSource
* Method: getSinkSourceProperty * Method: getSinkSourceProperty
* Signature: (ILjava/lang/String;)I * Signature: (ILjava/lang/String;)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSinkSourceProperty JNIEXPORT jint JNICALL
Java_edu_wpi_cscore_CameraServerJNI_getSinkSourceProperty
(JNIEnv* env, jclass, jint sink, jstring name) (JNIEnv* env, jclass, jint sink, jstring name)
{ {
if (!name) { if (!name) {
@@ -1170,7 +1228,8 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSinkSourceProperty
* Method: getSinkSource * Method: getSinkSource
* Signature: (I)I * Signature: (I)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSinkSource JNIEXPORT jint JNICALL
Java_edu_wpi_cscore_CameraServerJNI_getSinkSource
(JNIEnv* env, jclass, jint sink) (JNIEnv* env, jclass, jint sink)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -1184,7 +1243,8 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSinkSource
* Method: copySink * Method: copySink
* Signature: (I)I * Signature: (I)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_copySink JNIEXPORT jint JNICALL
Java_edu_wpi_cscore_CameraServerJNI_copySink
(JNIEnv* env, jclass, jint sink) (JNIEnv* env, jclass, jint sink)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -1198,7 +1258,8 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_copySink
* Method: releaseSink * Method: releaseSink
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_releaseSink JNIEXPORT void JNICALL
Java_edu_wpi_cscore_CameraServerJNI_releaseSink
(JNIEnv* env, jclass, jint sink) (JNIEnv* env, jclass, jint sink)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -1211,7 +1272,8 @@ JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_releaseSink
* Method: getMjpegServerListenAddress * Method: getMjpegServerListenAddress
* Signature: (I)Ljava/lang/String; * Signature: (I)Ljava/lang/String;
*/ */
JNIEXPORT jstring JNICALL Java_edu_wpi_cscore_CameraServerJNI_getMjpegServerListenAddress JNIEXPORT jstring JNICALL
Java_edu_wpi_cscore_CameraServerJNI_getMjpegServerListenAddress
(JNIEnv* env, jclass, jint sink) (JNIEnv* env, jclass, jint sink)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -1225,7 +1287,8 @@ JNIEXPORT jstring JNICALL Java_edu_wpi_cscore_CameraServerJNI_getMjpegServerList
* Method: getMjpegServerPort * Method: getMjpegServerPort
* Signature: (I)I * Signature: (I)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getMjpegServerPort JNIEXPORT jint JNICALL
Java_edu_wpi_cscore_CameraServerJNI_getMjpegServerPort
(JNIEnv* env, jclass, jint sink) (JNIEnv* env, jclass, jint sink)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -1239,7 +1302,8 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getMjpegServerPort
* Method: setSinkDescription * Method: setSinkDescription
* Signature: (ILjava/lang/String;)V * Signature: (ILjava/lang/String;)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setSinkDescription JNIEXPORT void JNICALL
Java_edu_wpi_cscore_CameraServerJNI_setSinkDescription
(JNIEnv* env, jclass, jint sink, jstring description) (JNIEnv* env, jclass, jint sink, jstring description)
{ {
if (!description) { if (!description) {
@@ -1256,7 +1320,8 @@ JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setSinkDescription
* Method: grabSinkFrame * Method: grabSinkFrame
* Signature: (IJ)J * Signature: (IJ)J
*/ */
JNIEXPORT jlong JNICALL Java_edu_wpi_cscore_CameraServerJNI_grabSinkFrame JNIEXPORT jlong JNICALL
Java_edu_wpi_cscore_CameraServerJNI_grabSinkFrame
(JNIEnv* env, jclass, jint sink, jlong imageNativeObj) (JNIEnv* env, jclass, jint sink, jlong imageNativeObj)
{ {
cv::Mat& image = *((cv::Mat*)imageNativeObj); cv::Mat& image = *((cv::Mat*)imageNativeObj);
@@ -1271,7 +1336,8 @@ JNIEXPORT jlong JNICALL Java_edu_wpi_cscore_CameraServerJNI_grabSinkFrame
* Method: grabSinkFrameTimeout * Method: grabSinkFrameTimeout
* Signature: (IJD)J * Signature: (IJD)J
*/ */
JNIEXPORT jlong JNICALL Java_edu_wpi_cscore_CameraServerJNI_grabSinkFrameTimeout JNIEXPORT jlong JNICALL
Java_edu_wpi_cscore_CameraServerJNI_grabSinkFrameTimeout
(JNIEnv* env, jclass, jint sink, jlong imageNativeObj, jdouble timeout) (JNIEnv* env, jclass, jint sink, jlong imageNativeObj, jdouble timeout)
{ {
cv::Mat& image = *((cv::Mat*)imageNativeObj); cv::Mat& image = *((cv::Mat*)imageNativeObj);
@@ -1286,7 +1352,8 @@ JNIEXPORT jlong JNICALL Java_edu_wpi_cscore_CameraServerJNI_grabSinkFrameTimeout
* Method: getSinkError * Method: getSinkError
* Signature: (I)Ljava/lang/String; * Signature: (I)Ljava/lang/String;
*/ */
JNIEXPORT jstring JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSinkError JNIEXPORT jstring JNICALL
Java_edu_wpi_cscore_CameraServerJNI_getSinkError
(JNIEnv* env, jclass, jint sink) (JNIEnv* env, jclass, jint sink)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -1301,7 +1368,8 @@ JNIEXPORT jstring JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSinkError
* Method: setSinkEnabled * Method: setSinkEnabled
* Signature: (IZ)V * Signature: (IZ)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setSinkEnabled JNIEXPORT void JNICALL
Java_edu_wpi_cscore_CameraServerJNI_setSinkEnabled
(JNIEnv* env, jclass, jint sink, jboolean enabled) (JNIEnv* env, jclass, jint sink, jboolean enabled)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -1312,9 +1380,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setSinkEnabled
/* /*
* Class: edu_wpi_cscore_CameraServerJNI * Class: edu_wpi_cscore_CameraServerJNI
* Method: addListener * Method: addListener
* Signature: (Ljava/util/function/Consumer;IZ)I * Signature: (Ljava/lang/Object;IZ)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_addListener JNIEXPORT jint JNICALL
Java_edu_wpi_cscore_CameraServerJNI_addListener
(JNIEnv* envouter, jclass, jobject listener, jint eventMask, (JNIEnv* envouter, jclass, jobject listener, jint eventMask,
jboolean immediateNotify) jboolean immediateNotify)
{ {
@@ -1324,7 +1393,8 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_addListener
} }
// the shared pointer to the weak global will keep it around until the // the shared pointer to the weak global will keep it around until the
// entry listener is destroyed // entry listener is destroyed
auto listener_global = std::make_shared<JCSGlobal<jobject>>(envouter, listener); auto listener_global =
std::make_shared<JCSGlobal<jobject>>(envouter, listener);
// cls is a temporary here; cannot be used within callback functor // cls is a temporary here; cannot be used within callback functor
jclass cls = envouter->GetObjectClass(listener); jclass cls = envouter->GetObjectClass(listener);
@@ -1368,7 +1438,8 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_addListener
* Method: removeListener * Method: removeListener
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_removeListener JNIEXPORT void JNICALL
Java_edu_wpi_cscore_CameraServerJNI_removeListener
(JNIEnv* env, jclass, jint handle) (JNIEnv* env, jclass, jint handle)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -1381,7 +1452,8 @@ JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_removeListener
* Method: setTelemetryPeriod * Method: setTelemetryPeriod
* Signature: (D)V * Signature: (D)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setTelemetryPeriod JNIEXPORT void JNICALL
Java_edu_wpi_cscore_CameraServerJNI_setTelemetryPeriod
(JNIEnv* env, jclass, jdouble seconds) (JNIEnv* env, jclass, jdouble seconds)
{ {
cs::SetTelemetryPeriod(seconds); cs::SetTelemetryPeriod(seconds);
@@ -1392,7 +1464,8 @@ JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setTelemetryPeriod
* Method: getTelemetryElapsedTime * Method: getTelemetryElapsedTime
* Signature: ()D * Signature: ()D
*/ */
JNIEXPORT jdouble JNICALL Java_edu_wpi_cscore_CameraServerJNI_getTelemetryElapsedTime JNIEXPORT jdouble JNICALL
Java_edu_wpi_cscore_CameraServerJNI_getTelemetryElapsedTime
(JNIEnv* env, jclass) (JNIEnv* env, jclass)
{ {
return cs::GetTelemetryElapsedTime(); return cs::GetTelemetryElapsedTime();
@@ -1403,7 +1476,8 @@ JNIEXPORT jdouble JNICALL Java_edu_wpi_cscore_CameraServerJNI_getTelemetryElapse
* Method: getTelemetryValue * Method: getTelemetryValue
* Signature: (II)J * Signature: (II)J
*/ */
JNIEXPORT jlong JNICALL Java_edu_wpi_cscore_CameraServerJNI_getTelemetryValue JNIEXPORT jlong JNICALL
Java_edu_wpi_cscore_CameraServerJNI_getTelemetryValue
(JNIEnv* env, jclass, jint handle, jint kind) (JNIEnv* env, jclass, jint handle, jint kind)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -1418,13 +1492,13 @@ JNIEXPORT jlong JNICALL Java_edu_wpi_cscore_CameraServerJNI_getTelemetryValue
* Method: getTelemetryAverageValue * Method: getTelemetryAverageValue
* Signature: (II)D * Signature: (II)D
*/ */
JNIEXPORT jdouble JNICALL Java_edu_wpi_cscore_CameraServerJNI_getTelemetryAverageValue JNIEXPORT jdouble JNICALL
Java_edu_wpi_cscore_CameraServerJNI_getTelemetryAverageValue
(JNIEnv* env, jclass, jint handle, jint kind) (JNIEnv* env, jclass, jint handle, jint kind)
{ {
CS_Status status = 0; CS_Status status = 0;
auto val = cs::GetTelemetryAverageValue(handle, auto val = cs::GetTelemetryAverageValue(
static_cast<CS_TelemetryKind>(kind), handle, static_cast<CS_TelemetryKind>(kind), &status);
&status);
CheckStatus(env, status); CheckStatus(env, status);
return val; return val;
} }
@@ -1432,9 +1506,10 @@ JNIEXPORT jdouble JNICALL Java_edu_wpi_cscore_CameraServerJNI_getTelemetryAverag
/* /*
* Class: edu_wpi_cscore_CameraServerJNI * Class: edu_wpi_cscore_CameraServerJNI
* Method: enumerateUsbCameras * Method: enumerateUsbCameras
* Signature: ()[Ledu/wpi/cameraserver/UsbCameraInfo; * Signature: ()[Ljava/lang/Object;
*/ */
JNIEXPORT jobjectArray JNICALL Java_edu_wpi_cscore_CameraServerJNI_enumerateUsbCameras JNIEXPORT jobjectArray JNICALL
Java_edu_wpi_cscore_CameraServerJNI_enumerateUsbCameras
(JNIEnv* env, jclass) (JNIEnv* env, jclass)
{ {
#ifndef __linux__ #ifndef __linux__
@@ -1460,7 +1535,8 @@ JNIEXPORT jobjectArray JNICALL Java_edu_wpi_cscore_CameraServerJNI_enumerateUsbC
* Method: enumerateSources * Method: enumerateSources
* Signature: ()[I * Signature: ()[I
*/ */
JNIEXPORT jintArray JNICALL Java_edu_wpi_cscore_CameraServerJNI_enumerateSources JNIEXPORT jintArray JNICALL
Java_edu_wpi_cscore_CameraServerJNI_enumerateSources
(JNIEnv* env, jclass) (JNIEnv* env, jclass)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -1475,7 +1551,8 @@ JNIEXPORT jintArray JNICALL Java_edu_wpi_cscore_CameraServerJNI_enumerateSources
* Method: enumerateSinks * Method: enumerateSinks
* Signature: ()[I * Signature: ()[I
*/ */
JNIEXPORT jintArray JNICALL Java_edu_wpi_cscore_CameraServerJNI_enumerateSinks JNIEXPORT jintArray JNICALL
Java_edu_wpi_cscore_CameraServerJNI_enumerateSinks
(JNIEnv* env, jclass) (JNIEnv* env, jclass)
{ {
CS_Status status = 0; CS_Status status = 0;
@@ -1490,7 +1567,8 @@ JNIEXPORT jintArray JNICALL Java_edu_wpi_cscore_CameraServerJNI_enumerateSinks
* Method: getHostname * Method: getHostname
* Signature: ()Ljava/lang/String; * Signature: ()Ljava/lang/String;
*/ */
JNIEXPORT jstring JNICALL Java_edu_wpi_cscore_CameraServerJNI_getHostname JNIEXPORT jstring JNICALL
Java_edu_wpi_cscore_CameraServerJNI_getHostname
(JNIEnv* env, jclass) (JNIEnv* env, jclass)
{ {
return MakeJString(env, cs::GetHostname()); return MakeJString(env, cs::GetHostname());
@@ -1499,9 +1577,10 @@ JNIEXPORT jstring JNICALL Java_edu_wpi_cscore_CameraServerJNI_getHostname
/* /*
* Class: edu_wpi_cscore_CameraServerJNI * Class: edu_wpi_cscore_CameraServerJNI
* Method: getNetworkInterfaces * Method: getNetworkInterfaces
* Signature: ()[Ljava/lang/String; * Signature: ()[Ljava/lang/Object;
*/ */
JNIEXPORT jobjectArray JNICALL Java_edu_wpi_cscore_CameraServerJNI_getNetworkInterfaces JNIEXPORT jobjectArray JNICALL
Java_edu_wpi_cscore_CameraServerJNI_getNetworkInterfaces
(JNIEnv* env, jclass) (JNIEnv* env, jclass)
{ {
return MakeJStringArray(env, cs::GetNetworkInterfaces()); return MakeJStringArray(env, cs::GetNetworkInterfaces());
@@ -1536,16 +1615,17 @@ struct LogMessage {
typedef JSingletonCallbackManager<LogMessage> LoggerJNI; typedef JSingletonCallbackManager<LogMessage> LoggerJNI;
} // anonymous namespace } // namespace
extern "C" { extern "C" {
/* /*
* Class: edu_wpi_cscore_CameraServerJNI * Class: edu_wpi_cscore_CameraServerJNI
* Method: setLogger * Method: setLogger
* Signature: (Ledu/wpi/cscore/CameraServerJNI/LoggerFunction;I)V * Signature: (Ljava/lang/Object;I)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setLogger JNIEXPORT void JNICALL
Java_edu_wpi_cscore_CameraServerJNI_setLogger
(JNIEnv* env, jclass, jobject func, jint minLevel) (JNIEnv* env, jclass, jobject func, jint minLevel)
{ {
if (!func) { if (!func) {

View File

@@ -164,8 +164,7 @@ CS_Source CreateUsbCameraPath(wpi::StringRef name, wpi::StringRef path,
CS_Status* status); CS_Status* status);
CS_Source CreateHttpCamera(wpi::StringRef name, wpi::StringRef url, CS_Source CreateHttpCamera(wpi::StringRef name, wpi::StringRef url,
CS_HttpCameraKind kind, CS_Status* status); CS_HttpCameraKind kind, CS_Status* status);
CS_Source CreateHttpCamera(wpi::StringRef name, CS_Source CreateHttpCamera(wpi::StringRef name, wpi::ArrayRef<std::string> urls,
wpi::ArrayRef<std::string> urls,
CS_HttpCameraKind kind, CS_Status* status); CS_HttpCameraKind kind, CS_Status* status);
CS_Source CreateCvSource(wpi::StringRef name, const VideoMode& mode, CS_Source CreateCvSource(wpi::StringRef name, const VideoMode& mode,
CS_Status* status); CS_Status* status);
@@ -175,8 +174,7 @@ CS_Source CreateCvSource(wpi::StringRef name, const VideoMode& mode,
// //
CS_SourceKind GetSourceKind(CS_Source source, CS_Status* status); CS_SourceKind GetSourceKind(CS_Source source, CS_Status* status);
std::string GetSourceName(CS_Source source, CS_Status* status); std::string GetSourceName(CS_Source source, CS_Status* status);
wpi::StringRef GetSourceName(CS_Source source, wpi::StringRef GetSourceName(CS_Source source, wpi::SmallVectorImpl<char>& buf,
wpi::SmallVectorImpl<char>& buf,
CS_Status* status); CS_Status* status);
std::string GetSourceDescription(CS_Source source, CS_Status* status); std::string GetSourceDescription(CS_Source source, CS_Status* status);
wpi::StringRef GetSourceDescription(CS_Source source, wpi::StringRef GetSourceDescription(CS_Source source,
@@ -199,8 +197,9 @@ bool SetSourceResolution(CS_Source source, int width, int height,
bool SetSourceFPS(CS_Source source, int fps, CS_Status* status); bool SetSourceFPS(CS_Source source, int fps, CS_Status* status);
std::vector<VideoMode> EnumerateSourceVideoModes(CS_Source source, std::vector<VideoMode> EnumerateSourceVideoModes(CS_Source source,
CS_Status* status); CS_Status* status);
wpi::ArrayRef<CS_Sink> EnumerateSourceSinks( wpi::ArrayRef<CS_Sink> EnumerateSourceSinks(CS_Source source,
CS_Source source, wpi::SmallVectorImpl<CS_Sink>& vec, CS_Status* status); wpi::SmallVectorImpl<CS_Sink>& vec,
CS_Status* status);
CS_Source CopySource(CS_Source source, CS_Status* status); CS_Source CopySource(CS_Source source, CS_Status* status);
void ReleaseSource(CS_Source source, CS_Status* status); void ReleaseSource(CS_Source source, CS_Status* status);
@@ -234,8 +233,7 @@ std::vector<std::string> GetHttpCameraUrls(CS_Source source, CS_Status* status);
// OpenCV Source Functions // OpenCV Source Functions
// //
void PutSourceFrame(CS_Source source, cv::Mat& image, CS_Status* status); void PutSourceFrame(CS_Source source, cv::Mat& image, CS_Status* status);
void NotifySourceError(CS_Source source, wpi::StringRef msg, void NotifySourceError(CS_Source source, wpi::StringRef msg, CS_Status* status);
CS_Status* status);
void SetSourceConnected(CS_Source source, bool connected, CS_Status* status); void SetSourceConnected(CS_Source source, bool connected, CS_Status* status);
void SetSourceDescription(CS_Source source, wpi::StringRef description, void SetSourceDescription(CS_Source source, wpi::StringRef description,
CS_Status* status); CS_Status* status);
@@ -265,8 +263,7 @@ std::string GetSinkName(CS_Sink sink, CS_Status* status);
wpi::StringRef GetSinkName(CS_Sink sink, wpi::SmallVectorImpl<char>& buf, wpi::StringRef GetSinkName(CS_Sink sink, wpi::SmallVectorImpl<char>& buf,
CS_Status* status); CS_Status* status);
std::string GetSinkDescription(CS_Sink sink, CS_Status* status); std::string GetSinkDescription(CS_Sink sink, CS_Status* status);
wpi::StringRef GetSinkDescription(CS_Sink sink, wpi::StringRef GetSinkDescription(CS_Sink sink, wpi::SmallVectorImpl<char>& buf,
wpi::SmallVectorImpl<char>& buf,
CS_Status* status); CS_Status* status);
void SetSinkSource(CS_Sink sink, CS_Source source, CS_Status* status); void SetSinkSource(CS_Sink sink, CS_Source source, CS_Status* status);
CS_Property GetSinkSourceProperty(CS_Sink sink, wpi::StringRef name, CS_Property GetSinkSourceProperty(CS_Sink sink, wpi::StringRef name,
@@ -333,8 +330,8 @@ std::vector<UsbCameraInfo> EnumerateUsbCameras(CS_Status* status);
wpi::ArrayRef<CS_Source> EnumerateSourceHandles( wpi::ArrayRef<CS_Source> EnumerateSourceHandles(
wpi::SmallVectorImpl<CS_Source>& vec, CS_Status* status); wpi::SmallVectorImpl<CS_Source>& vec, CS_Status* status);
wpi::ArrayRef<CS_Sink> EnumerateSinkHandles( wpi::ArrayRef<CS_Sink> EnumerateSinkHandles(wpi::SmallVectorImpl<CS_Sink>& vec,
wpi::SmallVectorImpl<CS_Sink>& vec, CS_Status* status); CS_Status* status);
std::string GetHostname(); std::string GetHostname();

View File

@@ -448,8 +448,7 @@ class CvSource : public VideoSource {
/// @param defaultValue Default value /// @param defaultValue Default value
/// @param value Current value /// @param value Current value
/// @return Property /// @return Property
VideoProperty CreateStringProperty(wpi::StringRef name, VideoProperty CreateStringProperty(wpi::StringRef name, wpi::StringRef value);
wpi::StringRef value);
/// Configure enum property choices. /// Configure enum property choices.
/// @param property Property /// @param property Property

View File

@@ -9,9 +9,6 @@ cppSrcFileInclude {
} }
generatedFileExclude { generatedFileExclude {
gtest/
ni-libraries/include/
ni-libraries/lib/
hal/src/main/native/athena/ctre/ hal/src/main/native/athena/ctre/
hal/src/main/native/athena/frccansae/ hal/src/main/native/athena/frccansae/
hal/src/main/native/athena/visa/ hal/src/main/native/athena/visa/
@@ -20,13 +17,16 @@ generatedFileExclude {
} }
modifiableFileExclude { modifiableFileExclude {
src/main/native/cpp/jni/
\.patch$ \.patch$
\.png$ \.png$
\.py$ \.py$
\.so$ \.so$
} }
repoRootNameOverride {
hal
}
includeOtherLibs { includeOtherLibs {
^FRC_FPGA_ChipObject/ ^FRC_FPGA_ChipObject/
^FRC_NetworkCommunication/ ^FRC_NetworkCommunication/
@@ -35,6 +35,7 @@ includeOtherLibs {
^opencv2/ ^opencv2/
^spilib/ ^spilib/
^support/ ^support/
^wpi/
} }
includeProject { includeProject {

View File

@@ -7,11 +7,11 @@
#include "HAL/DIO.h" #include "HAL/DIO.h"
#include <wpi/raw_ostream.h>
#include <cmath> #include <cmath>
#include <thread> #include <thread>
#include <wpi/raw_ostream.h>
#include "DigitalInternal.h" #include "DigitalInternal.h"
#include "HAL/cpp/fpga_clock.h" #include "HAL/cpp/fpga_clock.h"
#include "HAL/handles/HandlesInternal.h" #include "HAL/handles/HandlesInternal.h"

View File

@@ -7,11 +7,11 @@
#include "HAL/PWM.h" #include "HAL/PWM.h"
#include <wpi/raw_ostream.h>
#include <cmath> #include <cmath>
#include <thread> #include <thread>
#include <wpi/raw_ostream.h>
#include "ConstantsInternal.h" #include "ConstantsInternal.h"
#include "DigitalInternal.h" #include "DigitalInternal.h"
#include "HAL/cpp/fpga_clock.h" #include "HAL/cpp/fpga_clock.h"

View File

@@ -16,8 +16,8 @@
#include <atomic> #include <atomic>
#include <cstring> #include <cstring>
#include <wpi/raw_ostream.h>
#include <wpi/mutex.h> #include <wpi/mutex.h>
#include <wpi/raw_ostream.h>
#include "DigitalInternal.h" #include "DigitalInternal.h"
#include "HAL/DIO.h" #include "HAL/DIO.h"

View File

@@ -151,7 +151,7 @@ void SerialHelper::CoiteratedSort(
for (auto& str : m_sortedHubPath) { for (auto& str : m_sortedHubPath) {
for (size_t i = 0; i < m_unsortedHubPath.size(); i++) { for (size_t i = 0; i < m_unsortedHubPath.size(); i++) {
if (wpi::StringRef{m_unsortedHubPath[i].begin(), if (wpi::StringRef{m_unsortedHubPath[i].begin(),
m_unsortedHubPath[i].size()} m_unsortedHubPath[i].size()}
.equals(wpi::StringRef{str.begin(), str.size()})) { .equals(wpi::StringRef{str.begin(), str.size()})) {
sortedVec.push_back(vec[i]); sortedVec.push_back(vec[i]);
break; break;

View File

@@ -1,12 +1,13 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */ /* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
#include "HAL/Accelerometer.h"
#include <jni.h> #include <jni.h>
#include "HAL/Accelerometer.h"
#include "edu_wpi_first_wpilibj_hal_AccelerometerJNI.h" #include "edu_wpi_first_wpilibj_hal_AccelerometerJNI.h"
extern "C" { extern "C" {
@@ -17,8 +18,9 @@ extern "C" {
* Signature: (Z)V * Signature: (Z)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_AccelerometerJNI_setAccelerometerActive( Java_edu_wpi_first_wpilibj_hal_AccelerometerJNI_setAccelerometerActive
JNIEnv *, jclass, jboolean active) { (JNIEnv*, jclass, jboolean active)
{
HAL_SetAccelerometerActive(active); HAL_SetAccelerometerActive(active);
} }
@@ -28,8 +30,9 @@ Java_edu_wpi_first_wpilibj_hal_AccelerometerJNI_setAccelerometerActive(
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_AccelerometerJNI_setAccelerometerRange( Java_edu_wpi_first_wpilibj_hal_AccelerometerJNI_setAccelerometerRange
JNIEnv *, jclass, jint range) { (JNIEnv*, jclass, jint range)
{
HAL_SetAccelerometerRange((HAL_AccelerometerRange)range); HAL_SetAccelerometerRange((HAL_AccelerometerRange)range);
} }
@@ -39,8 +42,9 @@ Java_edu_wpi_first_wpilibj_hal_AccelerometerJNI_setAccelerometerRange(
* Signature: ()D * Signature: ()D
*/ */
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_wpilibj_hal_AccelerometerJNI_getAccelerometerX( Java_edu_wpi_first_wpilibj_hal_AccelerometerJNI_getAccelerometerX
JNIEnv *, jclass) { (JNIEnv*, jclass)
{
return HAL_GetAccelerometerX(); return HAL_GetAccelerometerX();
} }
@@ -50,8 +54,9 @@ Java_edu_wpi_first_wpilibj_hal_AccelerometerJNI_getAccelerometerX(
* Signature: ()D * Signature: ()D
*/ */
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_wpilibj_hal_AccelerometerJNI_getAccelerometerY( Java_edu_wpi_first_wpilibj_hal_AccelerometerJNI_getAccelerometerY
JNIEnv *, jclass) { (JNIEnv*, jclass)
{
return HAL_GetAccelerometerY(); return HAL_GetAccelerometerY();
} }
@@ -61,8 +66,9 @@ Java_edu_wpi_first_wpilibj_hal_AccelerometerJNI_getAccelerometerY(
* Signature: ()D * Signature: ()D
*/ */
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_wpilibj_hal_AccelerometerJNI_getAccelerometerZ( Java_edu_wpi_first_wpilibj_hal_AccelerometerJNI_getAccelerometerZ
JNIEnv *, jclass) { (JNIEnv*, jclass)
{
return HAL_GetAccelerometerZ(); return HAL_GetAccelerometerZ();
} }

View File

@@ -1,19 +1,19 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */ /* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
#include <assert.h>
#include <jni.h> #include <jni.h>
#include "HAL/cpp/Log.h"
#include "edu_wpi_first_wpilibj_hal_AnalogGyroJNI.h" #include <cassert>
#include "HAL/AnalogGyro.h" #include "HAL/AnalogGyro.h"
#include "HALUtil.h" #include "HAL/cpp/Log.h"
#include "HAL/handles/HandlesInternal.h" #include "HAL/handles/HandlesInternal.h"
#include "HALUtil.h"
#include "edu_wpi_first_wpilibj_hal_AnalogGyroJNI.h"
using namespace frc; using namespace frc;
@@ -22,9 +22,9 @@ TLogLevel analogGyroJNILogLevel = logWARNING;
#define ANALOGGYROJNI_LOG(level) \ #define ANALOGGYROJNI_LOG(level) \
if (level > analogGyroJNILogLevel) \ if (level > analogGyroJNILogLevel) \
; \ ; \
else \ else \
Log().Get(level) Log().Get(level)
extern "C" { extern "C" {
/* /*
@@ -32,17 +32,21 @@ extern "C" {
* Method: initializeAnalogGyro * Method: initializeAnalogGyro
* Signature: (I)I * Signature: (I)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_initializeAnalogGyro( JNIEXPORT jint JNICALL
JNIEnv* env, jclass, jint id) { Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_initializeAnalogGyro
(JNIEnv* env, jclass, jint id)
{
ANALOGGYROJNI_LOG(logDEBUG) << "Calling ANALOGGYROJNI initializeAnalogGyro"; ANALOGGYROJNI_LOG(logDEBUG) << "Calling ANALOGGYROJNI initializeAnalogGyro";
ANALOGGYROJNI_LOG(logDEBUG) << "Analog Input Handle = " << (HAL_AnalogInputHandle)id; ANALOGGYROJNI_LOG(logDEBUG)
<< "Analog Input Handle = " << (HAL_AnalogInputHandle)id;
int32_t status = 0; int32_t status = 0;
HAL_GyroHandle handle = HAL_InitializeAnalogGyro((HAL_AnalogInputHandle)id, &status); HAL_GyroHandle handle =
HAL_InitializeAnalogGyro((HAL_AnalogInputHandle)id, &status);
ANALOGGYROJNI_LOG(logDEBUG) << "Status = " << status; ANALOGGYROJNI_LOG(logDEBUG) << "Status = " << status;
ANALOGGYROJNI_LOG(logDEBUG) << "Gyro Handle = " << handle; ANALOGGYROJNI_LOG(logDEBUG) << "Gyro Handle = " << handle;
// Analog input does range checking, so we don't need to do so. // Analog input does range checking, so we don't need to do so.
CheckStatusForceThrow(env, status); CheckStatusForceThrow(env, status);
return (jint) handle; return (jint)handle;
} }
/* /*
@@ -50,8 +54,10 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_initializeAn
* Method: setupAnalogGyro * Method: setupAnalogGyro
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_setupAnalogGyro( JNIEXPORT void JNICALL
JNIEnv* env, jclass, jint id) { Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_setupAnalogGyro
(JNIEnv* env, jclass, jint id)
{
ANALOGGYROJNI_LOG(logDEBUG) << "Calling ANALOGGYROJNI setupAnalogGyro"; ANALOGGYROJNI_LOG(logDEBUG) << "Calling ANALOGGYROJNI setupAnalogGyro";
ANALOGGYROJNI_LOG(logDEBUG) << "Gyro Handle = " << (HAL_GyroHandle)id; ANALOGGYROJNI_LOG(logDEBUG) << "Gyro Handle = " << (HAL_GyroHandle)id;
int32_t status = 0; int32_t status = 0;
@@ -65,8 +71,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_setupAnalogG
* Method: freeAnalogGyro * Method: freeAnalogGyro
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_freeAnalogGyro( JNIEXPORT void JNICALL
JNIEnv* env, jclass, jint id) { Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_freeAnalogGyro
(JNIEnv* env, jclass, jint id)
{
ANALOGGYROJNI_LOG(logDEBUG) << "Calling ANALOGGYROJNI freeAnalogGyro"; ANALOGGYROJNI_LOG(logDEBUG) << "Calling ANALOGGYROJNI freeAnalogGyro";
ANALOGGYROJNI_LOG(logDEBUG) << "Gyro Handle = " << (HAL_GyroHandle)id; ANALOGGYROJNI_LOG(logDEBUG) << "Gyro Handle = " << (HAL_GyroHandle)id;
HAL_FreeAnalogGyro((HAL_GyroHandle)id); HAL_FreeAnalogGyro((HAL_GyroHandle)id);
@@ -77,12 +85,16 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_freeAnalogGy
* Method: setAnalogGyroParameters * Method: setAnalogGyroParameters
* Signature: (IDDI)V * Signature: (IDDI)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_setAnalogGyroParameters( JNIEXPORT void JNICALL
JNIEnv* env, jclass, jint id, jdouble vPDPS, jdouble offset, jint center) { Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_setAnalogGyroParameters
ANALOGGYROJNI_LOG(logDEBUG) << "Calling ANALOGGYROJNI setAnalogGyroParameters"; (JNIEnv* env, jclass, jint id, jdouble vPDPS, jdouble offset, jint center)
{
ANALOGGYROJNI_LOG(logDEBUG)
<< "Calling ANALOGGYROJNI setAnalogGyroParameters";
ANALOGGYROJNI_LOG(logDEBUG) << "Gyro Handle = " << (HAL_GyroHandle)id; ANALOGGYROJNI_LOG(logDEBUG) << "Gyro Handle = " << (HAL_GyroHandle)id;
int32_t status = 0; int32_t status = 0;
HAL_SetAnalogGyroParameters((HAL_GyroHandle)id, vPDPS, offset, center, &status); HAL_SetAnalogGyroParameters((HAL_GyroHandle)id, vPDPS, offset, center,
&status);
ANALOGGYROJNI_LOG(logDEBUG) << "Status = " << status; ANALOGGYROJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status); CheckStatus(env, status);
} }
@@ -92,9 +104,12 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_setAnalogGyr
* Method: setAnalogGyroVoltsPerDegreePerSecond * Method: setAnalogGyroVoltsPerDegreePerSecond
* Signature: (ID)V * Signature: (ID)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_setAnalogGyroVoltsPerDegreePerSecond( JNIEXPORT void JNICALL
JNIEnv* env, jclass, jint id, jdouble vPDPS) { Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_setAnalogGyroVoltsPerDegreePerSecond
ANALOGGYROJNI_LOG(logDEBUG) << "Calling ANALOGGYROJNI setAnalogGyroVoltsPerDegreePerSecond"; (JNIEnv* env, jclass, jint id, jdouble vPDPS)
{
ANALOGGYROJNI_LOG(logDEBUG)
<< "Calling ANALOGGYROJNI setAnalogGyroVoltsPerDegreePerSecond";
ANALOGGYROJNI_LOG(logDEBUG) << "Gyro Handle = " << (HAL_GyroHandle)id; ANALOGGYROJNI_LOG(logDEBUG) << "Gyro Handle = " << (HAL_GyroHandle)id;
ANALOGGYROJNI_LOG(logDEBUG) << "vPDPS = " << vPDPS; ANALOGGYROJNI_LOG(logDEBUG) << "vPDPS = " << vPDPS;
int32_t status = 0; int32_t status = 0;
@@ -108,8 +123,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_setAnalogGyr
* Method: resetAnalogGyro * Method: resetAnalogGyro
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_resetAnalogGyro( JNIEXPORT void JNICALL
JNIEnv* env, jclass, jint id) { Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_resetAnalogGyro
(JNIEnv* env, jclass, jint id)
{
ANALOGGYROJNI_LOG(logDEBUG) << "Calling ANALOGGYROJNI resetAnalogGyro"; ANALOGGYROJNI_LOG(logDEBUG) << "Calling ANALOGGYROJNI resetAnalogGyro";
ANALOGGYROJNI_LOG(logDEBUG) << "Gyro Handle = " << (HAL_GyroHandle)id; ANALOGGYROJNI_LOG(logDEBUG) << "Gyro Handle = " << (HAL_GyroHandle)id;
int32_t status = 0; int32_t status = 0;
@@ -123,8 +140,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_resetAnalogG
* Method: calibrateAnalogGyro * Method: calibrateAnalogGyro
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_calibrateAnalogGyro( JNIEXPORT void JNICALL
JNIEnv* env, jclass, jint id) { Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_calibrateAnalogGyro
(JNIEnv* env, jclass, jint id)
{
ANALOGGYROJNI_LOG(logDEBUG) << "Calling ANALOGGYROJNI calibrateAnalogGyro"; ANALOGGYROJNI_LOG(logDEBUG) << "Calling ANALOGGYROJNI calibrateAnalogGyro";
ANALOGGYROJNI_LOG(logDEBUG) << "Gyro Handle = " << (HAL_GyroHandle)id; ANALOGGYROJNI_LOG(logDEBUG) << "Gyro Handle = " << (HAL_GyroHandle)id;
int32_t status = 0; int32_t status = 0;
@@ -138,8 +157,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_calibrateAna
* Method: setAnalogGyroDeadband * Method: setAnalogGyroDeadband
* Signature: (ID)V * Signature: (ID)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_setAnalogGyroDeadband( JNIEXPORT void JNICALL
JNIEnv* env, jclass, jint id, jdouble deadband) { Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_setAnalogGyroDeadband
(JNIEnv* env, jclass, jint id, jdouble deadband)
{
ANALOGGYROJNI_LOG(logDEBUG) << "Calling ANALOGGYROJNI setAnalogGyroDeadband"; ANALOGGYROJNI_LOG(logDEBUG) << "Calling ANALOGGYROJNI setAnalogGyroDeadband";
ANALOGGYROJNI_LOG(logDEBUG) << "Gyro Handle = " << (HAL_GyroHandle)id; ANALOGGYROJNI_LOG(logDEBUG) << "Gyro Handle = " << (HAL_GyroHandle)id;
int32_t status = 0; int32_t status = 0;
@@ -153,8 +174,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_setAnalogGyr
* Method: getAnalogGyroAngle * Method: getAnalogGyroAngle
* Signature: (I)D * Signature: (I)D
*/ */
JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_getAnalogGyroAngle( JNIEXPORT jdouble JNICALL
JNIEnv* env, jclass, jint id) { Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_getAnalogGyroAngle
(JNIEnv* env, jclass, jint id)
{
ANALOGGYROJNI_LOG(logDEBUG) << "Calling ANALOGGYROJNI getAnalogGyroAngle"; ANALOGGYROJNI_LOG(logDEBUG) << "Calling ANALOGGYROJNI getAnalogGyroAngle";
ANALOGGYROJNI_LOG(logDEBUG) << "Gyro Handle = " << (HAL_GyroHandle)id; ANALOGGYROJNI_LOG(logDEBUG) << "Gyro Handle = " << (HAL_GyroHandle)id;
int32_t status = 0; int32_t status = 0;
@@ -170,8 +193,10 @@ JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_getAnalog
* Method: getAnalogGyroRate * Method: getAnalogGyroRate
* Signature: (I)D * Signature: (I)D
*/ */
JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_getAnalogGyroRate( JNIEXPORT jdouble JNICALL
JNIEnv* env, jclass, jint id) { Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_getAnalogGyroRate
(JNIEnv* env, jclass, jint id)
{
ANALOGGYROJNI_LOG(logDEBUG) << "Calling ANALOGGYROJNI getAnalogGyroRate"; ANALOGGYROJNI_LOG(logDEBUG) << "Calling ANALOGGYROJNI getAnalogGyroRate";
ANALOGGYROJNI_LOG(logDEBUG) << "Gyro Handle = " << (HAL_GyroHandle)id; ANALOGGYROJNI_LOG(logDEBUG) << "Gyro Handle = " << (HAL_GyroHandle)id;
int32_t status = 0; int32_t status = 0;
@@ -187,8 +212,10 @@ JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_getAnalog
* Method: getAnalogGyroOffset * Method: getAnalogGyroOffset
* Signature: (I)D * Signature: (I)D
*/ */
JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_getAnalogGyroOffset( JNIEXPORT jdouble JNICALL
JNIEnv* env, jclass, jint id) { Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_getAnalogGyroOffset
(JNIEnv* env, jclass, jint id)
{
ANALOGGYROJNI_LOG(logDEBUG) << "Calling ANALOGGYROJNI getAnalogGyroOffset"; ANALOGGYROJNI_LOG(logDEBUG) << "Calling ANALOGGYROJNI getAnalogGyroOffset";
ANALOGGYROJNI_LOG(logDEBUG) << "Gyro Handle = " << (HAL_GyroHandle)id; ANALOGGYROJNI_LOG(logDEBUG) << "Gyro Handle = " << (HAL_GyroHandle)id;
int32_t status = 0; int32_t status = 0;
@@ -204,8 +231,10 @@ JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_getAnalog
* Method: getAnalogGyroCenter * Method: getAnalogGyroCenter
* Signature: (I)I * Signature: (I)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_getAnalogGyroCenter( JNIEXPORT jint JNICALL
JNIEnv* env, jclass, jint id) { Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_getAnalogGyroCenter
(JNIEnv* env, jclass, jint id)
{
ANALOGGYROJNI_LOG(logDEBUG) << "Calling ANALOGGYROJNI getAnalogGyroCenter"; ANALOGGYROJNI_LOG(logDEBUG) << "Calling ANALOGGYROJNI getAnalogGyroCenter";
ANALOGGYROJNI_LOG(logDEBUG) << "Gyro Handle = " << (HAL_GyroHandle)id; ANALOGGYROJNI_LOG(logDEBUG) << "Gyro Handle = " << (HAL_GyroHandle)id;
int32_t status = 0; int32_t status = 0;

View File

@@ -1,23 +1,23 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */ /* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
#include <assert.h>
#include <jni.h> #include <jni.h>
#include "HAL/cpp/Log.h"
#include "edu_wpi_first_wpilibj_hal_AnalogJNI.h" #include <cassert>
#include "HAL/AnalogAccumulator.h"
#include "HAL/AnalogInput.h" #include "HAL/AnalogInput.h"
#include "HAL/AnalogOutput.h" #include "HAL/AnalogOutput.h"
#include "HAL/AnalogAccumulator.h"
#include "HAL/AnalogTrigger.h" #include "HAL/AnalogTrigger.h"
#include "HAL/Ports.h" #include "HAL/Ports.h"
#include "HALUtil.h" #include "HAL/cpp/Log.h"
#include "HAL/handles/HandlesInternal.h" #include "HAL/handles/HandlesInternal.h"
#include "HALUtil.h"
#include "edu_wpi_first_wpilibj_hal_AnalogJNI.h"
using namespace frc; using namespace frc;
@@ -28,7 +28,7 @@ TLogLevel analogJNILogLevel = logWARNING;
if (level > analogJNILogLevel) \ if (level > analogJNILogLevel) \
; \ ; \
else \ else \
Log().Get(level) Log().Get(level)
extern "C" { extern "C" {
@@ -38,14 +38,15 @@ extern "C" {
* Signature: (I)I * Signature: (I)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_AnalogJNI_initializeAnalogInputPort( Java_edu_wpi_first_wpilibj_hal_AnalogJNI_initializeAnalogInputPort
JNIEnv *env, jclass, jint id) { (JNIEnv* env, jclass, jint id)
{
ANALOGJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_PortHandle)id; ANALOGJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_PortHandle)id;
int32_t status = 0; int32_t status = 0;
auto analog = HAL_InitializeAnalogInputPort((HAL_PortHandle)id, &status); auto analog = HAL_InitializeAnalogInputPort((HAL_PortHandle)id, &status);
ANALOGJNI_LOG(logDEBUG) << "Status = " << status; ANALOGJNI_LOG(logDEBUG) << "Status = " << status;
ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << analog; ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << analog;
CheckStatusRange(env, status, 0, HAL_GetNumAnalogInputs(), CheckStatusRange(env, status, 0, HAL_GetNumAnalogInputs(),
hal::getPortHandleChannel((HAL_PortHandle)id)); hal::getPortHandleChannel((HAL_PortHandle)id));
return (jint)analog; return (jint)analog;
} }
@@ -56,8 +57,9 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_initializeAnalogInputPort(
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_AnalogJNI_freeAnalogInputPort( Java_edu_wpi_first_wpilibj_hal_AnalogJNI_freeAnalogInputPort
JNIEnv *env, jclass, jint id) { (JNIEnv* env, jclass, jint id)
{
ANALOGJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_AnalogInputHandle)id; ANALOGJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_AnalogInputHandle)id;
HAL_FreeAnalogInputPort((HAL_AnalogInputHandle)id); HAL_FreeAnalogInputPort((HAL_AnalogInputHandle)id);
} }
@@ -68,14 +70,16 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_freeAnalogInputPort(
* Signature: (I)I * Signature: (I)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_AnalogJNI_initializeAnalogOutputPort( Java_edu_wpi_first_wpilibj_hal_AnalogJNI_initializeAnalogOutputPort
JNIEnv *env, jclass, jint id) { (JNIEnv* env, jclass, jint id)
{
ANALOGJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_PortHandle)id; ANALOGJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_PortHandle)id;
int32_t status = 0; int32_t status = 0;
HAL_AnalogOutputHandle analog = HAL_InitializeAnalogOutputPort((HAL_PortHandle)id, &status); HAL_AnalogOutputHandle analog =
HAL_InitializeAnalogOutputPort((HAL_PortHandle)id, &status);
ANALOGJNI_LOG(logDEBUG) << "Status = " << status; ANALOGJNI_LOG(logDEBUG) << "Status = " << status;
ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << analog; ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << analog;
CheckStatusRange(env, status, 0, HAL_GetNumAnalogOutputs(), CheckStatusRange(env, status, 0, HAL_GetNumAnalogOutputs(),
hal::getPortHandleChannel((HAL_PortHandle)id)); hal::getPortHandleChannel((HAL_PortHandle)id));
return (jlong)analog; return (jlong)analog;
} }
@@ -86,8 +90,9 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_initializeAnalogOutputPort(
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_AnalogJNI_freeAnalogOutputPort( Java_edu_wpi_first_wpilibj_hal_AnalogJNI_freeAnalogOutputPort
JNIEnv *env, jclass, jint id) { (JNIEnv* env, jclass, jint id)
{
ANALOGJNI_LOG(logDEBUG) << "Port Handle = " << id; ANALOGJNI_LOG(logDEBUG) << "Port Handle = " << id;
HAL_FreeAnalogOutputPort((HAL_AnalogOutputHandle)id); HAL_FreeAnalogOutputPort((HAL_AnalogOutputHandle)id);
} }
@@ -98,8 +103,9 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_freeAnalogOutputPort(
* Signature: (B)Z * Signature: (B)Z
*/ */
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_AnalogJNI_checkAnalogModule( Java_edu_wpi_first_wpilibj_hal_AnalogJNI_checkAnalogModule
JNIEnv *, jclass, jbyte value) { (JNIEnv*, jclass, jbyte value)
{
// ANALOGJNI_LOG(logDEBUG) << "Module = " << (jint)value; // ANALOGJNI_LOG(logDEBUG) << "Module = " << (jint)value;
jboolean returnValue = HAL_CheckAnalogModule(value); jboolean returnValue = HAL_CheckAnalogModule(value);
// ANALOGJNI_LOG(logDEBUG) << "checkAnalogModuleResult = " << // ANALOGJNI_LOG(logDEBUG) << "checkAnalogModuleResult = " <<
@@ -113,8 +119,9 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_checkAnalogModule(
* Signature: (I)Z * Signature: (I)Z
*/ */
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_AnalogJNI_checkAnalogInputChannel( Java_edu_wpi_first_wpilibj_hal_AnalogJNI_checkAnalogInputChannel
JNIEnv *, jclass, jint value) { (JNIEnv*, jclass, jint value)
{
// ANALOGJNI_LOG(logDEBUG) << "Channel = " << value; // ANALOGJNI_LOG(logDEBUG) << "Channel = " << value;
jboolean returnValue = HAL_CheckAnalogInputChannel(value); jboolean returnValue = HAL_CheckAnalogInputChannel(value);
// ANALOGJNI_LOG(logDEBUG) << "checkAnalogChannelResult = " << // ANALOGJNI_LOG(logDEBUG) << "checkAnalogChannelResult = " <<
@@ -128,8 +135,9 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_checkAnalogInputChannel(
* Signature: (I)Z * Signature: (I)Z
*/ */
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_AnalogJNI_checkAnalogOutputChannel( Java_edu_wpi_first_wpilibj_hal_AnalogJNI_checkAnalogOutputChannel
JNIEnv *, jclass, jint value) { (JNIEnv*, jclass, jint value)
{
// ANALOGJNI_LOG(logDEBUG) << "Channel = " << value; // ANALOGJNI_LOG(logDEBUG) << "Channel = " << value;
jboolean returnValue = HAL_CheckAnalogOutputChannel(value); jboolean returnValue = HAL_CheckAnalogOutputChannel(value);
// ANALOGJNI_LOG(logDEBUG) << "checkAnalogChannelResult = " << // ANALOGJNI_LOG(logDEBUG) << "checkAnalogChannelResult = " <<
@@ -142,8 +150,10 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_checkAnalogOutputChannel(
* Method: setAnalogOutput * Method: setAnalogOutput
* Signature: (ID)V * Signature: (ID)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogOutput( JNIEXPORT void JNICALL
JNIEnv *env, jclass, jint id, jdouble voltage) { Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogOutput
(JNIEnv* env, jclass, jint id, jdouble voltage)
{
ANALOGJNI_LOG(logDEBUG) << "Calling setAnalogOutput"; ANALOGJNI_LOG(logDEBUG) << "Calling setAnalogOutput";
ANALOGJNI_LOG(logDEBUG) << "Voltage = " << voltage; ANALOGJNI_LOG(logDEBUG) << "Voltage = " << voltage;
ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << id; ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << id;
@@ -158,8 +168,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogOutput(
* Signature: (I)D * Signature: (I)D
*/ */
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogOutput( Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogOutput
JNIEnv *env, jclass, jint id) { (JNIEnv* env, jclass, jint id)
{
int32_t status = 0; int32_t status = 0;
double val = HAL_GetAnalogOutput((HAL_AnalogOutputHandle)id, &status); double val = HAL_GetAnalogOutput((HAL_AnalogOutputHandle)id, &status);
CheckStatus(env, status); CheckStatus(env, status);
@@ -172,8 +183,9 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogOutput(
* Signature: (D)V * Signature: (D)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogSampleRate( Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogSampleRate
JNIEnv *env, jclass, jdouble value) { (JNIEnv* env, jclass, jdouble value)
{
ANALOGJNI_LOG(logDEBUG) << "SampleRate = " << value; ANALOGJNI_LOG(logDEBUG) << "SampleRate = " << value;
int32_t status = 0; int32_t status = 0;
HAL_SetAnalogSampleRate(value, &status); HAL_SetAnalogSampleRate(value, &status);
@@ -187,8 +199,9 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogSampleRate(
* Signature: ()D * Signature: ()D
*/ */
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogSampleRate( Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogSampleRate
JNIEnv *env, jclass) { (JNIEnv* env, jclass)
{
int32_t status = 0; int32_t status = 0;
double returnValue = HAL_GetAnalogSampleRate(&status); double returnValue = HAL_GetAnalogSampleRate(&status);
ANALOGJNI_LOG(logDEBUG) << "Status = " << status; ANALOGJNI_LOG(logDEBUG) << "Status = " << status;
@@ -203,8 +216,9 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogSampleRate(
* Signature: (II)V * Signature: (II)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogAverageBits( Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogAverageBits
JNIEnv *env, jclass, jint id, jint value) { (JNIEnv* env, jclass, jint id, jint value)
{
ANALOGJNI_LOG(logDEBUG) << "AverageBits = " << value; ANALOGJNI_LOG(logDEBUG) << "AverageBits = " << value;
ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id; ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id;
int32_t status = 0; int32_t status = 0;
@@ -219,11 +233,13 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogAverageBits(
* Signature: (I)I * Signature: (I)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogAverageBits( Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogAverageBits
JNIEnv *env, jclass, jint id) { (JNIEnv* env, jclass, jint id)
{
ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id; ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id;
int32_t status = 0; int32_t status = 0;
jint returnValue = HAL_GetAnalogAverageBits((HAL_AnalogInputHandle)id, &status); jint returnValue =
HAL_GetAnalogAverageBits((HAL_AnalogInputHandle)id, &status);
ANALOGJNI_LOG(logDEBUG) << "Status = " << status; ANALOGJNI_LOG(logDEBUG) << "Status = " << status;
ANALOGJNI_LOG(logDEBUG) << "AverageBits = " << returnValue; ANALOGJNI_LOG(logDEBUG) << "AverageBits = " << returnValue;
CheckStatus(env, status); CheckStatus(env, status);
@@ -236,8 +252,9 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogAverageBits(
* Signature: (II)V * Signature: (II)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogOversampleBits( Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogOversampleBits
JNIEnv *env, jclass, jint id, jint value) { (JNIEnv* env, jclass, jint id, jint value)
{
ANALOGJNI_LOG(logDEBUG) << "OversampleBits = " << value; ANALOGJNI_LOG(logDEBUG) << "OversampleBits = " << value;
ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id; ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id;
int32_t status = 0; int32_t status = 0;
@@ -252,11 +269,13 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogOversampleBits(
* Signature: (I)I * Signature: (I)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogOversampleBits( Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogOversampleBits
JNIEnv *env, jclass, jint id) { (JNIEnv* env, jclass, jint id)
{
ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id; ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id;
int32_t status = 0; int32_t status = 0;
jint returnValue = HAL_GetAnalogOversampleBits((HAL_AnalogInputHandle)id, &status); jint returnValue =
HAL_GetAnalogOversampleBits((HAL_AnalogInputHandle)id, &status);
ANALOGJNI_LOG(logDEBUG) << "Status = " << status; ANALOGJNI_LOG(logDEBUG) << "Status = " << status;
ANALOGJNI_LOG(logDEBUG) << "OversampleBits = " << returnValue; ANALOGJNI_LOG(logDEBUG) << "OversampleBits = " << returnValue;
CheckStatus(env, status); CheckStatus(env, status);
@@ -269,8 +288,9 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogOversampleBits(
* Signature: (I)S * Signature: (I)S
*/ */
JNIEXPORT jshort JNICALL JNIEXPORT jshort JNICALL
Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogValue( Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogValue
JNIEnv *env, jclass, jint id) { (JNIEnv* env, jclass, jint id)
{
// ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (void*)id; // ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (void*)id;
int32_t status = 0; int32_t status = 0;
jshort returnValue = HAL_GetAnalogValue((HAL_AnalogInputHandle)id, &status); jshort returnValue = HAL_GetAnalogValue((HAL_AnalogInputHandle)id, &status);
@@ -286,11 +306,13 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogValue(
* Signature: (I)I * Signature: (I)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogAverageValue( Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogAverageValue
JNIEnv *env, jclass, jint id) { (JNIEnv* env, jclass, jint id)
{
ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id; ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id;
int32_t status = 0; int32_t status = 0;
jint returnValue = HAL_GetAnalogAverageValue((HAL_AnalogInputHandle)id, &status); jint returnValue =
HAL_GetAnalogAverageValue((HAL_AnalogInputHandle)id, &status);
ANALOGJNI_LOG(logDEBUG) << "Status = " << status; ANALOGJNI_LOG(logDEBUG) << "Status = " << status;
ANALOGJNI_LOG(logDEBUG) << "AverageValue = " << returnValue; ANALOGJNI_LOG(logDEBUG) << "AverageValue = " << returnValue;
CheckStatus(env, status); CheckStatus(env, status);
@@ -303,12 +325,14 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogAverageValue(
* Signature: (ID)I * Signature: (ID)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogVoltsToValue( Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogVoltsToValue
JNIEnv *env, jclass, jint id, jdouble voltageValue) { (JNIEnv* env, jclass, jint id, jdouble voltageValue)
{
ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id; ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id;
ANALOGJNI_LOG(logDEBUG) << "VoltageValue = " << voltageValue; ANALOGJNI_LOG(logDEBUG) << "VoltageValue = " << voltageValue;
int32_t status = 0; int32_t status = 0;
jint returnValue = HAL_GetAnalogVoltsToValue((HAL_AnalogInputHandle)id, voltageValue, &status); jint returnValue = HAL_GetAnalogVoltsToValue((HAL_AnalogInputHandle)id,
voltageValue, &status);
ANALOGJNI_LOG(logDEBUG) << "Status = " << status; ANALOGJNI_LOG(logDEBUG) << "Status = " << status;
ANALOGJNI_LOG(logDEBUG) << "Value = " << returnValue; ANALOGJNI_LOG(logDEBUG) << "Value = " << returnValue;
CheckStatus(env, status); CheckStatus(env, status);
@@ -321,11 +345,13 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogVoltsToValue(
* Signature: (I)D * Signature: (I)D
*/ */
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogVoltage( Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogVoltage
JNIEnv *env, jclass, jint id) { (JNIEnv* env, jclass, jint id)
{
// ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (void*)id; // ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (void*)id;
int32_t status = 0; int32_t status = 0;
jdouble returnValue = HAL_GetAnalogVoltage((HAL_AnalogInputHandle)id, &status); jdouble returnValue =
HAL_GetAnalogVoltage((HAL_AnalogInputHandle)id, &status);
// ANALOGJNI_LOG(logDEBUG) << "Status = " << status; // ANALOGJNI_LOG(logDEBUG) << "Status = " << status;
// ANALOGJNI_LOG(logDEBUG) << "Voltage = " << returnValue; // ANALOGJNI_LOG(logDEBUG) << "Voltage = " << returnValue;
CheckStatus(env, status); CheckStatus(env, status);
@@ -338,11 +364,13 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogVoltage(
* Signature: (I)D * Signature: (I)D
*/ */
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogAverageVoltage( Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogAverageVoltage
JNIEnv *env, jclass, jint id) { (JNIEnv* env, jclass, jint id)
{
ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id; ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id;
int32_t status = 0; int32_t status = 0;
jdouble returnValue = HAL_GetAnalogAverageVoltage((HAL_AnalogInputHandle)id, &status); jdouble returnValue =
HAL_GetAnalogAverageVoltage((HAL_AnalogInputHandle)id, &status);
ANALOGJNI_LOG(logDEBUG) << "Status = " << status; ANALOGJNI_LOG(logDEBUG) << "Status = " << status;
ANALOGJNI_LOG(logDEBUG) << "AverageVoltage = " << returnValue; ANALOGJNI_LOG(logDEBUG) << "AverageVoltage = " << returnValue;
CheckStatus(env, status); CheckStatus(env, status);
@@ -355,8 +383,9 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogAverageVoltage(
* Signature: (I)I * Signature: (I)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogLSBWeight( Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogLSBWeight
JNIEnv *env, jclass, jint id) { (JNIEnv* env, jclass, jint id)
{
ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id; ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id;
int32_t status = 0; int32_t status = 0;
@@ -372,8 +401,10 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogLSBWeight(
* Method: getAnalogOffset * Method: getAnalogOffset
* Signature: (I)I * Signature: (I)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogOffset( JNIEXPORT jint JNICALL
JNIEnv *env, jclass, jint id) { Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogOffset
(JNIEnv* env, jclass, jint id)
{
ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id; ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id;
int32_t status = 0; int32_t status = 0;
@@ -390,13 +421,15 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogOffset(
* Signature: (I)Z * Signature: (I)Z
*/ */
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_AnalogJNI_isAccumulatorChannel( Java_edu_wpi_first_wpilibj_hal_AnalogJNI_isAccumulatorChannel
JNIEnv *env, jclass, jint id) { (JNIEnv* env, jclass, jint id)
{
ANALOGJNI_LOG(logDEBUG) << "isAccumulatorChannel"; ANALOGJNI_LOG(logDEBUG) << "isAccumulatorChannel";
ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id; ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id;
int32_t status = 0; int32_t status = 0;
jboolean returnValue = HAL_IsAccumulatorChannel((HAL_AnalogInputHandle)id, &status); jboolean returnValue =
HAL_IsAccumulatorChannel((HAL_AnalogInputHandle)id, &status);
ANALOGJNI_LOG(logDEBUG) << "Status = " << status; ANALOGJNI_LOG(logDEBUG) << "Status = " << status;
ANALOGJNI_LOG(logDEBUG) << "AnalogOffset = " << returnValue; ANALOGJNI_LOG(logDEBUG) << "AnalogOffset = " << returnValue;
CheckStatus(env, status); CheckStatus(env, status);
@@ -408,8 +441,10 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_isAccumulatorChannel(
* Method: initAccumulator * Method: initAccumulator
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_initAccumulator( JNIEXPORT void JNICALL
JNIEnv *env, jclass, jint id) { Java_edu_wpi_first_wpilibj_hal_AnalogJNI_initAccumulator
(JNIEnv* env, jclass, jint id)
{
ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id; ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id;
int32_t status = 0; int32_t status = 0;
HAL_InitAccumulator((HAL_AnalogInputHandle)id, &status); HAL_InitAccumulator((HAL_AnalogInputHandle)id, &status);
@@ -423,8 +458,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_initAccumulator(
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_AnalogJNI_resetAccumulator( Java_edu_wpi_first_wpilibj_hal_AnalogJNI_resetAccumulator
JNIEnv *env, jclass, jint id) { (JNIEnv* env, jclass, jint id)
{
ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id; ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id;
int32_t status = 0; int32_t status = 0;
HAL_ResetAccumulator((HAL_AnalogInputHandle)id, &status); HAL_ResetAccumulator((HAL_AnalogInputHandle)id, &status);
@@ -438,8 +474,9 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_resetAccumulator(
* Signature: (II)V * Signature: (II)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAccumulatorCenter( Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAccumulatorCenter
JNIEnv *env, jclass, jint id, jint center) { (JNIEnv* env, jclass, jint id, jint center)
{
ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id; ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id;
int32_t status = 0; int32_t status = 0;
HAL_SetAccumulatorCenter((HAL_AnalogInputHandle)id, center, &status); HAL_SetAccumulatorCenter((HAL_AnalogInputHandle)id, center, &status);
@@ -453,8 +490,9 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAccumulatorCenter(
* Signature: (II)V * Signature: (II)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAccumulatorDeadband( Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAccumulatorDeadband
JNIEnv *env, jclass, jint id, jint deadband) { (JNIEnv* env, jclass, jint id, jint deadband)
{
ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id; ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id;
int32_t status = 0; int32_t status = 0;
HAL_SetAccumulatorDeadband((HAL_AnalogInputHandle)id, deadband, &status); HAL_SetAccumulatorDeadband((HAL_AnalogInputHandle)id, deadband, &status);
@@ -468,11 +506,13 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAccumulatorDeadband(
* Signature: (I)J * Signature: (I)J
*/ */
JNIEXPORT jlong JNICALL JNIEXPORT jlong JNICALL
Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAccumulatorValue( Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAccumulatorValue
JNIEnv *env, jclass, jint id) { (JNIEnv* env, jclass, jint id)
{
ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id; ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id;
int32_t status = 0; int32_t status = 0;
jlong returnValue = HAL_GetAccumulatorValue((HAL_AnalogInputHandle)id, &status); jlong returnValue =
HAL_GetAccumulatorValue((HAL_AnalogInputHandle)id, &status);
ANALOGJNI_LOG(logDEBUG) << "Status = " << status; ANALOGJNI_LOG(logDEBUG) << "Status = " << status;
ANALOGJNI_LOG(logDEBUG) << "AccumulatorValue = " << returnValue; ANALOGJNI_LOG(logDEBUG) << "AccumulatorValue = " << returnValue;
CheckStatus(env, status); CheckStatus(env, status);
@@ -486,11 +526,13 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAccumulatorValue(
* Signature: (I)I * Signature: (I)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAccumulatorCount( Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAccumulatorCount
JNIEnv *env, jclass, jint id) { (JNIEnv* env, jclass, jint id)
{
ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id; ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id;
int32_t status = 0; int32_t status = 0;
jint returnValue = HAL_GetAccumulatorCount((HAL_AnalogInputHandle)id, &status); jint returnValue =
HAL_GetAccumulatorCount((HAL_AnalogInputHandle)id, &status);
ANALOGJNI_LOG(logDEBUG) << "Status = " << status; ANALOGJNI_LOG(logDEBUG) << "Status = " << status;
ANALOGJNI_LOG(logDEBUG) << "AccumulatorCount = " << returnValue; ANALOGJNI_LOG(logDEBUG) << "AccumulatorCount = " << returnValue;
CheckStatus(env, status); CheckStatus(env, status);
@@ -500,11 +542,12 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAccumulatorCount(
/* /*
* Class: edu_wpi_first_wpilibj_hal_AnalogJNI * Class: edu_wpi_first_wpilibj_hal_AnalogJNI
* Method: getAccumulatorOutput * Method: getAccumulatorOutput
* Signature: (ILedu/wpi/first/wpilibj/AccumulatorResult;)V * Signature: (ILjava/lang/Object;)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAccumulatorOutput( Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAccumulatorOutput
JNIEnv *env, jclass, jint id, jobject accumulatorResult) { (JNIEnv* env, jclass, jint id, jobject accumulatorResult)
{
ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id; ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id;
int32_t status = 0; int32_t status = 0;
int64_t value = 0; int64_t value = 0;
@@ -520,17 +563,20 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAccumulatorOutput(
/* /*
* Class: edu_wpi_first_wpilibj_hal_AnalogJNI * Class: edu_wpi_first_wpilibj_hal_AnalogJNI
* Method: initializeAnalogTrigger * Method: initializeAnalogTrigger
* Signature: (ILjava/nio/IntBuffer;)J * Signature: (ILjava/lang/Object;)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_AnalogJNI_initializeAnalogTrigger( Java_edu_wpi_first_wpilibj_hal_AnalogJNI_initializeAnalogTrigger
JNIEnv *env, jclass, jint id, jobject index) { (JNIEnv* env, jclass, jint id, jobject index)
{
ANALOGJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_AnalogInputHandle)id; ANALOGJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_AnalogInputHandle)id;
jint *indexHandle = (jint *)env->GetDirectBufferAddress(index); jint* indexHandle =
reinterpret_cast<jint*>(env->GetDirectBufferAddress(index));
ANALOGJNI_LOG(logDEBUG) << "Index Ptr = " << indexHandle; ANALOGJNI_LOG(logDEBUG) << "Index Ptr = " << indexHandle;
int32_t status = 0; int32_t status = 0;
HAL_AnalogTriggerHandle analogTrigger = HAL_AnalogTriggerHandle analogTrigger = HAL_InitializeAnalogTrigger(
HAL_InitializeAnalogTrigger((HAL_AnalogInputHandle)id, (int32_t *)indexHandle, &status); (HAL_AnalogInputHandle)id, reinterpret_cast<int32_t*>(indexHandle),
&status);
ANALOGJNI_LOG(logDEBUG) << "Status = " << status; ANALOGJNI_LOG(logDEBUG) << "Status = " << status;
ANALOGJNI_LOG(logDEBUG) << "AnalogTrigger Handle = " << analogTrigger; ANALOGJNI_LOG(logDEBUG) << "AnalogTrigger Handle = " << analogTrigger;
CheckStatus(env, status); CheckStatus(env, status);
@@ -543,9 +589,11 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_initializeAnalogTrigger(
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_AnalogJNI_cleanAnalogTrigger( Java_edu_wpi_first_wpilibj_hal_AnalogJNI_cleanAnalogTrigger
JNIEnv *env, jclass,jint id) { (JNIEnv* env, jclass, jint id)
ANALOGJNI_LOG(logDEBUG) << "Analog Trigger Handle = " << (HAL_AnalogTriggerHandle)id; {
ANALOGJNI_LOG(logDEBUG) << "Analog Trigger Handle = "
<< (HAL_AnalogTriggerHandle)id;
int32_t status = 0; int32_t status = 0;
HAL_CleanAnalogTrigger((HAL_AnalogTriggerHandle)id, &status); HAL_CleanAnalogTrigger((HAL_AnalogTriggerHandle)id, &status);
CheckStatus(env, status); CheckStatus(env, status);
@@ -557,11 +605,14 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_cleanAnalogTrigger(
* Signature: (III)V * Signature: (III)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogTriggerLimitsRaw( Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogTriggerLimitsRaw
JNIEnv *env, jclass,jint id, jint lower, jint upper) { (JNIEnv* env, jclass, jint id, jint lower, jint upper)
ANALOGJNI_LOG(logDEBUG) << "Analog Trigger Handle = " << (HAL_AnalogTriggerHandle)id; {
ANALOGJNI_LOG(logDEBUG) << "Analog Trigger Handle = "
<< (HAL_AnalogTriggerHandle)id;
int32_t status = 0; int32_t status = 0;
HAL_SetAnalogTriggerLimitsRaw((HAL_AnalogTriggerHandle)id, lower, upper, &status); HAL_SetAnalogTriggerLimitsRaw((HAL_AnalogTriggerHandle)id, lower, upper,
&status);
CheckStatus(env, status); CheckStatus(env, status);
} }
@@ -571,11 +622,14 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogTriggerLimitsRaw(
* Signature: (IDD)V * Signature: (IDD)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogTriggerLimitsVoltage( Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogTriggerLimitsVoltage
JNIEnv *env, jclass,jint id, jdouble lower, jdouble upper) { (JNIEnv* env, jclass, jint id, jdouble lower, jdouble upper)
ANALOGJNI_LOG(logDEBUG) << "Analog Trigger Handle = " << (HAL_AnalogTriggerHandle)id; {
ANALOGJNI_LOG(logDEBUG) << "Analog Trigger Handle = "
<< (HAL_AnalogTriggerHandle)id;
int32_t status = 0; int32_t status = 0;
HAL_SetAnalogTriggerLimitsVoltage((HAL_AnalogTriggerHandle)id, lower, upper, &status); HAL_SetAnalogTriggerLimitsVoltage((HAL_AnalogTriggerHandle)id, lower, upper,
&status);
CheckStatus(env, status); CheckStatus(env, status);
} }
@@ -585,9 +639,11 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogTriggerLimitsVoltage(
* Signature: (IZ)V * Signature: (IZ)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogTriggerAveraged( Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogTriggerAveraged
JNIEnv *env, jclass,jint id, jboolean averaged) { (JNIEnv* env, jclass, jint id, jboolean averaged)
ANALOGJNI_LOG(logDEBUG) << "Analog Trigger Handle = " << (HAL_AnalogTriggerHandle)id; {
ANALOGJNI_LOG(logDEBUG) << "Analog Trigger Handle = "
<< (HAL_AnalogTriggerHandle)id;
int32_t status = 0; int32_t status = 0;
HAL_SetAnalogTriggerAveraged((HAL_AnalogTriggerHandle)id, averaged, &status); HAL_SetAnalogTriggerAveraged((HAL_AnalogTriggerHandle)id, averaged, &status);
CheckStatus(env, status); CheckStatus(env, status);
@@ -599,9 +655,11 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogTriggerAveraged(
* Signature: (IZ)V * Signature: (IZ)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogTriggerFiltered( Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogTriggerFiltered
JNIEnv *env, jclass,jint id, jboolean filtered) { (JNIEnv* env, jclass, jint id, jboolean filtered)
ANALOGJNI_LOG(logDEBUG) << "Analog Trigger Handle = " << (HAL_AnalogTriggerHandle)id; {
ANALOGJNI_LOG(logDEBUG) << "Analog Trigger Handle = "
<< (HAL_AnalogTriggerHandle)id;
int32_t status = 0; int32_t status = 0;
HAL_SetAnalogTriggerFiltered((HAL_AnalogTriggerHandle)id, filtered, &status); HAL_SetAnalogTriggerFiltered((HAL_AnalogTriggerHandle)id, filtered, &status);
CheckStatus(env, status); CheckStatus(env, status);
@@ -613,11 +671,14 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogTriggerFiltered(
* Signature: (I)Z * Signature: (I)Z
*/ */
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogTriggerInWindow( Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogTriggerInWindow
JNIEnv *env, jclass,jint id) { (JNIEnv* env, jclass, jint id)
ANALOGJNI_LOG(logDEBUG) << "Analog Trigger Handle = " << (HAL_AnalogTriggerHandle)id; {
ANALOGJNI_LOG(logDEBUG) << "Analog Trigger Handle = "
<< (HAL_AnalogTriggerHandle)id;
int32_t status = 0; int32_t status = 0;
jboolean val = HAL_GetAnalogTriggerInWindow((HAL_AnalogTriggerHandle)id, &status); jboolean val =
HAL_GetAnalogTriggerInWindow((HAL_AnalogTriggerHandle)id, &status);
CheckStatus(env, status); CheckStatus(env, status);
return val; return val;
} }
@@ -628,11 +689,14 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogTriggerInWindow(
* Signature: (I)Z * Signature: (I)Z
*/ */
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogTriggerTriggerState( Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogTriggerTriggerState
JNIEnv *env, jclass,jint id) { (JNIEnv* env, jclass, jint id)
ANALOGJNI_LOG(logDEBUG) << "Analog Trigger Handle = " << (HAL_AnalogTriggerHandle)id; {
ANALOGJNI_LOG(logDEBUG) << "Analog Trigger Handle = "
<< (HAL_AnalogTriggerHandle)id;
int32_t status = 0; int32_t status = 0;
jboolean val = HAL_GetAnalogTriggerTriggerState((HAL_AnalogTriggerHandle)id, &status); jboolean val =
HAL_GetAnalogTriggerTriggerState((HAL_AnalogTriggerHandle)id, &status);
CheckStatus(env, status); CheckStatus(env, status);
return val; return val;
} }
@@ -643,12 +707,14 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogTriggerTriggerState(
* Signature: (II)Z * Signature: (II)Z
*/ */
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogTriggerOutput( Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogTriggerOutput
JNIEnv *env, jclass,jint id, jint type) { (JNIEnv* env, jclass, jint id, jint type)
ANALOGJNI_LOG(logDEBUG) << "Analog Trigger Handle = " << (HAL_AnalogTriggerHandle)id; {
ANALOGJNI_LOG(logDEBUG) << "Analog Trigger Handle = "
<< (HAL_AnalogTriggerHandle)id;
int32_t status = 0; int32_t status = 0;
jboolean val = jboolean val = HAL_GetAnalogTriggerOutput(
HAL_GetAnalogTriggerOutput((HAL_AnalogTriggerHandle)id, (HAL_AnalogTriggerType)type, &status); (HAL_AnalogTriggerHandle)id, (HAL_AnalogTriggerType)type, &status);
CheckStatus(env, status); CheckStatus(env, status);
return val; return val;
} }

View File

@@ -1,20 +1,22 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */ /* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
#include <assert.h>
#include <jni.h> #include <jni.h>
#include "HAL/cpp/Log.h" #include <cassert>
#include <wpi/SmallString.h>
#include <wpi/jni_util.h>
#include <wpi/raw_ostream.h>
#include "HAL/CAN.h" #include "HAL/CAN.h"
#include "HAL/cpp/Log.h"
#include "HALUtil.h" #include "HALUtil.h"
#include "edu_wpi_first_wpilibj_can_CANJNI.h" #include "edu_wpi_first_wpilibj_can_CANJNI.h"
#include "wpi/SmallString.h"
#include "wpi/jni_util.h"
#include "wpi/raw_ostream.h"
using namespace frc; using namespace frc;
using namespace wpi::java; using namespace wpi::java;
@@ -27,7 +29,7 @@ TLogLevel canJNILogLevel = logERROR;
if (level > canJNILogLevel) \ if (level > canJNILogLevel) \
; \ ; \
else \ else \
Log().Get(level) Log().Get(level)
extern "C" { extern "C" {
@@ -37,15 +39,15 @@ extern "C" {
* Signature: (I[BI)V * Signature: (I[BI)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_can_CANJNI_FRCNetCommCANSessionMuxSendMessage( Java_edu_wpi_first_wpilibj_can_CANJNI_FRCNetCommCANSessionMuxSendMessage
JNIEnv *env, jclass, jint messageID, jbyteArray data, jint periodMs) { (JNIEnv* env, jclass, jint messageID, jbyteArray data, jint periodMs)
{
CANJNI_LOG(logDEBUG) CANJNI_LOG(logDEBUG) << "Calling CANJNI FRCNetCommCANSessionMuxSendMessage";
<< "Calling CANJNI FRCNetCommCANSessionMuxSendMessage";
JByteArrayRef dataArray{env, data}; JByteArrayRef dataArray{env, data};
const uint8_t *dataBuffer = reinterpret_cast<const uint8_t*>(dataArray.array().data()); const uint8_t* dataBuffer =
reinterpret_cast<const uint8_t*>(dataArray.array().data());
uint8_t dataSize = dataArray.array().size(); uint8_t dataSize = dataArray.array().size();
CANJNI_LOG(logDEBUG) << "Message ID "; CANJNI_LOG(logDEBUG) << "Message ID ";
@@ -68,8 +70,7 @@ Java_edu_wpi_first_wpilibj_can_CANJNI_FRCNetCommCANSessionMuxSendMessage(
CANJNI_LOG(logDEBUG) << "Period: " << periodMs; CANJNI_LOG(logDEBUG) << "Period: " << periodMs;
int32_t status = 0; int32_t status = 0;
HAL_CAN_SendMessage( HAL_CAN_SendMessage(messageID, dataBuffer, dataSize, periodMs, &status);
messageID, dataBuffer, dataSize, periodMs, &status);
CANJNI_LOG(logDEBUG) << "Status: " << status; CANJNI_LOG(logDEBUG) << "Status: " << status;
CheckCANStatus(env, status, messageID); CheckCANStatus(env, status, messageID);
@@ -78,25 +79,27 @@ Java_edu_wpi_first_wpilibj_can_CANJNI_FRCNetCommCANSessionMuxSendMessage(
/* /*
* Class: edu_wpi_first_wpilibj_can_CANJNI * Class: edu_wpi_first_wpilibj_can_CANJNI
* Method: FRCNetCommCANSessionMuxReceiveMessage * Method: FRCNetCommCANSessionMuxReceiveMessage
* Signature: (Ljava/nio/IntBuffer;ILjava/nio/ByteBuffer;)[B * Signature: (Ljava/lang/Object;ILjava/lang/Object;)[B
*/ */
JNIEXPORT jbyteArray JNICALL JNIEXPORT jbyteArray JNICALL
Java_edu_wpi_first_wpilibj_can_CANJNI_FRCNetCommCANSessionMuxReceiveMessage( Java_edu_wpi_first_wpilibj_can_CANJNI_FRCNetCommCANSessionMuxReceiveMessage
JNIEnv *env, jclass, jobject messageID, jint messageIDMask, (JNIEnv* env, jclass, jobject messageID, jint messageIDMask,
jobject timeStamp) { jobject timeStamp)
{
CANJNI_LOG(logDEBUG) CANJNI_LOG(logDEBUG)
<< "Calling CANJNI FRCNetCommCANSessionMuxReceiveMessage"; << "Calling CANJNI FRCNetCommCANSessionMuxReceiveMessage";
uint32_t *messageIDPtr = (uint32_t *)env->GetDirectBufferAddress(messageID); uint32_t* messageIDPtr =
uint32_t *timeStampPtr = (uint32_t *)env->GetDirectBufferAddress(timeStamp); reinterpret_cast<uint32_t*>(env->GetDirectBufferAddress(messageID));
uint32_t* timeStampPtr =
reinterpret_cast<uint32_t*>(env->GetDirectBufferAddress(timeStamp));
uint8_t dataSize = 0; uint8_t dataSize = 0;
uint8_t buffer[8]; uint8_t buffer[8];
int32_t status = 0; int32_t status = 0;
HAL_CAN_ReceiveMessage( HAL_CAN_ReceiveMessage(messageIDPtr, messageIDMask, buffer, &dataSize,
messageIDPtr, messageIDMask, buffer, &dataSize, timeStampPtr, &status); timeStampPtr, &status);
CANJNI_LOG(logDEBUG) << "Message ID "; CANJNI_LOG(logDEBUG) << "Message ID ";
CANJNI_LOG(logDEBUG).write_hex(*messageIDPtr); CANJNI_LOG(logDEBUG).write_hex(*messageIDPtr);
@@ -121,19 +124,21 @@ Java_edu_wpi_first_wpilibj_can_CANJNI_FRCNetCommCANSessionMuxReceiveMessage(
CANJNI_LOG(logDEBUG) << "Status: " << status; CANJNI_LOG(logDEBUG) << "Status: " << status;
if (!CheckCANStatus(env, status, *messageIDPtr)) return nullptr; if (!CheckCANStatus(env, status, *messageIDPtr)) return nullptr;
return MakeJByteArray(env, wpi::StringRef{reinterpret_cast<const char*>(buffer), return MakeJByteArray(env,
static_cast<size_t>(dataSize)}); wpi::StringRef{reinterpret_cast<const char*>(buffer),
static_cast<size_t>(dataSize)});
} }
/* /*
* Class: edu_wpi_first_wpilibj_can_CANJNI * Class: edu_wpi_first_wpilibj_can_CANJNI
* Method: GetCANStatus * Method: GetCANStatus
* Signature: (Ledu/wpi/first/wpilibj/can/CANStatus;)V * Signature: (Ljava/lang/Object;)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_can_CANJNI_GetCANStatus JNIEXPORT void JNICALL
(JNIEnv *env, jclass, jobject canStatus) { Java_edu_wpi_first_wpilibj_can_CANJNI_GetCANStatus
CANJNI_LOG(logDEBUG) (JNIEnv* env, jclass, jobject canStatus)
<< "Calling CANJNI HAL_CAN_GetCANStatus"; {
CANJNI_LOG(logDEBUG) << "Calling CANJNI HAL_CAN_GetCANStatus";
float percentBusUtilization = 0; float percentBusUtilization = 0;
uint32_t busOffCount = 0; uint32_t busOffCount = 0;
@@ -143,7 +148,7 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_can_CANJNI_GetCANStatus
int32_t status = 0; int32_t status = 0;
HAL_CAN_GetCANStatus(&percentBusUtilization, &busOffCount, &txFullCount, HAL_CAN_GetCANStatus(&percentBusUtilization, &busOffCount, &txFullCount,
&receiveErrorCount, &transmitErrorCount, &status); &receiveErrorCount, &transmitErrorCount, &status);
if (!CheckStatus(env, status)) return; if (!CheckStatus(env, status)) return;
SetCanStatusObject(env, canStatus, percentBusUtilization, busOffCount, SetCanStatusObject(env, canStatus, percentBusUtilization, busOffCount,

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */ /* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */
@@ -8,8 +8,8 @@
#include "HAL/Compressor.h" #include "HAL/Compressor.h"
#include "HAL/Ports.h" #include "HAL/Ports.h"
#include "HAL/Solenoid.h" #include "HAL/Solenoid.h"
#include "HALUtil.h"
#include "HAL/cpp/Log.h" #include "HAL/cpp/Log.h"
#include "HALUtil.h"
#include "edu_wpi_first_wpilibj_hal_CompressorJNI.h" #include "edu_wpi_first_wpilibj_hal_CompressorJNI.h"
using namespace frc; using namespace frc;
@@ -22,12 +22,13 @@ extern "C" {
* Signature: (B)I * Signature: (B)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_initializeCompressor( Java_edu_wpi_first_wpilibj_hal_CompressorJNI_initializeCompressor
JNIEnv *env, jclass, jbyte module) { (JNIEnv* env, jclass, jbyte module)
{
int32_t status = 0; int32_t status = 0;
auto handle = HAL_InitializeCompressor(module, &status); auto handle = HAL_InitializeCompressor(module, &status);
CheckStatusRange(env, status, 0, HAL_GetNumPCMModules(), module); CheckStatusRange(env, status, 0, HAL_GetNumPCMModules(), module);
return (jint)handle; return (jint)handle;
} }
@@ -37,19 +38,21 @@ Java_edu_wpi_first_wpilibj_hal_CompressorJNI_initializeCompressor(
* Signature: (B)Z * Signature: (B)Z
*/ */
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_checkCompressorModule( Java_edu_wpi_first_wpilibj_hal_CompressorJNI_checkCompressorModule
JNIEnv *env, jclass, jbyte module) { (JNIEnv* env, jclass, jbyte module)
{
return HAL_CheckCompressorModule(module); return HAL_CheckCompressorModule(module);
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI * Class: edu_wpi_first_wpilibj_hal_CompressorJNI
* Method: getCompressor * Method: getCompressor
* Signature: (J)Z * Signature: (I)Z
*/ */
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressor( Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressor
JNIEnv *env, jclass, jint compressorHandle) { (JNIEnv* env, jclass, jint compressorHandle)
{
int32_t status = 0; int32_t status = 0;
bool val = HAL_GetCompressor((HAL_CompressorHandle)compressorHandle, &status); bool val = HAL_GetCompressor((HAL_CompressorHandle)compressorHandle, &status);
CheckStatus(env, status); CheckStatus(env, status);
@@ -59,26 +62,30 @@ Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressor(
/* /*
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI * Class: edu_wpi_first_wpilibj_hal_CompressorJNI
* Method: setCompressorClosedLoopControl * Method: setCompressorClosedLoopControl
* Signature: (JZ)V * Signature: (IZ)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_setCompressorClosedLoopControl( Java_edu_wpi_first_wpilibj_hal_CompressorJNI_setCompressorClosedLoopControl
JNIEnv *env, jclass, jint compressorHandle, jboolean value) { (JNIEnv* env, jclass, jint compressorHandle, jboolean value)
{
int32_t status = 0; int32_t status = 0;
HAL_SetCompressorClosedLoopControl((HAL_CompressorHandle)compressorHandle, value, &status); HAL_SetCompressorClosedLoopControl((HAL_CompressorHandle)compressorHandle,
value, &status);
CheckStatus(env, status); CheckStatus(env, status);
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI * Class: edu_wpi_first_wpilibj_hal_CompressorJNI
* Method: getCompressorClosedLoopControl * Method: getCompressorClosedLoopControl
* Signature: (J)Z * Signature: (I)Z
*/ */
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorClosedLoopControl( Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorClosedLoopControl
JNIEnv *env, jclass, jint compressorHandle) { (JNIEnv* env, jclass, jint compressorHandle)
{
int32_t status = 0; int32_t status = 0;
bool val = HAL_GetCompressorClosedLoopControl((HAL_CompressorHandle)compressorHandle, &status); bool val = HAL_GetCompressorClosedLoopControl(
(HAL_CompressorHandle)compressorHandle, &status);
CheckStatus(env, status); CheckStatus(env, status);
return val; return val;
} }
@@ -86,13 +93,15 @@ Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorClosedLoopControl(
/* /*
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI * Class: edu_wpi_first_wpilibj_hal_CompressorJNI
* Method: getCompressorPressureSwitch * Method: getCompressorPressureSwitch
* Signature: (J)Z * Signature: (I)Z
*/ */
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorPressureSwitch( Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorPressureSwitch
JNIEnv *env, jclass, jint compressorHandle) { (JNIEnv* env, jclass, jint compressorHandle)
{
int32_t status = 0; int32_t status = 0;
bool val = HAL_GetCompressorPressureSwitch((HAL_CompressorHandle)compressorHandle, &status); bool val = HAL_GetCompressorPressureSwitch(
(HAL_CompressorHandle)compressorHandle, &status);
CheckStatus(env, status); CheckStatus(env, status);
return val; return val;
} }
@@ -100,13 +109,15 @@ Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorPressureSwitch(
/* /*
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI * Class: edu_wpi_first_wpilibj_hal_CompressorJNI
* Method: getCompressorCurrent * Method: getCompressorCurrent
* Signature: (J)D * Signature: (I)D
*/ */
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorCurrent( Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorCurrent
JNIEnv *env, jclass, jint compressorHandle) { (JNIEnv* env, jclass, jint compressorHandle)
{
int32_t status = 0; int32_t status = 0;
double val = HAL_GetCompressorCurrent((HAL_CompressorHandle)compressorHandle, &status); double val =
HAL_GetCompressorCurrent((HAL_CompressorHandle)compressorHandle, &status);
CheckStatus(env, status); CheckStatus(env, status);
return val; return val;
} }
@@ -114,13 +125,15 @@ Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorCurrent(
/* /*
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI * Class: edu_wpi_first_wpilibj_hal_CompressorJNI
* Method: getCompressorCurrentTooHighFault * Method: getCompressorCurrentTooHighFault
* Signature: (J)Z * Signature: (I)Z
*/ */
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorCurrentTooHighFault( Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorCurrentTooHighFault
JNIEnv *env, jclass, jint compressorHandle) { (JNIEnv* env, jclass, jint compressorHandle)
{
int32_t status = 0; int32_t status = 0;
bool val = HAL_GetCompressorCurrentTooHighFault((HAL_CompressorHandle)compressorHandle, &status); bool val = HAL_GetCompressorCurrentTooHighFault(
(HAL_CompressorHandle)compressorHandle, &status);
CheckStatus(env, status); CheckStatus(env, status);
return val; return val;
} }
@@ -128,14 +141,15 @@ Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorCurrentTooHighFault(
/* /*
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI * Class: edu_wpi_first_wpilibj_hal_CompressorJNI
* Method: getCompressorCurrentTooHighStickyFault * Method: getCompressorCurrentTooHighStickyFault
* Signature: (J)Z * Signature: (I)Z
*/ */
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorCurrentTooHighStickyFault( Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorCurrentTooHighStickyFault
JNIEnv *env, jclass, jint compressorHandle) { (JNIEnv* env, jclass, jint compressorHandle)
{
int32_t status = 0; int32_t status = 0;
bool val = bool val = HAL_GetCompressorCurrentTooHighStickyFault(
HAL_GetCompressorCurrentTooHighStickyFault((HAL_CompressorHandle)compressorHandle, &status); (HAL_CompressorHandle)compressorHandle, &status);
CheckStatus(env, status); CheckStatus(env, status);
return val; return val;
} }
@@ -143,13 +157,15 @@ Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorCurrentTooHighStickyFa
/* /*
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI * Class: edu_wpi_first_wpilibj_hal_CompressorJNI
* Method: getCompressorShortedStickyFault * Method: getCompressorShortedStickyFault
* Signature: (J)Z * Signature: (I)Z
*/ */
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorShortedStickyFault( Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorShortedStickyFault
JNIEnv *env, jclass, jint compressorHandle) { (JNIEnv* env, jclass, jint compressorHandle)
{
int32_t status = 0; int32_t status = 0;
bool val = HAL_GetCompressorShortedStickyFault((HAL_CompressorHandle)compressorHandle, &status); bool val = HAL_GetCompressorShortedStickyFault(
(HAL_CompressorHandle)compressorHandle, &status);
CheckStatus(env, status); CheckStatus(env, status);
return val; return val;
} }
@@ -157,13 +173,15 @@ Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorShortedStickyFault(
/* /*
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI * Class: edu_wpi_first_wpilibj_hal_CompressorJNI
* Method: getCompressorShortedFault * Method: getCompressorShortedFault
* Signature: (J)Z * Signature: (I)Z
*/ */
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorShortedFault( Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorShortedFault
JNIEnv *env, jclass, jint compressorHandle) { (JNIEnv* env, jclass, jint compressorHandle)
{
int32_t status = 0; int32_t status = 0;
bool val = HAL_GetCompressorShortedFault((HAL_CompressorHandle)compressorHandle, &status); bool val = HAL_GetCompressorShortedFault(
(HAL_CompressorHandle)compressorHandle, &status);
CheckStatus(env, status); CheckStatus(env, status);
return val; return val;
} }
@@ -171,13 +189,15 @@ Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorShortedFault(
/* /*
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI * Class: edu_wpi_first_wpilibj_hal_CompressorJNI
* Method: getCompressorNotConnectedStickyFault * Method: getCompressorNotConnectedStickyFault
* Signature: (J)Z * Signature: (I)Z
*/ */
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorNotConnectedStickyFault( Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorNotConnectedStickyFault
JNIEnv *env, jclass, jint compressorHandle) { (JNIEnv* env, jclass, jint compressorHandle)
{
int32_t status = 0; int32_t status = 0;
bool val = HAL_GetCompressorNotConnectedStickyFault((HAL_CompressorHandle)compressorHandle, &status); bool val = HAL_GetCompressorNotConnectedStickyFault(
(HAL_CompressorHandle)compressorHandle, &status);
CheckStatus(env, status); CheckStatus(env, status);
return val; return val;
} }
@@ -185,26 +205,29 @@ Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorNotConnectedStickyFaul
/* /*
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI * Class: edu_wpi_first_wpilibj_hal_CompressorJNI
* Method: getCompressorNotConnectedFault * Method: getCompressorNotConnectedFault
* Signature: (J)Z * Signature: (I)Z
*/ */
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorNotConnectedFault( Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorNotConnectedFault
JNIEnv *env, jclass, jint compressorHandle) { (JNIEnv* env, jclass, jint compressorHandle)
{
int32_t status = 0; int32_t status = 0;
bool val = HAL_GetCompressorNotConnectedFault((HAL_CompressorHandle)compressorHandle, &status); bool val = HAL_GetCompressorNotConnectedFault(
(HAL_CompressorHandle)compressorHandle, &status);
CheckStatus(env, status); CheckStatus(env, status);
return val; return val;
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI * Class: edu_wpi_first_wpilibj_hal_CompressorJNI
* Method: clearAllPCMStickyFaults * Method: clearAllPCMStickyFaults
* Signature: (J)V * Signature: (B)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_clearAllPCMStickyFaults( Java_edu_wpi_first_wpilibj_hal_CompressorJNI_clearAllPCMStickyFaults
JNIEnv *env, jclass, jbyte module) { (JNIEnv* env, jclass, jbyte module)
{
int32_t status = 0; int32_t status = 0;
HAL_ClearAllPCMStickyFaults((uint8_t)module, &status); HAL_ClearAllPCMStickyFaults(static_cast<int32_t>(module), &status);
CheckStatus(env, status); CheckStatus(env, status);
} }

View File

@@ -1,18 +1,18 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */ /* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
#include <assert.h>
#include <jni.h> #include <jni.h>
#include "HAL/cpp/Log.h"
#include "edu_wpi_first_wpilibj_hal_ConstantsJNI.h" #include <cassert>
#include "HAL/Constants.h" #include "HAL/Constants.h"
#include "HAL/cpp/Log.h"
#include "HALUtil.h" #include "HALUtil.h"
#include "edu_wpi_first_wpilibj_hal_ConstantsJNI.h"
using namespace frc; using namespace frc;
@@ -21,9 +21,9 @@ TLogLevel constantsJNILogLevel = logWARNING;
#define CONSTANTSJNI_LOG(level) \ #define CONSTANTSJNI_LOG(level) \
if (level > constantsJNILogLevel) \ if (level > constantsJNILogLevel) \
; \ ; \
else \ else \
Log().Get(level) Log().Get(level)
extern "C" { extern "C" {
/* /*
@@ -32,11 +32,13 @@ extern "C" {
* Signature: ()I * Signature: ()I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_ConstantsJNI_getSystemClockTicksPerMicrosecond( Java_edu_wpi_first_wpilibj_hal_ConstantsJNI_getSystemClockTicksPerMicrosecond
JNIEnv *env, jclass) { (JNIEnv* env, jclass)
CONSTANTSJNI_LOG(logDEBUG) << "Calling ConstantsJNI getSystemClockTicksPerMicrosecond"; {
CONSTANTSJNI_LOG(logDEBUG)
<< "Calling ConstantsJNI getSystemClockTicksPerMicrosecond";
jint value = HAL_GetSystemClockTicksPerMicrosecond(); jint value = HAL_GetSystemClockTicksPerMicrosecond();
CONSTANTSJNI_LOG(logDEBUG) << "Value = " << value; CONSTANTSJNI_LOG(logDEBUG) << "Value = " << value;
return value; return value;
} }
} } // extern "C"

View File

@@ -1,19 +1,19 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */ /* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
#include <assert.h>
#include <jni.h> #include <jni.h>
#include "HAL/cpp/Log.h"
#include "edu_wpi_first_wpilibj_hal_CounterJNI.h" #include <cassert>
#include "HAL/Counter.h" #include "HAL/Counter.h"
#include "HAL/Errors.h" #include "HAL/Errors.h"
#include "HAL/cpp/Log.h"
#include "HALUtil.h" #include "HALUtil.h"
#include "edu_wpi_first_wpilibj_hal_CounterJNI.h"
using namespace frc; using namespace frc;
@@ -24,24 +24,27 @@ TLogLevel counterJNILogLevel = logWARNING;
if (level > counterJNILogLevel) \ if (level > counterJNILogLevel) \
; \ ; \
else \ else \
Log().Get(level) Log().Get(level)
extern "C" { extern "C" {
/* /*
* Class: edu_wpi_first_wpilibj_hal_CounterJNI * Class: edu_wpi_first_wpilibj_hal_CounterJNI
* Method: initializeCounter * Method: initializeCounter
* Signature: (ILjava/nio/IntBuffer;)I * Signature: (ILjava/lang/Object;)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_CounterJNI_initializeCounter( Java_edu_wpi_first_wpilibj_hal_CounterJNI_initializeCounter
JNIEnv* env, jclass, jint mode, jobject index) { (JNIEnv* env, jclass, jint mode, jobject index)
{
COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI initializeCounter"; COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI initializeCounter";
COUNTERJNI_LOG(logDEBUG) << "Mode = " << mode; COUNTERJNI_LOG(logDEBUG) << "Mode = " << mode;
jint* indexPtr = (jint*)env->GetDirectBufferAddress(index); jint* indexPtr = reinterpret_cast<jint*>(env->GetDirectBufferAddress(index));
COUNTERJNI_LOG(logDEBUG) << "Index Ptr = " << (int32_t*)indexPtr; COUNTERJNI_LOG(logDEBUG) << "Index Ptr = "
<< reinterpret_cast<int32_t*>(indexPtr);
int32_t status = 0; int32_t status = 0;
auto counter = HAL_InitializeCounter((HAL_Counter_Mode)mode, (int32_t*)indexPtr, &status); auto counter = HAL_InitializeCounter(
(HAL_Counter_Mode)mode, reinterpret_cast<int32_t*>(indexPtr), &status);
COUNTERJNI_LOG(logDEBUG) << "Index = " << *indexPtr; COUNTERJNI_LOG(logDEBUG) << "Index = " << *indexPtr;
COUNTERJNI_LOG(logDEBUG) << "Status = " << status; COUNTERJNI_LOG(logDEBUG) << "Status = " << status;
COUNTERJNI_LOG(logDEBUG) << "COUNTER Handle = " << counter; COUNTERJNI_LOG(logDEBUG) << "COUNTER Handle = " << counter;
@@ -54,8 +57,10 @@ Java_edu_wpi_first_wpilibj_hal_CounterJNI_initializeCounter(
* Method: freeCounter * Method: freeCounter
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_freeCounter( JNIEXPORT void JNICALL
JNIEnv* env, jclass, jint id) { Java_edu_wpi_first_wpilibj_hal_CounterJNI_freeCounter
(JNIEnv* env, jclass, jint id)
{
COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI freeCounter"; COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI freeCounter";
COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id; COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id;
int32_t status = 0; int32_t status = 0;
@@ -70,8 +75,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_freeCounter(
* Signature: (II)V * Signature: (II)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterAverageSize( Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterAverageSize
JNIEnv* env, jclass, jint id, jint value) { (JNIEnv* env, jclass, jint id, jint value)
{
COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterAverageSize"; COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterAverageSize";
COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id; COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id;
COUNTERJNI_LOG(logDEBUG) << "AverageSize = " << value; COUNTERJNI_LOG(logDEBUG) << "AverageSize = " << value;
@@ -87,16 +93,17 @@ Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterAverageSize(
* Signature: (III)V * Signature: (III)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterUpSource( Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterUpSource
JNIEnv* env, jclass, jint id, jint digitalSourceHandle, (JNIEnv* env, jclass, jint id, jint digitalSourceHandle,
jint analogTriggerType) { jint analogTriggerType)
{
COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterUpSource"; COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterUpSource";
COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id; COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id;
COUNTERJNI_LOG(logDEBUG) << "digitalSourceHandle = " << digitalSourceHandle; COUNTERJNI_LOG(logDEBUG) << "digitalSourceHandle = " << digitalSourceHandle;
COUNTERJNI_LOG(logDEBUG) << "analogTriggerType = " << analogTriggerType; COUNTERJNI_LOG(logDEBUG) << "analogTriggerType = " << analogTriggerType;
int32_t status = 0; int32_t status = 0;
HAL_SetCounterUpSource((HAL_CounterHandle)id, (HAL_Handle)digitalSourceHandle, HAL_SetCounterUpSource((HAL_CounterHandle)id, (HAL_Handle)digitalSourceHandle,
(HAL_AnalogTriggerType)analogTriggerType, &status); (HAL_AnalogTriggerType)analogTriggerType, &status);
COUNTERJNI_LOG(logDEBUG) << "Status = " << status; COUNTERJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status); CheckStatus(env, status);
} }
@@ -107,14 +114,16 @@ Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterUpSource(
* Signature: (IZZ)V * Signature: (IZZ)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterUpSourceEdge( Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterUpSourceEdge
JNIEnv* env, jclass, jint id, jboolean valueRise, jboolean valueFall) { (JNIEnv* env, jclass, jint id, jboolean valueRise, jboolean valueFall)
{
COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterUpSourceEdge"; COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterUpSourceEdge";
COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id; COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id;
COUNTERJNI_LOG(logDEBUG) << "Rise = " << (jint)valueRise; COUNTERJNI_LOG(logDEBUG) << "Rise = " << (jint)valueRise;
COUNTERJNI_LOG(logDEBUG) << "Fall = " << (jint)valueFall; COUNTERJNI_LOG(logDEBUG) << "Fall = " << (jint)valueFall;
int32_t status = 0; int32_t status = 0;
HAL_SetCounterUpSourceEdge((HAL_CounterHandle)id, valueRise, valueFall, &status); HAL_SetCounterUpSourceEdge((HAL_CounterHandle)id, valueRise, valueFall,
&status);
COUNTERJNI_LOG(logDEBUG) << "Status = " << status; COUNTERJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status); CheckStatus(env, status);
} }
@@ -125,8 +134,9 @@ Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterUpSourceEdge(
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_CounterJNI_clearCounterUpSource( Java_edu_wpi_first_wpilibj_hal_CounterJNI_clearCounterUpSource
JNIEnv* env, jclass, jint id) { (JNIEnv* env, jclass, jint id)
{
COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI clearCounterUpSource"; COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI clearCounterUpSource";
COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id; COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id;
int32_t status = 0; int32_t status = 0;
@@ -138,19 +148,21 @@ Java_edu_wpi_first_wpilibj_hal_CounterJNI_clearCounterUpSource(
/* /*
* Class: edu_wpi_first_wpilibj_hal_CounterJNI * Class: edu_wpi_first_wpilibj_hal_CounterJNI
* Method: setCounterDownSource * Method: setCounterDownSource
* Signature: (IIZ)V * Signature: (III)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterDownSource( Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterDownSource
JNIEnv* env, jclass, jint id, jint digitalSourceHandle, (JNIEnv* env, jclass, jint id, jint digitalSourceHandle,
jint analogTriggerType) { jint analogTriggerType)
{
COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterDownSource"; COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterDownSource";
COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id; COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id;
COUNTERJNI_LOG(logDEBUG) << "digitalSourceHandle = " << digitalSourceHandle; COUNTERJNI_LOG(logDEBUG) << "digitalSourceHandle = " << digitalSourceHandle;
COUNTERJNI_LOG(logDEBUG) << "analogTriggerType = " << analogTriggerType; COUNTERJNI_LOG(logDEBUG) << "analogTriggerType = " << analogTriggerType;
int32_t status = 0; int32_t status = 0;
HAL_SetCounterDownSource((HAL_CounterHandle)id, (HAL_Handle)digitalSourceHandle, HAL_SetCounterDownSource((HAL_CounterHandle)id,
(HAL_AnalogTriggerType)analogTriggerType, &status); (HAL_Handle)digitalSourceHandle,
(HAL_AnalogTriggerType)analogTriggerType, &status);
COUNTERJNI_LOG(logDEBUG) << "Status = " << status; COUNTERJNI_LOG(logDEBUG) << "Status = " << status;
if (status == PARAMETER_OUT_OF_RANGE) { if (status == PARAMETER_OUT_OF_RANGE) {
ThrowIllegalArgumentException(env, ThrowIllegalArgumentException(env,
@@ -167,14 +179,16 @@ Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterDownSource(
* Signature: (IZZ)V * Signature: (IZZ)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterDownSourceEdge( Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterDownSourceEdge
JNIEnv* env, jclass, jint id, jboolean valueRise, jboolean valueFall) { (JNIEnv* env, jclass, jint id, jboolean valueRise, jboolean valueFall)
{
COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterDownSourceEdge"; COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterDownSourceEdge";
COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id; COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id;
COUNTERJNI_LOG(logDEBUG) << "Rise = " << (jint)valueRise; COUNTERJNI_LOG(logDEBUG) << "Rise = " << (jint)valueRise;
COUNTERJNI_LOG(logDEBUG) << "Fall = " << (jint)valueFall; COUNTERJNI_LOG(logDEBUG) << "Fall = " << (jint)valueFall;
int32_t status = 0; int32_t status = 0;
HAL_SetCounterDownSourceEdge((HAL_CounterHandle)id, valueRise, valueFall, &status); HAL_SetCounterDownSourceEdge((HAL_CounterHandle)id, valueRise, valueFall,
&status);
COUNTERJNI_LOG(logDEBUG) << "Status = " << status; COUNTERJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status); CheckStatus(env, status);
} }
@@ -185,8 +199,9 @@ Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterDownSourceEdge(
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_CounterJNI_clearCounterDownSource( Java_edu_wpi_first_wpilibj_hal_CounterJNI_clearCounterDownSource
JNIEnv* env, jclass, jint id) { (JNIEnv* env, jclass, jint id)
{
COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI clearCounterDownSource"; COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI clearCounterDownSource";
COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id; COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id;
int32_t status = 0; int32_t status = 0;
@@ -201,8 +216,9 @@ Java_edu_wpi_first_wpilibj_hal_CounterJNI_clearCounterDownSource(
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterUpDownMode( Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterUpDownMode
JNIEnv* env, jclass, jint id) { (JNIEnv* env, jclass, jint id)
{
COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterUpDownMode"; COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterUpDownMode";
COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id; COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id;
int32_t status = 0; int32_t status = 0;
@@ -217,8 +233,9 @@ Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterUpDownMode(
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterExternalDirectionMode( Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterExternalDirectionMode
JNIEnv* env, jclass, jint id) { (JNIEnv* env, jclass, jint id)
{
COUNTERJNI_LOG(logDEBUG) COUNTERJNI_LOG(logDEBUG)
<< "Calling COUNTERJNI setCounterExternalDirectionMode"; << "Calling COUNTERJNI setCounterExternalDirectionMode";
COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id; COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id;
@@ -234,8 +251,9 @@ Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterExternalDirectionMode(
* Signature: (IZ)V * Signature: (IZ)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterSemiPeriodMode( Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterSemiPeriodMode
JNIEnv* env, jclass, jint id, jboolean value) { (JNIEnv* env, jclass, jint id, jboolean value)
{
COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterSemiPeriodMode"; COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterSemiPeriodMode";
COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id; COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id;
COUNTERJNI_LOG(logDEBUG) << "SemiPeriodMode = " << (jint)value; COUNTERJNI_LOG(logDEBUG) << "SemiPeriodMode = " << (jint)value;
@@ -251,8 +269,9 @@ Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterSemiPeriodMode(
* Signature: (ID)V * Signature: (ID)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterPulseLengthMode( Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterPulseLengthMode
JNIEnv* env, jclass, jint id, jdouble value) { (JNIEnv* env, jclass, jint id, jdouble value)
{
COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterPulseLengthMode"; COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterPulseLengthMode";
COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id; COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id;
COUNTERJNI_LOG(logDEBUG) << "PulseLengthMode = " << value; COUNTERJNI_LOG(logDEBUG) << "PulseLengthMode = " << value;
@@ -268,12 +287,14 @@ Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterPulseLengthMode(
* Signature: (I)I * Signature: (I)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_CounterJNI_getCounterSamplesToAverage( Java_edu_wpi_first_wpilibj_hal_CounterJNI_getCounterSamplesToAverage
JNIEnv* env, jclass, jint id) { (JNIEnv* env, jclass, jint id)
{
COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI getCounterSamplesToAverage"; COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI getCounterSamplesToAverage";
COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id; COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id;
int32_t status = 0; int32_t status = 0;
jint returnValue = HAL_GetCounterSamplesToAverage((HAL_CounterHandle)id, &status); jint returnValue =
HAL_GetCounterSamplesToAverage((HAL_CounterHandle)id, &status);
COUNTERJNI_LOG(logDEBUG) << "Status = " << status; COUNTERJNI_LOG(logDEBUG) << "Status = " << status;
COUNTERJNI_LOG(logDEBUG) << "getCounterSamplesToAverageResult = " COUNTERJNI_LOG(logDEBUG) << "getCounterSamplesToAverageResult = "
<< returnValue; << returnValue;
@@ -287,8 +308,9 @@ Java_edu_wpi_first_wpilibj_hal_CounterJNI_getCounterSamplesToAverage(
* Signature: (II)V * Signature: (II)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterSamplesToAverage( Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterSamplesToAverage
JNIEnv* env, jclass, jint id, jint value) { (JNIEnv* env, jclass, jint id, jint value)
{
COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterSamplesToAverage"; COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterSamplesToAverage";
COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id; COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id;
COUNTERJNI_LOG(logDEBUG) << "SamplesToAverage = " << value; COUNTERJNI_LOG(logDEBUG) << "SamplesToAverage = " << value;
@@ -307,8 +329,10 @@ Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterSamplesToAverage(
* Method: resetCounter * Method: resetCounter
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_resetCounter( JNIEXPORT void JNICALL
JNIEnv* env, jclass, jint id) { Java_edu_wpi_first_wpilibj_hal_CounterJNI_resetCounter
(JNIEnv* env, jclass, jint id)
{
COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI resetCounter"; COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI resetCounter";
COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id; COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id;
int32_t status = 0; int32_t status = 0;
@@ -322,8 +346,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_resetCounter(
* Method: getCounter * Method: getCounter
* Signature: (I)I * Signature: (I)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_getCounter( JNIEXPORT jint JNICALL
JNIEnv* env, jclass, jint id) { Java_edu_wpi_first_wpilibj_hal_CounterJNI_getCounter
(JNIEnv* env, jclass, jint id)
{
// COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI getCounter"; // COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI getCounter";
// COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id; // COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id;
int32_t status = 0; int32_t status = 0;
@@ -340,8 +366,9 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_getCounter(
* Signature: (I)D * Signature: (I)D
*/ */
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_wpilibj_hal_CounterJNI_getCounterPeriod( Java_edu_wpi_first_wpilibj_hal_CounterJNI_getCounterPeriod
JNIEnv* env, jclass, jint id) { (JNIEnv* env, jclass, jint id)
{
COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI getCounterPeriod"; COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI getCounterPeriod";
COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id; COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id;
int32_t status = 0; int32_t status = 0;
@@ -358,8 +385,9 @@ Java_edu_wpi_first_wpilibj_hal_CounterJNI_getCounterPeriod(
* Signature: (ID)V * Signature: (ID)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterMaxPeriod( Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterMaxPeriod
JNIEnv* env, jclass, jint id, jdouble value) { (JNIEnv* env, jclass, jint id, jdouble value)
{
COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterMaxPeriod"; COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterMaxPeriod";
COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id; COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id;
COUNTERJNI_LOG(logDEBUG) << "MaxPeriod = " << value; COUNTERJNI_LOG(logDEBUG) << "MaxPeriod = " << value;
@@ -375,8 +403,9 @@ Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterMaxPeriod(
* Signature: (IZ)V * Signature: (IZ)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterUpdateWhenEmpty( Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterUpdateWhenEmpty
JNIEnv* env, jclass, jint id, jboolean value) { (JNIEnv* env, jclass, jint id, jboolean value)
{
COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterMaxPeriod"; COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterMaxPeriod";
COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id; COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id;
COUNTERJNI_LOG(logDEBUG) << "UpdateWhenEmpty = " << (jint)value; COUNTERJNI_LOG(logDEBUG) << "UpdateWhenEmpty = " << (jint)value;
@@ -392,8 +421,9 @@ Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterUpdateWhenEmpty(
* Signature: (I)Z * Signature: (I)Z
*/ */
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_CounterJNI_getCounterStopped( Java_edu_wpi_first_wpilibj_hal_CounterJNI_getCounterStopped
JNIEnv* env, jclass, jint id) { (JNIEnv* env, jclass, jint id)
{
COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI getCounterStopped"; COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI getCounterStopped";
COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id; COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id;
int32_t status = 0; int32_t status = 0;
@@ -410,12 +440,14 @@ Java_edu_wpi_first_wpilibj_hal_CounterJNI_getCounterStopped(
* Signature: (I)Z * Signature: (I)Z
*/ */
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_CounterJNI_getCounterDirection( Java_edu_wpi_first_wpilibj_hal_CounterJNI_getCounterDirection
JNIEnv* env, jclass, jint id) { (JNIEnv* env, jclass, jint id)
{
COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI getCounterDirection"; COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI getCounterDirection";
COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id; COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id;
int32_t status = 0; int32_t status = 0;
jboolean returnValue = HAL_GetCounterDirection((HAL_CounterHandle)id, &status); jboolean returnValue =
HAL_GetCounterDirection((HAL_CounterHandle)id, &status);
COUNTERJNI_LOG(logDEBUG) << "Status = " << status; COUNTERJNI_LOG(logDEBUG) << "Status = " << status;
COUNTERJNI_LOG(logDEBUG) << "getCounterDirectionResult = " COUNTERJNI_LOG(logDEBUG) << "getCounterDirectionResult = "
<< (jint)returnValue; << (jint)returnValue;
@@ -429,8 +461,9 @@ Java_edu_wpi_first_wpilibj_hal_CounterJNI_getCounterDirection(
* Signature: (IZ)V * Signature: (IZ)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterReverseDirection( Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterReverseDirection
JNIEnv* env, jclass, jint id, jboolean value) { (JNIEnv* env, jclass, jint id, jboolean value)
{
COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterReverseDirection"; COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterReverseDirection";
COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id; COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id;
COUNTERJNI_LOG(logDEBUG) << "ReverseDirection = " << (jint)value; COUNTERJNI_LOG(logDEBUG) << "ReverseDirection = " << (jint)value;

View File

@@ -1,21 +1,21 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */ /* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
#include <assert.h>
#include <jni.h> #include <jni.h>
#include "HAL/cpp/Log.h"
#include "edu_wpi_first_wpilibj_hal_DIOJNI.h" #include <cassert>
#include "HAL/DIO.h" #include "HAL/DIO.h"
#include "HAL/PWM.h" #include "HAL/PWM.h"
#include "HALUtil.h"
#include "HAL/Ports.h" #include "HAL/Ports.h"
#include "HAL/cpp/Log.h"
#include "HAL/handles/HandlesInternal.h" #include "HAL/handles/HandlesInternal.h"
#include "HALUtil.h"
#include "edu_wpi_first_wpilibj_hal_DIOJNI.h"
using namespace frc; using namespace frc;
@@ -26,23 +26,25 @@ TLogLevel dioJNILogLevel = logWARNING;
if (level > dioJNILogLevel) \ if (level > dioJNILogLevel) \
; \ ; \
else \ else \
Log().Get(level) Log().Get(level)
extern "C" { extern "C" {
/* /*
* Class: edu_wpi_first_wpilibj_hal_DIOJNI * Class: edu_wpi_first_wpilibj_hal_DIOJNI
* Method: initializeDIOPort * Method: initializeDIOPort
* Signature: (IZ)I; * Signature: (IZ)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_DIOJNI_initializeDIOPort( Java_edu_wpi_first_wpilibj_hal_DIOJNI_initializeDIOPort
JNIEnv *env, jclass, jint id, jboolean input) { (JNIEnv* env, jclass, jint id, jboolean input)
{
DIOJNI_LOG(logDEBUG) << "Calling DIOJNI initializeDIOPort"; DIOJNI_LOG(logDEBUG) << "Calling DIOJNI initializeDIOPort";
DIOJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_PortHandle)id; DIOJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_PortHandle)id;
DIOJNI_LOG(logDEBUG) << "Input = " << (jint)input; DIOJNI_LOG(logDEBUG) << "Input = " << (jint)input;
int32_t status = 0; int32_t status = 0;
auto dio = HAL_InitializeDIOPort((HAL_PortHandle)id, (uint8_t)input, &status); auto dio = HAL_InitializeDIOPort((HAL_PortHandle)id,
static_cast<uint8_t>(input), &status);
DIOJNI_LOG(logDEBUG) << "Status = " << status; DIOJNI_LOG(logDEBUG) << "Status = " << status;
DIOJNI_LOG(logDEBUG) << "DIO Handle = " << dio; DIOJNI_LOG(logDEBUG) << "DIO Handle = " << dio;
CheckStatusRange(env, status, 0, HAL_GetNumDigitalChannels(), CheckStatusRange(env, status, 0, HAL_GetNumDigitalChannels(),
@@ -53,10 +55,12 @@ Java_edu_wpi_first_wpilibj_hal_DIOJNI_initializeDIOPort(
/* /*
* Class: edu_wpi_first_wpilibj_hal_DIOJNI * Class: edu_wpi_first_wpilibj_hal_DIOJNI
* Method: checkDIOChannel * Method: checkDIOChannel
* Signature: (I)Z; * Signature: (I)Z
*/ */
JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_DIOJNI_checkDIOChannel( JNIEXPORT jboolean JNICALL
JNIEnv *env, jclass, jint channel) { Java_edu_wpi_first_wpilibj_hal_DIOJNI_checkDIOChannel
(JNIEnv* env, jclass, jint channel)
{
DIOJNI_LOG(logDEBUG) << "Calling DIOJNI checkDIOChannel"; DIOJNI_LOG(logDEBUG) << "Calling DIOJNI checkDIOChannel";
DIOJNI_LOG(logDEBUG) << "Channel = " << channel; DIOJNI_LOG(logDEBUG) << "Channel = " << channel;
return HAL_CheckDIOChannel(channel); return HAL_CheckDIOChannel(channel);
@@ -65,10 +69,12 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_DIOJNI_checkDIOChannel
/* /*
* Class: edu_wpi_first_wpilibj_hal_DIOJNI * Class: edu_wpi_first_wpilibj_hal_DIOJNI
* Method: freeDIOPort * Method: freeDIOPort
* Signature: (I)V; * Signature: (I)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_DIOJNI_freeDIOPort( JNIEXPORT void JNICALL
JNIEnv *env, jclass, jint id) { Java_edu_wpi_first_wpilibj_hal_DIOJNI_freeDIOPort
(JNIEnv* env, jclass, jint id)
{
DIOJNI_LOG(logDEBUG) << "Calling DIOJNI freeDIOPort"; DIOJNI_LOG(logDEBUG) << "Calling DIOJNI freeDIOPort";
DIOJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_DigitalHandle)id; DIOJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_DigitalHandle)id;
HAL_FreeDIOPort((HAL_DigitalHandle)id); HAL_FreeDIOPort((HAL_DigitalHandle)id);
@@ -79,8 +85,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_DIOJNI_freeDIOPort(
* Method: setDIO * Method: setDIO
* Signature: (IS)V * Signature: (IS)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_DIOJNI_setDIO( JNIEXPORT void JNICALL
JNIEnv *env, jclass, jint id, jshort value) { Java_edu_wpi_first_wpilibj_hal_DIOJNI_setDIO
(JNIEnv* env, jclass, jint id, jshort value)
{
// DIOJNI_LOG(logDEBUG) << "Calling DIOJNI setDIO"; // DIOJNI_LOG(logDEBUG) << "Calling DIOJNI setDIO";
// DIOJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_DigitalHandle)id; // DIOJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_DigitalHandle)id;
// DIOJNI_LOG(logDEBUG) << "Value = " << value; // DIOJNI_LOG(logDEBUG) << "Value = " << value;
@@ -95,8 +103,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_DIOJNI_setDIO(
* Method: setDIODirection * Method: setDIODirection
* Signature: (IZ)V * Signature: (IZ)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_DIOJNI_setDIODirection( JNIEXPORT void JNICALL
JNIEnv *env, jclass, jint id, jboolean input) { Java_edu_wpi_first_wpilibj_hal_DIOJNI_setDIODirection
(JNIEnv* env, jclass, jint id, jboolean input)
{
// DIOJNI_LOG(logDEBUG) << "Calling DIOJNI setDIO"; // DIOJNI_LOG(logDEBUG) << "Calling DIOJNI setDIO";
// DIOJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_DigitalHandle)id; // DIOJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_DigitalHandle)id;
// DIOJNI_LOG(logDEBUG) << "IsInput = " << input; // DIOJNI_LOG(logDEBUG) << "IsInput = " << input;
@@ -109,10 +119,12 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_DIOJNI_setDIODirection(
/* /*
* Class: edu_wpi_first_wpilibj_hal_DIOJNI * Class: edu_wpi_first_wpilibj_hal_DIOJNI
* Method: getDIO * Method: getDIO
* Signature: (J)Z * Signature: (I)Z
*/ */
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_DIOJNI_getDIO(JNIEnv *env, jclass, jint id) { Java_edu_wpi_first_wpilibj_hal_DIOJNI_getDIO
(JNIEnv* env, jclass, jint id)
{
// DIOJNI_LOG(logDEBUG) << "Calling DIOJNI getDIO"; // DIOJNI_LOG(logDEBUG) << "Calling DIOJNI getDIO";
// DIOJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_DigitalHandle)id; // DIOJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_DigitalHandle)id;
int32_t status = 0; int32_t status = 0;
@@ -126,11 +138,12 @@ Java_edu_wpi_first_wpilibj_hal_DIOJNI_getDIO(JNIEnv *env, jclass, jint id) {
/* /*
* Class: edu_wpi_first_wpilibj_hal_DIOJNI * Class: edu_wpi_first_wpilibj_hal_DIOJNI
* Method: getDIODirection * Method: getDIODirection
* Signature: (J)Z * Signature: (I)Z
*/ */
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_DIOJNI_getDIODirection( Java_edu_wpi_first_wpilibj_hal_DIOJNI_getDIODirection
JNIEnv *env, jclass, jint id) { (JNIEnv* env, jclass, jint id)
{
DIOJNI_LOG(logDEBUG) << "Calling DIOJNI getDIODirection (RR upd)"; DIOJNI_LOG(logDEBUG) << "Calling DIOJNI getDIODirection (RR upd)";
// DIOJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_DigitalHandle)id; // DIOJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_DigitalHandle)id;
int32_t status = 0; int32_t status = 0;
@@ -144,10 +157,12 @@ Java_edu_wpi_first_wpilibj_hal_DIOJNI_getDIODirection(
/* /*
* Class: edu_wpi_first_wpilibj_hal_DIOJNI * Class: edu_wpi_first_wpilibj_hal_DIOJNI
* Method: pulse * Method: pulse
* Signature: (JD)V * Signature: (ID)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_DIOJNI_pulse( JNIEXPORT void JNICALL
JNIEnv *env, jclass, jint id, jdouble value) { Java_edu_wpi_first_wpilibj_hal_DIOJNI_pulse
(JNIEnv* env, jclass, jint id, jdouble value)
{
DIOJNI_LOG(logDEBUG) << "Calling DIOJNI pulse (RR upd)"; DIOJNI_LOG(logDEBUG) << "Calling DIOJNI pulse (RR upd)";
// DIOJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_DigitalHandle)id; // DIOJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_DigitalHandle)id;
// DIOJNI_LOG(logDEBUG) << "Value = " << value; // DIOJNI_LOG(logDEBUG) << "Value = " << value;
@@ -160,10 +175,12 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_DIOJNI_pulse(
/* /*
* Class: edu_wpi_first_wpilibj_hal_DIOJNI * Class: edu_wpi_first_wpilibj_hal_DIOJNI
* Method: isPulsing * Method: isPulsing
* Signature: (J)Z * Signature: (I)Z
*/ */
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_DIOJNI_isPulsing(JNIEnv *env, jclass, jint id) { Java_edu_wpi_first_wpilibj_hal_DIOJNI_isPulsing
(JNIEnv* env, jclass, jint id)
{
DIOJNI_LOG(logDEBUG) << "Calling DIOJNI isPulsing (RR upd)"; DIOJNI_LOG(logDEBUG) << "Calling DIOJNI isPulsing (RR upd)";
// DIOJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_DigitalHandle)id; // DIOJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_DigitalHandle)id;
int32_t status = 0; int32_t status = 0;
@@ -180,7 +197,9 @@ Java_edu_wpi_first_wpilibj_hal_DIOJNI_isPulsing(JNIEnv *env, jclass, jint id) {
* Signature: ()Z * Signature: ()Z
*/ */
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_DIOJNI_isAnyPulsing(JNIEnv *env, jclass) { Java_edu_wpi_first_wpilibj_hal_DIOJNI_isAnyPulsing
(JNIEnv* env, jclass)
{
DIOJNI_LOG(logDEBUG) << "Calling DIOJNI isAnyPulsing (RR upd)"; DIOJNI_LOG(logDEBUG) << "Calling DIOJNI isAnyPulsing (RR upd)";
int32_t status = 0; int32_t status = 0;
jboolean returnValue = HAL_IsAnyPulsing(&status); jboolean returnValue = HAL_IsAnyPulsing(&status);
@@ -196,7 +215,9 @@ Java_edu_wpi_first_wpilibj_hal_DIOJNI_isAnyPulsing(JNIEnv *env, jclass) {
* Signature: ()S * Signature: ()S
*/ */
JNIEXPORT jshort JNICALL JNIEXPORT jshort JNICALL
Java_edu_wpi_first_wpilibj_hal_DIOJNI_getLoopTiming(JNIEnv *env, jclass) { Java_edu_wpi_first_wpilibj_hal_DIOJNI_getLoopTiming
(JNIEnv* env, jclass)
{
DIOJNI_LOG(logDEBUG) << "Calling DIOJNI getLoopTimeing"; DIOJNI_LOG(logDEBUG) << "Calling DIOJNI getLoopTimeing";
int32_t status = 0; int32_t status = 0;
jshort returnValue = HAL_GetPWMLoopTiming(&status); jshort returnValue = HAL_GetPWMLoopTiming(&status);
@@ -206,14 +227,15 @@ Java_edu_wpi_first_wpilibj_hal_DIOJNI_getLoopTiming(JNIEnv *env, jclass) {
return returnValue; return returnValue;
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_DIOJNI * Class: edu_wpi_first_wpilibj_hal_DIOJNI
* Method: allocateDigitalPWM * Method: allocateDigitalPWM
* Signature: ()I * Signature: ()I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_DIOJNI_allocateDigitalPWM(JNIEnv* env, jclass) { Java_edu_wpi_first_wpilibj_hal_DIOJNI_allocateDigitalPWM
(JNIEnv* env, jclass)
{
DIOJNI_LOG(logDEBUG) << "Calling DIOJNI allocateDigitalPWM"; DIOJNI_LOG(logDEBUG) << "Calling DIOJNI allocateDigitalPWM";
int32_t status = 0; int32_t status = 0;
auto pwm = HAL_AllocateDigitalPWM(&status); auto pwm = HAL_AllocateDigitalPWM(&status);
@@ -229,7 +251,9 @@ Java_edu_wpi_first_wpilibj_hal_DIOJNI_allocateDigitalPWM(JNIEnv* env, jclass) {
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_DIOJNI_freeDigitalPWM(JNIEnv* env, jclass, jint id) { Java_edu_wpi_first_wpilibj_hal_DIOJNI_freeDigitalPWM
(JNIEnv* env, jclass, jint id)
{
DIOJNI_LOG(logDEBUG) << "Calling DIOJNI freeDigitalPWM"; DIOJNI_LOG(logDEBUG) << "Calling DIOJNI freeDigitalPWM";
DIOJNI_LOG(logDEBUG) << "PWM Handle = " << (HAL_DigitalPWMHandle)id; DIOJNI_LOG(logDEBUG) << "PWM Handle = " << (HAL_DigitalPWMHandle)id;
int32_t status = 0; int32_t status = 0;
@@ -243,8 +267,10 @@ Java_edu_wpi_first_wpilibj_hal_DIOJNI_freeDigitalPWM(JNIEnv* env, jclass, jint i
* Method: setDigitalPWMRate * Method: setDigitalPWMRate
* Signature: (D)V * Signature: (D)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_DIOJNI_setDigitalPWMRate( JNIEXPORT void JNICALL
JNIEnv* env, jclass, jdouble value) { Java_edu_wpi_first_wpilibj_hal_DIOJNI_setDigitalPWMRate
(JNIEnv* env, jclass, jdouble value)
{
DIOJNI_LOG(logDEBUG) << "Calling DIOJNI setDigitalPWMRate"; DIOJNI_LOG(logDEBUG) << "Calling DIOJNI setDigitalPWMRate";
DIOJNI_LOG(logDEBUG) << "Rate= " << value; DIOJNI_LOG(logDEBUG) << "Rate= " << value;
int32_t status = 0; int32_t status = 0;
@@ -258,8 +284,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_DIOJNI_setDigitalPWMRate(
* Method: setDigitalPWMDutyCycle * Method: setDigitalPWMDutyCycle
* Signature: (ID)V * Signature: (ID)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_DIOJNI_setDigitalPWMDutyCycle( JNIEXPORT void JNICALL
JNIEnv* env, jclass, jint id, jdouble value) { Java_edu_wpi_first_wpilibj_hal_DIOJNI_setDigitalPWMDutyCycle
(JNIEnv* env, jclass, jint id, jdouble value)
{
DIOJNI_LOG(logDEBUG) << "Calling DIOJNI setDigitalPWMDutyCycle"; DIOJNI_LOG(logDEBUG) << "Calling DIOJNI setDigitalPWMDutyCycle";
DIOJNI_LOG(logDEBUG) << "PWM Handle = " << (HAL_DigitalPWMHandle)id; DIOJNI_LOG(logDEBUG) << "PWM Handle = " << (HAL_DigitalPWMHandle)id;
DIOJNI_LOG(logDEBUG) << "DutyCycle= " << value; DIOJNI_LOG(logDEBUG) << "DutyCycle= " << value;
@@ -275,13 +303,15 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_DIOJNI_setDigitalPWMDutyCy
* Signature: (II)V * Signature: (II)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_DIOJNI_setDigitalPWMOutputChannel( Java_edu_wpi_first_wpilibj_hal_DIOJNI_setDigitalPWMOutputChannel
JNIEnv* env, jclass, jint id, jint value) { (JNIEnv* env, jclass, jint id, jint value)
{
DIOJNI_LOG(logDEBUG) << "Calling DIOJNI setDigitalPWMOutputChannel"; DIOJNI_LOG(logDEBUG) << "Calling DIOJNI setDigitalPWMOutputChannel";
DIOJNI_LOG(logDEBUG) << "PWM Handle = " << (HAL_DigitalPWMHandle)id; DIOJNI_LOG(logDEBUG) << "PWM Handle = " << (HAL_DigitalPWMHandle)id;
DIOJNI_LOG(logDEBUG) << "Channel= " << value; DIOJNI_LOG(logDEBUG) << "Channel= " << value;
int32_t status = 0; int32_t status = 0;
HAL_SetDigitalPWMOutputChannel((HAL_DigitalPWMHandle)id, (uint32_t)value, &status); HAL_SetDigitalPWMOutputChannel((HAL_DigitalPWMHandle)id,
static_cast<uint32_t>(value), &status);
DIOJNI_LOG(logDEBUG) << "Status = " << status; DIOJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status); CheckStatus(env, status);
} }

View File

@@ -1,14 +1,14 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */ /* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
#include <jni.h> #include <jni.h>
#include "HAL/DIO.h" #include "HAL/DIO.h"
#include "HALUtil.h" #include "HALUtil.h"
#include "edu_wpi_first_wpilibj_hal_DigitalGlitchFilterJNI.h" #include "edu_wpi_first_wpilibj_hal_DigitalGlitchFilterJNI.h"
using namespace frc; using namespace frc;
@@ -16,10 +16,12 @@ using namespace frc;
/* /*
* Class: edu_wpi_first_wpilibj_hal_DigitalGlitchFilterJNI * Class: edu_wpi_first_wpilibj_hal_DigitalGlitchFilterJNI
* Method: setFilterSelect * Method: setFilterSelect
* Signature: (II)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_DigitalGlitchFilterJNI_setFilterSelect( Java_edu_wpi_first_wpilibj_hal_DigitalGlitchFilterJNI_setFilterSelect
JNIEnv* env, jclass, jint id, jint filter_index) { (JNIEnv* env, jclass, jint id, jint filter_index)
{
int32_t status = 0; int32_t status = 0;
HAL_SetFilterSelect(static_cast<HAL_DigitalHandle>(id), filter_index, HAL_SetFilterSelect(static_cast<HAL_DigitalHandle>(id), filter_index,
@@ -30,10 +32,12 @@ Java_edu_wpi_first_wpilibj_hal_DigitalGlitchFilterJNI_setFilterSelect(
/* /*
* Class: edu_wpi_first_wpilibj_hal_DigitalGlitchFilterJNI * Class: edu_wpi_first_wpilibj_hal_DigitalGlitchFilterJNI
* Method: getFilterSelect * Method: getFilterSelect
* Signature: (I)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_DigitalGlitchFilterJNI_getFilterSelect( Java_edu_wpi_first_wpilibj_hal_DigitalGlitchFilterJNI_getFilterSelect
JNIEnv* env, jclass, jint id) { (JNIEnv* env, jclass, jint id)
{
int32_t status = 0; int32_t status = 0;
jint result = jint result =
@@ -45,10 +49,12 @@ Java_edu_wpi_first_wpilibj_hal_DigitalGlitchFilterJNI_getFilterSelect(
/* /*
* Class: edu_wpi_first_wpilibj_hal_DigitalGlitchFilterJNI * Class: edu_wpi_first_wpilibj_hal_DigitalGlitchFilterJNI
* Method: setFilterPeriod * Method: setFilterPeriod
* Signature: (II)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_DigitalGlitchFilterJNI_setFilterPeriod( Java_edu_wpi_first_wpilibj_hal_DigitalGlitchFilterJNI_setFilterPeriod
JNIEnv* env, jclass, jint filter_index, jint fpga_cycles) { (JNIEnv* env, jclass, jint filter_index, jint fpga_cycles)
{
int32_t status = 0; int32_t status = 0;
HAL_SetFilterPeriod(filter_index, fpga_cycles, &status); HAL_SetFilterPeriod(filter_index, fpga_cycles, &status);
@@ -58,10 +64,12 @@ Java_edu_wpi_first_wpilibj_hal_DigitalGlitchFilterJNI_setFilterPeriod(
/* /*
* Class: edu_wpi_first_wpilibj_hal_DigitalGlitchFilterJNI * Class: edu_wpi_first_wpilibj_hal_DigitalGlitchFilterJNI
* Method: getFilterPeriod * Method: getFilterPeriod
* Signature: (I)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_DigitalGlitchFilterJNI_getFilterPeriod( Java_edu_wpi_first_wpilibj_hal_DigitalGlitchFilterJNI_getFilterPeriod
JNIEnv* env, jclass, jint filter_index) { (JNIEnv* env, jclass, jint filter_index)
{
int32_t status = 0; int32_t status = 0;
jint result = HAL_GetFilterPeriod(filter_index, &status); jint result = HAL_GetFilterPeriod(filter_index, &status);

View File

@@ -1,19 +1,19 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */ /* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
#include <assert.h>
#include <jni.h> #include <jni.h>
#include "HAL/cpp/Log.h"
#include "edu_wpi_first_wpilibj_hal_EncoderJNI.h" #include <cassert>
#include "HAL/Encoder.h" #include "HAL/Encoder.h"
#include "HAL/Errors.h" #include "HAL/Errors.h"
#include "HAL/cpp/Log.h"
#include "HALUtil.h" #include "HALUtil.h"
#include "edu_wpi_first_wpilibj_hal_EncoderJNI.h"
using namespace frc; using namespace frc;
@@ -24,7 +24,7 @@ TLogLevel encoderJNILogLevel = logWARNING;
if (level > encoderJNILogLevel) \ if (level > encoderJNILogLevel) \
; \ ; \
else \ else \
Log().Get(level) Log().Get(level)
extern "C" { extern "C" {
@@ -34,24 +34,25 @@ extern "C" {
* Signature: (IIIIZI)I * Signature: (IIIIZI)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_EncoderJNI_initializeEncoder( Java_edu_wpi_first_wpilibj_hal_EncoderJNI_initializeEncoder
JNIEnv* env, jclass, jint digitalSourceHandleA, jint analogTriggerTypeA, (JNIEnv* env, jclass, jint digitalSourceHandleA, jint analogTriggerTypeA,
jint digitalSourceHandleB, jint analogTriggerTypeB, jboolean reverseDirection, jint digitalSourceHandleB, jint analogTriggerTypeB,
jint encodingType) { jboolean reverseDirection, jint encodingType)
{
ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI initializeEncoder"; ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI initializeEncoder";
ENCODERJNI_LOG(logDEBUG) << "Source Handle A = " << digitalSourceHandleA; ENCODERJNI_LOG(logDEBUG) << "Source Handle A = " << digitalSourceHandleA;
ENCODERJNI_LOG(logDEBUG) << "Analog Trigger Type A = " ENCODERJNI_LOG(logDEBUG) << "Analog Trigger Type A = " << analogTriggerTypeA;
<< analogTriggerTypeA;
ENCODERJNI_LOG(logDEBUG) << "Source Handle B = " << digitalSourceHandleB; ENCODERJNI_LOG(logDEBUG) << "Source Handle B = " << digitalSourceHandleB;
ENCODERJNI_LOG(logDEBUG) << "Analog Trigger Type B = " ENCODERJNI_LOG(logDEBUG) << "Analog Trigger Type B = " << analogTriggerTypeB;
<< analogTriggerTypeB;
ENCODERJNI_LOG(logDEBUG) << "Reverse direction = " << (jint)reverseDirection; ENCODERJNI_LOG(logDEBUG) << "Reverse direction = " << (jint)reverseDirection;
ENCODERJNI_LOG(logDEBUG) << "EncodingType = " << encodingType; ENCODERJNI_LOG(logDEBUG) << "EncodingType = " << encodingType;
int32_t status = 0; int32_t status = 0;
auto encoder = HAL_InitializeEncoder( auto encoder = HAL_InitializeEncoder(
(HAL_Handle)digitalSourceHandleA, (HAL_AnalogTriggerType)analogTriggerTypeA, (HAL_Handle)digitalSourceHandleA,
(HAL_Handle)digitalSourceHandleB, (HAL_AnalogTriggerType)analogTriggerTypeB, (HAL_AnalogTriggerType)analogTriggerTypeA,
reverseDirection, (HAL_EncoderEncodingType)encodingType, &status); (HAL_Handle)digitalSourceHandleB,
(HAL_AnalogTriggerType)analogTriggerTypeB, reverseDirection,
(HAL_EncoderEncodingType)encodingType, &status);
ENCODERJNI_LOG(logDEBUG) << "Status = " << status; ENCODERJNI_LOG(logDEBUG) << "Status = " << status;
ENCODERJNI_LOG(logDEBUG) << "ENCODER Handle = " << encoder; ENCODERJNI_LOG(logDEBUG) << "ENCODER Handle = " << encoder;
@@ -64,8 +65,10 @@ Java_edu_wpi_first_wpilibj_hal_EncoderJNI_initializeEncoder(
* Method: freeEncoder * Method: freeEncoder
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_EncoderJNI_freeEncoder( JNIEXPORT void JNICALL
JNIEnv* env, jclass, jint id) { Java_edu_wpi_first_wpilibj_hal_EncoderJNI_freeEncoder
(JNIEnv* env, jclass, jint id)
{
ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI freeEncoder"; ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI freeEncoder";
ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id; ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id;
int32_t status = 0; int32_t status = 0;
@@ -79,8 +82,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_EncoderJNI_freeEncoder(
* Method: getEncoder * Method: getEncoder
* Signature: (I)I * Signature: (I)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoder( JNIEXPORT jint JNICALL
JNIEnv* env, jclass, jint id) { Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoder
(JNIEnv* env, jclass, jint id)
{
ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncoder"; ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncoder";
ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id; ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id;
int32_t status = 0; int32_t status = 0;
@@ -96,8 +101,10 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoder(
* Method: getEncoderRaw * Method: getEncoderRaw
* Signature: (I)I * Signature: (I)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderRaw( JNIEXPORT jint JNICALL
JNIEnv* env, jclass, jint id) { Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderRaw
(JNIEnv* env, jclass, jint id)
{
ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncoderRaw"; ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncoderRaw";
ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id; ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id;
int32_t status = 0; int32_t status = 0;
@@ -113,12 +120,15 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderRaw(
* Method: getEncodingScaleFactor * Method: getEncodingScaleFactor
* Signature: (I)I * Signature: (I)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncodingScaleFactor( JNIEXPORT jint JNICALL
JNIEnv* env, jclass, jint id) { Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncodingScaleFactor
(JNIEnv* env, jclass, jint id)
{
ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncodingScaleFactor"; ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncodingScaleFactor";
ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id; ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id;
int32_t status = 0; int32_t status = 0;
jint returnValue = HAL_GetEncoderEncodingScale((HAL_EncoderHandle)id, &status); jint returnValue =
HAL_GetEncoderEncodingScale((HAL_EncoderHandle)id, &status);
ENCODERJNI_LOG(logDEBUG) << "Status = " << status; ENCODERJNI_LOG(logDEBUG) << "Status = " << status;
ENCODERJNI_LOG(logDEBUG) << "getEncodingScaleFactorResult = " << returnValue; ENCODERJNI_LOG(logDEBUG) << "getEncodingScaleFactorResult = " << returnValue;
CheckStatus(env, status); CheckStatus(env, status);
@@ -130,8 +140,10 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncodingScal
* Method: resetEncoder * Method: resetEncoder
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_EncoderJNI_resetEncoder( JNIEXPORT void JNICALL
JNIEnv* env, jclass, jint id) { Java_edu_wpi_first_wpilibj_hal_EncoderJNI_resetEncoder
(JNIEnv* env, jclass, jint id)
{
ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI resetEncoder"; ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI resetEncoder";
ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id; ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id;
int32_t status = 0; int32_t status = 0;
@@ -146,8 +158,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_EncoderJNI_resetEncoder(
* Signature: (I)D * Signature: (I)D
*/ */
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderPeriod( Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderPeriod
JNIEnv* env, jclass, jint id) { (JNIEnv* env, jclass, jint id)
{
ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncoderPeriod"; ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncoderPeriod";
ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id; ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id;
int32_t status = 0; int32_t status = 0;
@@ -164,8 +177,9 @@ Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderPeriod(
* Signature: (ID)V * Signature: (ID)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_EncoderJNI_setEncoderMaxPeriod( Java_edu_wpi_first_wpilibj_hal_EncoderJNI_setEncoderMaxPeriod
JNIEnv* env, jclass, jint id, jdouble value) { (JNIEnv* env, jclass, jint id, jdouble value)
{
ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI setEncoderMaxPeriod"; ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI setEncoderMaxPeriod";
ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id; ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id;
int32_t status = 0; int32_t status = 0;
@@ -180,8 +194,9 @@ Java_edu_wpi_first_wpilibj_hal_EncoderJNI_setEncoderMaxPeriod(
* Signature: (I)Z * Signature: (I)Z
*/ */
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderStopped( Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderStopped
JNIEnv* env, jclass, jint id) { (JNIEnv* env, jclass, jint id)
{
ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncoderStopped"; ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncoderStopped";
ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id; ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id;
int32_t status = 0; int32_t status = 0;
@@ -198,12 +213,14 @@ Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderStopped(
* Signature: (I)Z * Signature: (I)Z
*/ */
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderDirection( Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderDirection
JNIEnv* env, jclass, jint id) { (JNIEnv* env, jclass, jint id)
{
ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncoderDirection"; ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncoderDirection";
ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id; ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id;
int32_t status = 0; int32_t status = 0;
jboolean returnValue = HAL_GetEncoderDirection((HAL_EncoderHandle)id, &status); jboolean returnValue =
HAL_GetEncoderDirection((HAL_EncoderHandle)id, &status);
ENCODERJNI_LOG(logDEBUG) << "Status = " << status; ENCODERJNI_LOG(logDEBUG) << "Status = " << status;
ENCODERJNI_LOG(logDEBUG) << "getDirectionEncoderResult = " << returnValue; ENCODERJNI_LOG(logDEBUG) << "getDirectionEncoderResult = " << returnValue;
CheckStatus(env, status); CheckStatus(env, status);
@@ -216,8 +233,9 @@ Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderDirection(
* Signature: (I)D * Signature: (I)D
*/ */
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderDistance( Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderDistance
JNIEnv* env, jclass, jint id) { (JNIEnv* env, jclass, jint id)
{
ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncoderDistance"; ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncoderDistance";
ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id; ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id;
int32_t status = 0; int32_t status = 0;
@@ -234,8 +252,9 @@ Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderDistance(
* Signature: (I)D * Signature: (I)D
*/ */
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderRate( Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderRate
JNIEnv* env, jclass, jint id) { (JNIEnv* env, jclass, jint id)
{
ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncoderRate"; ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncoderRate";
ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id; ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id;
int32_t status = 0; int32_t status = 0;
@@ -252,8 +271,9 @@ Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderRate(
* Signature: (ID)V * Signature: (ID)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_EncoderJNI_setEncoderMinRate( Java_edu_wpi_first_wpilibj_hal_EncoderJNI_setEncoderMinRate
JNIEnv* env, jclass, jint id, jdouble value) { (JNIEnv* env, jclass, jint id, jdouble value)
{
ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI setEncoderMinRate"; ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI setEncoderMinRate";
ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id; ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id;
int32_t status = 0; int32_t status = 0;
@@ -268,8 +288,9 @@ Java_edu_wpi_first_wpilibj_hal_EncoderJNI_setEncoderMinRate(
* Signature: (ID)V * Signature: (ID)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_EncoderJNI_setEncoderDistancePerPulse( Java_edu_wpi_first_wpilibj_hal_EncoderJNI_setEncoderDistancePerPulse
JNIEnv* env, jclass, jint id, jdouble value) { (JNIEnv* env, jclass, jint id, jdouble value)
{
ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI setEncoderDistancePerPulse"; ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI setEncoderDistancePerPulse";
ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id; ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id;
int32_t status = 0; int32_t status = 0;
@@ -284,8 +305,9 @@ Java_edu_wpi_first_wpilibj_hal_EncoderJNI_setEncoderDistancePerPulse(
* Signature: (IZ)V * Signature: (IZ)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_EncoderJNI_setEncoderReverseDirection( Java_edu_wpi_first_wpilibj_hal_EncoderJNI_setEncoderReverseDirection
JNIEnv* env, jclass, jint id, jboolean value) { (JNIEnv* env, jclass, jint id, jboolean value)
{
ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI setEncoderReverseDirection"; ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI setEncoderReverseDirection";
ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id; ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id;
int32_t status = 0; int32_t status = 0;
@@ -300,8 +322,9 @@ Java_edu_wpi_first_wpilibj_hal_EncoderJNI_setEncoderReverseDirection(
* Signature: (II)V * Signature: (II)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_EncoderJNI_setEncoderSamplesToAverage( Java_edu_wpi_first_wpilibj_hal_EncoderJNI_setEncoderSamplesToAverage
JNIEnv* env, jclass, jint id, jint value) { (JNIEnv* env, jclass, jint id, jint value)
{
ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI setEncoderSamplesToAverage"; ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI setEncoderSamplesToAverage";
ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id; ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id;
int32_t status = 0; int32_t status = 0;
@@ -320,12 +343,14 @@ Java_edu_wpi_first_wpilibj_hal_EncoderJNI_setEncoderSamplesToAverage(
* Signature: (I)I * Signature: (I)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderSamplesToAverage( Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderSamplesToAverage
JNIEnv* env, jclass, jint id) { (JNIEnv* env, jclass, jint id)
{
ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncoderSamplesToAverage"; ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncoderSamplesToAverage";
ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id; ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id;
int32_t status = 0; int32_t status = 0;
jint returnValue = HAL_GetEncoderSamplesToAverage((HAL_EncoderHandle)id, &status); jint returnValue =
HAL_GetEncoderSamplesToAverage((HAL_EncoderHandle)id, &status);
ENCODERJNI_LOG(logDEBUG) << "Status = " << status; ENCODERJNI_LOG(logDEBUG) << "Status = " << status;
ENCODERJNI_LOG(logDEBUG) << "getEncoderSamplesToAverageResult = " ENCODERJNI_LOG(logDEBUG) << "getEncoderSamplesToAverageResult = "
<< returnValue; << returnValue;
@@ -339,17 +364,18 @@ Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderSamplesToAverage(
* Signature: (IIII)V * Signature: (IIII)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_EncoderJNI_setEncoderIndexSource( Java_edu_wpi_first_wpilibj_hal_EncoderJNI_setEncoderIndexSource
JNIEnv* env, jclass, jint id, jint digitalSourceHandle, (JNIEnv* env, jclass, jint id, jint digitalSourceHandle,
jint analogTriggerType, jint type) { jint analogTriggerType, jint type)
{
ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI setEncoderIndexSource"; ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI setEncoderIndexSource";
ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id; ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id;
ENCODERJNI_LOG(logDEBUG) << "Source Handle = " << digitalSourceHandle; ENCODERJNI_LOG(logDEBUG) << "Source Handle = " << digitalSourceHandle;
ENCODERJNI_LOG(logDEBUG) << "Analog Trigger Type = " ENCODERJNI_LOG(logDEBUG) << "Analog Trigger Type = " << analogTriggerType;
<< analogTriggerType;
ENCODERJNI_LOG(logDEBUG) << "IndexingType = " << type; ENCODERJNI_LOG(logDEBUG) << "IndexingType = " << type;
int32_t status = 0; int32_t status = 0;
HAL_SetEncoderIndexSource((HAL_EncoderHandle)id, (HAL_Handle)digitalSourceHandle, HAL_SetEncoderIndexSource((HAL_EncoderHandle)id,
(HAL_Handle)digitalSourceHandle,
(HAL_AnalogTriggerType)analogTriggerType, (HAL_AnalogTriggerType)analogTriggerType,
(HAL_EncoderIndexingType)type, &status); (HAL_EncoderIndexingType)type, &status);
ENCODERJNI_LOG(logDEBUG) << "Status = " << status; ENCODERJNI_LOG(logDEBUG) << "Status = " << status;
@@ -362,8 +388,9 @@ Java_edu_wpi_first_wpilibj_hal_EncoderJNI_setEncoderIndexSource(
* Signature: (I)I * Signature: (I)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderFPGAIndex( Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderFPGAIndex
JNIEnv* env, jclass, jint id) { (JNIEnv* env, jclass, jint id)
{
ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncoderSamplesToAverage"; ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncoderSamplesToAverage";
ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id; ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id;
int32_t status = 0; int32_t status = 0;
@@ -381,12 +408,14 @@ Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderFPGAIndex(
* Signature: (I)I * Signature: (I)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderEncodingScale( Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderEncodingScale
JNIEnv* env, jclass, jint id) { (JNIEnv* env, jclass, jint id)
{
ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncoderSamplesToAverage"; ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncoderSamplesToAverage";
ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id; ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id;
int32_t status = 0; int32_t status = 0;
jint returnValue = HAL_GetEncoderEncodingScale((HAL_EncoderHandle)id, &status); jint returnValue =
HAL_GetEncoderEncodingScale((HAL_EncoderHandle)id, &status);
ENCODERJNI_LOG(logDEBUG) << "Status = " << status; ENCODERJNI_LOG(logDEBUG) << "Status = " << status;
ENCODERJNI_LOG(logDEBUG) << "getEncoderSamplesToAverageResult = " ENCODERJNI_LOG(logDEBUG) << "getEncoderSamplesToAverageResult = "
<< returnValue; << returnValue;
@@ -400,12 +429,14 @@ Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderEncodingScale(
* Signature: (I)D * Signature: (I)D
*/ */
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderDecodingScaleFactor( Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderDecodingScaleFactor
JNIEnv* env, jclass, jint id) { (JNIEnv* env, jclass, jint id)
{
ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncoderSamplesToAverage"; ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncoderSamplesToAverage";
ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id; ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id;
int32_t status = 0; int32_t status = 0;
jdouble returnValue = HAL_GetEncoderDecodingScaleFactor((HAL_EncoderHandle)id, &status); jdouble returnValue =
HAL_GetEncoderDecodingScaleFactor((HAL_EncoderHandle)id, &status);
ENCODERJNI_LOG(logDEBUG) << "Status = " << status; ENCODERJNI_LOG(logDEBUG) << "Status = " << status;
ENCODERJNI_LOG(logDEBUG) << "getEncoderSamplesToAverageResult = " ENCODERJNI_LOG(logDEBUG) << "getEncoderSamplesToAverageResult = "
<< returnValue; << returnValue;
@@ -419,12 +450,14 @@ Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderDecodingScaleFactor(
* Signature: (I)D * Signature: (I)D
*/ */
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderDistancePerPulse( Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderDistancePerPulse
JNIEnv* env, jclass, jint id) { (JNIEnv* env, jclass, jint id)
{
ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncoderSamplesToAverage"; ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncoderSamplesToAverage";
ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id; ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id;
int32_t status = 0; int32_t status = 0;
jdouble returnValue = HAL_GetEncoderDistancePerPulse((HAL_EncoderHandle)id, &status); jdouble returnValue =
HAL_GetEncoderDistancePerPulse((HAL_EncoderHandle)id, &status);
ENCODERJNI_LOG(logDEBUG) << "Status = " << status; ENCODERJNI_LOG(logDEBUG) << "Status = " << status;
ENCODERJNI_LOG(logDEBUG) << "getEncoderSamplesToAverageResult = " ENCODERJNI_LOG(logDEBUG) << "getEncoderSamplesToAverageResult = "
<< returnValue; << returnValue;
@@ -438,8 +471,9 @@ Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderDistancePerPulse(
* Signature: (I)I * Signature: (I)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderEncodingType( Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderEncodingType
JNIEnv* env, jclass, jint id) { (JNIEnv* env, jclass, jint id)
{
ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncoderSamplesToAverage"; ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncoderSamplesToAverage";
ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id; ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id;
int32_t status = 0; int32_t status = 0;

View File

@@ -1,21 +1,23 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */ /* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
#include "HAL/HAL.h"
#include <jni.h>
#include <cassert>
#include <cstring> #include <cstring>
#include <assert.h> #include <wpi/jni_util.h>
#include <jni.h>
#include "HAL/cpp/Log.h"
#include "HAL/HAL.h"
#include "HAL/DriverStation.h" #include "HAL/DriverStation.h"
#include "edu_wpi_first_wpilibj_hal_HAL.h" #include "HAL/cpp/Log.h"
#include "HALUtil.h" #include "HALUtil.h"
#include "wpi/jni_util.h" #include "edu_wpi_first_wpilibj_hal_HAL.h"
using namespace frc; using namespace frc;
using namespace wpi::java; using namespace wpi::java;
@@ -27,101 +29,115 @@ static TLogLevel netCommLogLevel = logWARNING;
if (level > netCommLogLevel) \ if (level > netCommLogLevel) \
; \ ; \
else \ else \
Log().Get(level) Log().Get(level)
extern "C" { extern "C" {
/* /*
* Class: edu_wpi_first_wpilibj_hal_HAL * Class: edu_wpi_first_wpilibj_hal_HAL
* Method: Initialize * Method: initialize
* Signature: (Z)II * Signature: (II)Z
*/ */
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_HAL_initialize(JNIEnv*, jclass, jint timeout, jint mode) { Java_edu_wpi_first_wpilibj_hal_HAL_initialize
(JNIEnv*, jclass, jint timeout, jint mode)
{
return HAL_Initialize(timeout, mode); return HAL_Initialize(timeout, mode);
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_HAL * Class: edu_wpi_first_wpilibj_hal_HAL
* Method: observeUserProgramStarting * Method: observeUserProgramStarting
* Signature: ()V * Signature: ()V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_HAL_observeUserProgramStarting(JNIEnv*, jclass) { Java_edu_wpi_first_wpilibj_hal_HAL_observeUserProgramStarting
(JNIEnv*, jclass)
{
HAL_ObserveUserProgramStarting(); HAL_ObserveUserProgramStarting();
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_HAL * Class: edu_wpi_first_wpilibj_hal_HAL
* Method: observeUserProgramDisabled * Method: observeUserProgramDisabled
* Signature: ()V * Signature: ()V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_HAL_observeUserProgramDisabled(JNIEnv*, jclass) { Java_edu_wpi_first_wpilibj_hal_HAL_observeUserProgramDisabled
(JNIEnv*, jclass)
{
HAL_ObserveUserProgramDisabled(); HAL_ObserveUserProgramDisabled();
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_HAL * Class: edu_wpi_first_wpilibj_hal_HAL
* Method: observeUserProgramAutonomous * Method: observeUserProgramAutonomous
* Signature: ()V * Signature: ()V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_HAL_observeUserProgramAutonomous( Java_edu_wpi_first_wpilibj_hal_HAL_observeUserProgramAutonomous
JNIEnv*, jclass) { (JNIEnv*, jclass)
{
HAL_ObserveUserProgramAutonomous(); HAL_ObserveUserProgramAutonomous();
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_HAL * Class: edu_wpi_first_wpilibj_hal_HAL
* Method: observeUserProgramTeleop * Method: observeUserProgramTeleop
* Signature: ()V * Signature: ()V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_HAL_observeUserProgramTeleop(JNIEnv*, jclass) { Java_edu_wpi_first_wpilibj_hal_HAL_observeUserProgramTeleop
(JNIEnv*, jclass)
{
HAL_ObserveUserProgramTeleop(); HAL_ObserveUserProgramTeleop();
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_HAL * Class: edu_wpi_first_wpilibj_hal_HAL
* Method: observeUserProgramTest * Method: observeUserProgramTest
* Signature: ()V * Signature: ()V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_HAL_observeUserProgramTest(JNIEnv*, jclass) { Java_edu_wpi_first_wpilibj_hal_HAL_observeUserProgramTest
(JNIEnv*, jclass)
{
HAL_ObserveUserProgramTest(); HAL_ObserveUserProgramTest();
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_HAL * Class: edu_wpi_first_wpilibj_hal_HAL
* Method: HAL_Report * Method: report
* Signature: (IIILjava/lang/String;)I * Signature: (IIILjava/lang/String;)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_HAL_report( Java_edu_wpi_first_wpilibj_hal_HAL_report
JNIEnv* paramEnv, jclass, jint paramResource, jint paramInstanceNumber, (JNIEnv* paramEnv, jclass, jint paramResource, jint paramInstanceNumber,
jint paramContext, jstring paramFeature) { jint paramContext, jstring paramFeature)
{
JStringRef featureStr{paramEnv, paramFeature}; JStringRef featureStr{paramEnv, paramFeature};
NETCOMM_LOG(logDEBUG) << "Calling HAL report " NETCOMM_LOG(logDEBUG) << "Calling HAL report "
<< "res:" << paramResource << "res:" << paramResource
<< " instance:" << paramInstanceNumber << " instance:" << paramInstanceNumber
<< " context:" << paramContext << " context:" << paramContext
<< " feature:" << featureStr.c_str(); << " feature:" << featureStr.c_str();
jint returnValue = jint returnValue = HAL_Report(paramResource, paramInstanceNumber,
HAL_Report(paramResource, paramInstanceNumber, paramContext, featureStr.c_str()); paramContext, featureStr.c_str());
return returnValue; return returnValue;
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_HAL * Class: edu_wpi_first_wpilibj_hal_HAL
* Method: NativeGetControlWord * Method: nativeGetControlWord
* Signature: ()I * Signature: ()I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_HAL_nativeGetControlWord(JNIEnv*, jclass) { Java_edu_wpi_first_wpilibj_hal_HAL_nativeGetControlWord
(JNIEnv*, jclass)
{
NETCOMM_LOG(logDEBUG) << "Calling HAL Control Word"; NETCOMM_LOG(logDEBUG) << "Calling HAL Control Word";
static_assert(sizeof(HAL_ControlWord) == sizeof(jint), static_assert(sizeof(HAL_ControlWord) == sizeof(jint),
"Java int must match the size of control word"); "Java int must match the size of control word");
HAL_ControlWord controlWord; HAL_ControlWord controlWord;
std::memset(&controlWord, 0, sizeof(HAL_ControlWord)); std::memset(&controlWord, 0, sizeof(HAL_ControlWord));
HAL_GetControlWord(&controlWord); HAL_GetControlWord(&controlWord);
@@ -131,12 +147,14 @@ Java_edu_wpi_first_wpilibj_hal_HAL_nativeGetControlWord(JNIEnv*, jclass) {
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_HAL * Class: edu_wpi_first_wpilibj_hal_HAL
* Method: NativeGetAllianceStation * Method: nativeGetAllianceStation
* Signature: ()I * Signature: ()I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_HAL_nativeGetAllianceStation(JNIEnv*, jclass) { Java_edu_wpi_first_wpilibj_hal_HAL_nativeGetAllianceStation
(JNIEnv*, jclass)
{
NETCOMM_LOG(logDEBUG) << "Calling HAL Alliance Station"; NETCOMM_LOG(logDEBUG) << "Calling HAL Alliance Station";
int32_t status = 0; int32_t status = 0;
auto allianceStation = HAL_GetAllianceStation(&status); auto allianceStation = HAL_GetAllianceStation(&status);
@@ -144,22 +162,22 @@ Java_edu_wpi_first_wpilibj_hal_HAL_nativeGetAllianceStation(JNIEnv*, jclass) {
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_HAL * Class: edu_wpi_first_wpilibj_hal_HAL
* Method: HAL_GetJoystickAxes * Method: getJoystickAxes
* Signature: (B[F)S * Signature: (B[F)S
*/ */
JNIEXPORT jshort JNICALL JNIEXPORT jshort JNICALL
Java_edu_wpi_first_wpilibj_hal_HAL_getJoystickAxes(JNIEnv* env, jclass, Java_edu_wpi_first_wpilibj_hal_HAL_getJoystickAxes
jbyte joystickNum, (JNIEnv* env, jclass, jbyte joystickNum, jfloatArray axesArray)
jfloatArray axesArray) { {
NETCOMM_LOG(logDEBUG) << "Calling HALJoystickAxes"; NETCOMM_LOG(logDEBUG) << "Calling HALJoystickAxes";
HAL_JoystickAxes axes; HAL_JoystickAxes axes;
HAL_GetJoystickAxes(joystickNum, &axes); HAL_GetJoystickAxes(joystickNum, &axes);
jsize javaSize = env->GetArrayLength(axesArray); jsize javaSize = env->GetArrayLength(axesArray);
if (axes.count > javaSize) if (axes.count > javaSize) {
{ ThrowIllegalArgumentException(
ThrowIllegalArgumentException(env, "Native array size larger then passed in java array size"); env, "Native array size larger then passed in java array size");
} }
env->SetFloatArrayRegion(axesArray, 0, axes.count, axes.axes); env->SetFloatArrayRegion(axesArray, 0, axes.count, axes.axes);
@@ -168,22 +186,22 @@ Java_edu_wpi_first_wpilibj_hal_HAL_getJoystickAxes(JNIEnv* env, jclass,
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_HAL * Class: edu_wpi_first_wpilibj_hal_HAL
* Method: HAL_GetJoystickPOVs * Method: getJoystickPOVs
* Signature: (B[S)S * Signature: (B[S)S
*/ */
JNIEXPORT jshort JNICALL JNIEXPORT jshort JNICALL
Java_edu_wpi_first_wpilibj_hal_HAL_getJoystickPOVs(JNIEnv* env, jclass, Java_edu_wpi_first_wpilibj_hal_HAL_getJoystickPOVs
jbyte joystickNum, (JNIEnv* env, jclass, jbyte joystickNum, jshortArray povsArray)
jshortArray povsArray) { {
NETCOMM_LOG(logDEBUG) << "Calling HALJoystickPOVs"; NETCOMM_LOG(logDEBUG) << "Calling HALJoystickPOVs";
HAL_JoystickPOVs povs; HAL_JoystickPOVs povs;
HAL_GetJoystickPOVs(joystickNum, &povs); HAL_GetJoystickPOVs(joystickNum, &povs);
jsize javaSize = env->GetArrayLength(povsArray); jsize javaSize = env->GetArrayLength(povsArray);
if (povs.count > javaSize) if (povs.count > javaSize) {
{ ThrowIllegalArgumentException(
ThrowIllegalArgumentException(env, "Native array size larger then passed in java array size"); env, "Native array size larger then passed in java array size");
} }
env->SetShortArrayRegion(povsArray, 0, povs.count, povs.povs); env->SetShortArrayRegion(povsArray, 0, povs.count, povs.povs);
@@ -192,18 +210,19 @@ Java_edu_wpi_first_wpilibj_hal_HAL_getJoystickPOVs(JNIEnv* env, jclass,
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_HAL * Class: edu_wpi_first_wpilibj_hal_HAL
* Method: HAL_GetJoystickButtons * Method: getJoystickButtons
* Signature: (BL)I * Signature: (BLjava/lang/Object;)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_HAL_getJoystickButtons(JNIEnv* env, jclass, Java_edu_wpi_first_wpilibj_hal_HAL_getJoystickButtons
jbyte joystickNum, (JNIEnv* env, jclass, jbyte joystickNum, jobject count)
jobject count) { {
NETCOMM_LOG(logDEBUG) << "Calling HALJoystickButtons"; NETCOMM_LOG(logDEBUG) << "Calling HALJoystickButtons";
HAL_JoystickButtons joystickButtons; HAL_JoystickButtons joystickButtons;
HAL_GetJoystickButtons(joystickNum, &joystickButtons); HAL_GetJoystickButtons(joystickNum, &joystickButtons);
jbyte *countPtr = (jbyte *)env->GetDirectBufferAddress(count); jbyte* countPtr =
reinterpret_cast<jbyte*>(env->GetDirectBufferAddress(count));
NETCOMM_LOG(logDEBUG) << "Buttons = " << joystickButtons.buttons; NETCOMM_LOG(logDEBUG) << "Buttons = " << joystickButtons.buttons;
NETCOMM_LOG(logDEBUG) << "Count = " << (jint)joystickButtons.count; NETCOMM_LOG(logDEBUG) << "Count = " << (jint)joystickButtons.count;
*countPtr = joystickButtons.count; *countPtr = joystickButtons.count;
@@ -212,15 +231,15 @@ Java_edu_wpi_first_wpilibj_hal_HAL_getJoystickButtons(JNIEnv* env, jclass,
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_HAL * Class: edu_wpi_first_wpilibj_hal_HAL
* Method: HAL_SetJoystickOutputs * Method: setJoystickOutputs
* Signature: (BISS)I * Signature: (BISS)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_HAL_setJoystickOutputs(JNIEnv*, jclass, Java_edu_wpi_first_wpilibj_hal_HAL_setJoystickOutputs
jbyte port, jint outputs, (JNIEnv*, jclass, jbyte port, jint outputs, jshort leftRumble,
jshort leftRumble, jshort rightRumble)
jshort rightRumble) { {
NETCOMM_LOG(logDEBUG) << "Calling HAL_SetJoystickOutputs on port " << port; NETCOMM_LOG(logDEBUG) << "Calling HAL_SetJoystickOutputs on port " << port;
NETCOMM_LOG(logDEBUG) << "Outputs: " << outputs; NETCOMM_LOG(logDEBUG) << "Outputs: " << outputs;
NETCOMM_LOG(logDEBUG) << "Left Rumble: " << leftRumble NETCOMM_LOG(logDEBUG) << "Left Rumble: " << leftRumble
@@ -229,53 +248,56 @@ Java_edu_wpi_first_wpilibj_hal_HAL_setJoystickOutputs(JNIEnv*, jclass,
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_HAL * Class: edu_wpi_first_wpilibj_hal_HAL
* Method: HAL_GetJoystickIsXbox * Method: getJoystickIsXbox
* Signature: (B)I * Signature: (B)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_HAL_getJoystickIsXbox(JNIEnv*, jclass, Java_edu_wpi_first_wpilibj_hal_HAL_getJoystickIsXbox
jbyte port) { (JNIEnv*, jclass, jbyte port)
{
NETCOMM_LOG(logDEBUG) << "Calling HAL_GetJoystickIsXbox"; NETCOMM_LOG(logDEBUG) << "Calling HAL_GetJoystickIsXbox";
return HAL_GetJoystickIsXbox(port); return HAL_GetJoystickIsXbox(port);
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_HAL * Class: edu_wpi_first_wpilibj_hal_HAL
* Method: HAL_GetJoystickType * Method: getJoystickType
* Signature: (B)I * Signature: (B)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_HAL_getJoystickType(JNIEnv*, jclass, Java_edu_wpi_first_wpilibj_hal_HAL_getJoystickType
jbyte port) { (JNIEnv*, jclass, jbyte port)
{
NETCOMM_LOG(logDEBUG) << "Calling HAL_GetJoystickType"; NETCOMM_LOG(logDEBUG) << "Calling HAL_GetJoystickType";
return HAL_GetJoystickType(port); return HAL_GetJoystickType(port);
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_HAL * Class: edu_wpi_first_wpilibj_hal_HAL
* Method: HAL_GetJoystickName * Method: getJoystickName
* Signature: (B)Ljava/lang/String; * Signature: (B)Ljava/lang/String;
*/ */
JNIEXPORT jstring JNICALL JNIEXPORT jstring JNICALL
Java_edu_wpi_first_wpilibj_hal_HAL_getJoystickName(JNIEnv* env, jclass, Java_edu_wpi_first_wpilibj_hal_HAL_getJoystickName
jbyte port) { (JNIEnv* env, jclass, jbyte port)
{
NETCOMM_LOG(logDEBUG) << "Calling HAL_GetJoystickName"; NETCOMM_LOG(logDEBUG) << "Calling HAL_GetJoystickName";
char *joystickName = HAL_GetJoystickName(port); char* joystickName = HAL_GetJoystickName(port);
jstring str = MakeJString(env, joystickName); jstring str = MakeJString(env, joystickName);
HAL_FreeJoystickName(joystickName); HAL_FreeJoystickName(joystickName);
return str; return str;
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_HAL * Class: edu_wpi_first_wpilibj_hal_HAL
* Method: HAL_GetJoystickAxisType * Method: getJoystickAxisType
* Signature: (BB)I * Signature: (BB)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_HAL_getJoystickAxisType(JNIEnv*, jclass, Java_edu_wpi_first_wpilibj_hal_HAL_getJoystickAxisType
jbyte joystickNum, (JNIEnv*, jclass, jbyte joystickNum, jbyte axis)
jbyte axis) { {
NETCOMM_LOG(logDEBUG) << "Calling HAL_GetJoystickAxisType"; NETCOMM_LOG(logDEBUG) << "Calling HAL_GetJoystickAxisType";
return HAL_GetJoystickAxisType(joystickNum, axis); return HAL_GetJoystickAxisType(joystickNum, axis);
} }
@@ -286,27 +308,33 @@ Java_edu_wpi_first_wpilibj_hal_HAL_getJoystickAxisType(JNIEnv*, jclass,
* Signature: ()Z * Signature: ()Z
*/ */
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_HAL_isNewControlData(JNIEnv *, jclass) { Java_edu_wpi_first_wpilibj_hal_HAL_isNewControlData
(JNIEnv*, jclass)
{
return static_cast<jboolean>(HAL_IsNewControlData()); return static_cast<jboolean>(HAL_IsNewControlData());
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_HAL * Class: edu_wpi_first_wpilibj_hal_HAL
* Method: waitForDSData * Method: waitForDSData
* Signature: ()V * Signature: ()V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_HAL_waitForDSData(JNIEnv* env, jclass) { Java_edu_wpi_first_wpilibj_hal_HAL_waitForDSData
(JNIEnv* env, jclass)
{
HAL_WaitForDSData(); HAL_WaitForDSData();
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_HAL * Class: edu_wpi_first_wpilibj_hal_HAL
* Method: releaseDSMutex * Method: releaseDSMutex
* Signature: ()V * Signature: ()V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_HAL_releaseDSMutex(JNIEnv* env, jclass) { Java_edu_wpi_first_wpilibj_hal_HAL_releaseDSMutex
(JNIEnv* env, jclass)
{
HAL_ReleaseDSMutex(); HAL_ReleaseDSMutex();
} }
@@ -316,29 +344,34 @@ Java_edu_wpi_first_wpilibj_hal_HAL_releaseDSMutex(JNIEnv* env, jclass) {
* Signature: (D)Z * Signature: (D)Z
*/ */
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_HAL_waitForDSDataTimeout(JNIEnv *, jclass, Java_edu_wpi_first_wpilibj_hal_HAL_waitForDSDataTimeout
jdouble timeout) { (JNIEnv*, jclass, jdouble timeout)
{
return static_cast<jboolean>(HAL_WaitForDSDataTimeout(timeout)); return static_cast<jboolean>(HAL_WaitForDSDataTimeout(timeout));
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_HAL * Class: edu_wpi_first_wpilibj_hal_HAL
* Method: HAL_GetMatchTime * Method: getMatchTime
* Signature: ()D * Signature: ()D
*/ */
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_wpilibj_hal_HAL_getMatchTime(JNIEnv* env, jclass) { Java_edu_wpi_first_wpilibj_hal_HAL_getMatchTime
(JNIEnv* env, jclass)
{
int32_t status = 0; int32_t status = 0;
return HAL_GetMatchTime(&status); return HAL_GetMatchTime(&status);
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_HAL * Class: edu_wpi_first_wpilibj_hal_HAL
* Method: HAL_GetSystemActive * Method: getSystemActive
* Signature: ()Z * Signature: ()Z
*/ */
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_HAL_getSystemActive(JNIEnv* env, jclass) { Java_edu_wpi_first_wpilibj_hal_HAL_getSystemActive
(JNIEnv* env, jclass)
{
int32_t status = 0; int32_t status = 0;
bool val = HAL_GetSystemActive(&status); bool val = HAL_GetSystemActive(&status);
CheckStatus(env, status); CheckStatus(env, status);
@@ -346,12 +379,14 @@ Java_edu_wpi_first_wpilibj_hal_HAL_getSystemActive(JNIEnv* env, jclass) {
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_HAL * Class: edu_wpi_first_wpilibj_hal_HAL
* Method: HAL_GetBrownedOut * Method: getBrownedOut
* Signature: ()Z * Signature: ()Z
*/ */
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_HAL_getBrownedOut(JNIEnv* env, jclass) { Java_edu_wpi_first_wpilibj_hal_HAL_getBrownedOut
(JNIEnv* env, jclass)
{
int32_t status = 0; int32_t status = 0;
bool val = HAL_GetBrownedOut(&status); bool val = HAL_GetBrownedOut(&status);
CheckStatus(env, status); CheckStatus(env, status);
@@ -361,11 +396,12 @@ Java_edu_wpi_first_wpilibj_hal_HAL_getBrownedOut(JNIEnv* env, jclass) {
/* /*
* Class: edu_wpi_first_wpilibj_hal_HAL * Class: edu_wpi_first_wpilibj_hal_HAL
* Method: getMatchInfo * Method: getMatchInfo
* Signature: (Ledu/wpi/first/wpilibj/hal/MatchInfoData;)I * Signature: (Ljava/lang/Object;)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_HAL_getMatchInfo Java_edu_wpi_first_wpilibj_hal_HAL_getMatchInfo
(JNIEnv * env, jclass, jobject info) { (JNIEnv* env, jclass, jobject info)
{
HAL_MatchInfo matchInfo; HAL_MatchInfo matchInfo;
auto status = HAL_GetMatchInfo(&matchInfo); auto status = HAL_GetMatchInfo(&matchInfo);
if (status == 0) { if (status == 0) {
@@ -376,17 +412,15 @@ Java_edu_wpi_first_wpilibj_hal_HAL_getMatchInfo
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_HAL * Class: edu_wpi_first_wpilibj_hal_HAL
* Method: HAL_SendError * Method: sendError
* Signature: (ZIZLjava/lang/String;Ljava/lang/String;Ljava/lang/String;Z)I * Signature: (ZIZLjava/lang/String;Ljava/lang/String;Ljava/lang/String;Z)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_HAL_sendError(JNIEnv* env, jclass, Java_edu_wpi_first_wpilibj_hal_HAL_sendError
jboolean isError, jint errorCode, (JNIEnv* env, jclass, jboolean isError, jint errorCode, jboolean isLVCode,
jboolean isLVCode, jstring details, jstring details, jstring location, jstring callStack, jboolean printMsg)
jstring location, {
jstring callStack,
jboolean printMsg) {
JStringRef detailsStr{env, details}; JStringRef detailsStr{env, details};
JStringRef locationStr{env, location}; JStringRef locationStr{env, location};
JStringRef callStackStr{env, callStack}; JStringRef callStackStr{env, callStack};
@@ -394,8 +428,9 @@ Java_edu_wpi_first_wpilibj_hal_HAL_sendError(JNIEnv* env, jclass,
NETCOMM_LOG(logDEBUG) << "Send Error: " << detailsStr.c_str(); NETCOMM_LOG(logDEBUG) << "Send Error: " << detailsStr.c_str();
NETCOMM_LOG(logDEBUG) << "Location: " << locationStr.c_str(); NETCOMM_LOG(logDEBUG) << "Location: " << locationStr.c_str();
NETCOMM_LOG(logDEBUG) << "Call Stack: " << callStackStr.c_str(); NETCOMM_LOG(logDEBUG) << "Call Stack: " << callStackStr.c_str();
jint returnValue = HAL_SendError(isError, errorCode, isLVCode, detailsStr.c_str(), jint returnValue =
locationStr.c_str(), callStackStr.c_str(), printMsg); HAL_SendError(isError, errorCode, isLVCode, detailsStr.c_str(),
locationStr.c_str(), callStackStr.c_str(), printMsg);
return returnValue; return returnValue;
} }
@@ -405,8 +440,9 @@ Java_edu_wpi_first_wpilibj_hal_HAL_sendError(JNIEnv* env, jclass,
* Signature: (BB)I * Signature: (BB)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_HAL_getPortWithModule( Java_edu_wpi_first_wpilibj_hal_HAL_getPortWithModule
JNIEnv* env, jclass, jbyte module, jbyte channel) { (JNIEnv* env, jclass, jbyte module, jbyte channel)
{
// FILE_LOG(logDEBUG) << "Calling HAL getPortWithModlue"; // FILE_LOG(logDEBUG) << "Calling HAL getPortWithModlue";
// FILE_LOG(logDEBUG) << "Module = " << (jint)module; // FILE_LOG(logDEBUG) << "Module = " << (jint)module;
// FILE_LOG(logDEBUG) << "Channel = " << (jint)channel; // FILE_LOG(logDEBUG) << "Channel = " << (jint)channel;
@@ -420,8 +456,10 @@ Java_edu_wpi_first_wpilibj_hal_HAL_getPortWithModule(
* Method: getPort * Method: getPort
* Signature: (B)I * Signature: (B)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_HAL_getPort( JNIEXPORT jint JNICALL
JNIEnv* env, jclass, jbyte channel) { Java_edu_wpi_first_wpilibj_hal_HAL_getPort
(JNIEnv* env, jclass, jbyte channel)
{
// FILE_LOG(logDEBUG) << "Calling HAL getPortWithModlue"; // FILE_LOG(logDEBUG) << "Calling HAL getPortWithModlue";
// FILE_LOG(logDEBUG) << "Module = " << (jint)module; // FILE_LOG(logDEBUG) << "Module = " << (jint)module;
// FILE_LOG(logDEBUG) << "Channel = " << (jint)channel; // FILE_LOG(logDEBUG) << "Channel = " << (jint)channel;

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */ /* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */
@@ -7,23 +7,24 @@
#include "HALUtil.h" #include "HALUtil.h"
#include <assert.h>
#include <errno.h>
#include <jni.h> #include <jni.h>
#include <cassert>
#include <cerrno>
#include <cstdio> #include <cstdio>
#include <cstring> #include <cstring>
#include <string> #include <string>
#include <wpi/SmallString.h>
#include <wpi/jni_util.h>
#include <wpi/raw_ostream.h>
#include "HAL/CAN.h" #include "HAL/CAN.h"
#include "HAL/HAL.h"
#include "HAL/DriverStation.h" #include "HAL/DriverStation.h"
#include "HAL/Errors.h" #include "HAL/Errors.h"
#include "HAL/HAL.h"
#include "HAL/cpp/Log.h" #include "HAL/cpp/Log.h"
#include "edu_wpi_first_wpilibj_hal_HALUtil.h" #include "edu_wpi_first_wpilibj_hal_HALUtil.h"
#include "wpi/SmallString.h"
#include "wpi/jni_util.h"
#include "wpi/raw_ostream.h"
using namespace wpi::java; using namespace wpi::java;
@@ -34,7 +35,7 @@ TLogLevel halUtilLogLevel = logWARNING;
if (level > halUtilLogLevel) \ if (level > halUtilLogLevel) \
; \ ; \
else \ else \
Log().Get(level) Log().Get(level)
#define kRioStatusOffset -63000 #define kRioStatusOffset -63000
#define kRioStatusSuccess 0 #define kRioStatusSuccess 0
@@ -43,7 +44,7 @@ TLogLevel halUtilLogLevel = logWARNING;
#define kRIOStatusFeatureNotSupported (kRioStatusOffset - 193) #define kRIOStatusFeatureNotSupported (kRioStatusOffset - 193)
#define kRIOStatusResourceNotInitialized -52010 #define kRIOStatusResourceNotInitialized -52010
static JavaVM *jvm = nullptr; static JavaVM* jvm = nullptr;
static JException runtimeExCls; static JException runtimeExCls;
static JException illegalArgExCls; static JException illegalArgExCls;
static JException boundaryExCls; static JException boundaryExCls;
@@ -61,32 +62,32 @@ static JClass accumulatorResultCls;
namespace frc { namespace frc {
void ThrowAllocationException(JNIEnv *env, int32_t minRange, int32_t maxRange, void ThrowAllocationException(JNIEnv* env, int32_t minRange, int32_t maxRange,
int32_t requestedValue, int32_t status) { int32_t requestedValue, int32_t status) {
const char *message = HAL_GetErrorMessage(status); const char* message = HAL_GetErrorMessage(status);
wpi::SmallString<1024> buf; wpi::SmallString<1024> buf;
wpi::raw_svector_ostream oss(buf); wpi::raw_svector_ostream oss(buf);
oss << " Code: " << status << ". " << message << ", Minimum Value: " oss << " Code: " << status << ". " << message
<< minRange << ", Maximum Value: " << maxRange << ", Requested Value: " << ", Minimum Value: " << minRange << ", Maximum Value: " << maxRange
<< requestedValue; << ", Requested Value: " << requestedValue;
env->ThrowNew(allocationExCls, buf.c_str()); env->ThrowNew(allocationExCls, buf.c_str());
allocationExCls.Throw(env, buf.c_str()); allocationExCls.Throw(env, buf.c_str());
} }
void ThrowHalHandleException(JNIEnv *env, int32_t status) { void ThrowHalHandleException(JNIEnv* env, int32_t status) {
const char *message = HAL_GetErrorMessage(status); const char* message = HAL_GetErrorMessage(status);
wpi::SmallString<1024> buf; wpi::SmallString<1024> buf;
wpi::raw_svector_ostream oss(buf); wpi::raw_svector_ostream oss(buf);
oss << " Code: " << status << ". " << message; oss << " Code: " << status << ". " << message;
halHandleExCls.Throw(env, buf.c_str()); halHandleExCls.Throw(env, buf.c_str());
} }
void ReportError(JNIEnv *env, int32_t status, bool doThrow) { void ReportError(JNIEnv* env, int32_t status, bool doThrow) {
if (status == 0) return; if (status == 0) return;
if (status == HAL_HANDLE_ERROR) { if (status == HAL_HANDLE_ERROR) {
ThrowHalHandleException(env, status); ThrowHalHandleException(env, status);
} }
const char *message = HAL_GetErrorMessage(status); const char* message = HAL_GetErrorMessage(status);
if (doThrow && status < 0) { if (doThrow && status < 0) {
wpi::SmallString<1024> buf; wpi::SmallString<1024> buf;
wpi::raw_svector_ostream oss(buf); wpi::raw_svector_ostream oss(buf);
@@ -99,25 +100,24 @@ void ReportError(JNIEnv *env, int32_t status, bool doThrow) {
} }
} }
void ThrowError(JNIEnv *env, int32_t status, int32_t minRange, int32_t maxRange, void ThrowError(JNIEnv* env, int32_t status, int32_t minRange, int32_t maxRange,
int32_t requestedValue) { int32_t requestedValue) {
if (status == 0) return; if (status == 0) return;
if (status == NO_AVAILABLE_RESOURCES || if (status == NO_AVAILABLE_RESOURCES || status == RESOURCE_IS_ALLOCATED ||
status == RESOURCE_IS_ALLOCATED ||
status == RESOURCE_OUT_OF_RANGE) { status == RESOURCE_OUT_OF_RANGE) {
ThrowAllocationException(env, minRange, maxRange, requestedValue, status); ThrowAllocationException(env, minRange, maxRange, requestedValue, status);
} }
if (status == HAL_HANDLE_ERROR) { if (status == HAL_HANDLE_ERROR) {
ThrowHalHandleException(env, status); ThrowHalHandleException(env, status);
} }
const char *message = HAL_GetErrorMessage(status); const char* message = HAL_GetErrorMessage(status);
wpi::SmallString<1024> buf; wpi::SmallString<1024> buf;
wpi::raw_svector_ostream oss(buf); wpi::raw_svector_ostream oss(buf);
oss << " Code: " << status << ". " << message; oss << " Code: " << status << ". " << message;
runtimeExCls.Throw(env, buf.c_str()); runtimeExCls.Throw(env, buf.c_str());
} }
void ReportCANError(JNIEnv *env, int32_t status, int message_id) { void ReportCANError(JNIEnv* env, int32_t status, int message_id) {
if (status >= 0) return; if (status >= 0) return;
switch (status) { switch (status) {
case kRioStatusSuccess: case kRioStatusSuccess:
@@ -174,11 +174,11 @@ void ReportCANError(JNIEnv *env, int32_t status, int message_id) {
} }
} }
void ThrowIllegalArgumentException(JNIEnv *env, const char *msg) { void ThrowIllegalArgumentException(JNIEnv* env, const char* msg) {
illegalArgExCls.Throw(env, msg); illegalArgExCls.Throw(env, msg);
} }
void ThrowBoundaryException(JNIEnv *env, double value, double lower, void ThrowBoundaryException(JNIEnv* env, double value, double lower,
double upper) { double upper) {
static jmethodID getMessage = nullptr; static jmethodID getMessage = nullptr;
if (!getMessage) if (!getMessage)
@@ -190,69 +190,61 @@ void ThrowBoundaryException(JNIEnv *env, double value, double lower,
constructor = constructor =
env->GetMethodID(boundaryExCls, "<init>", "(Ljava/lang/String;)V"); env->GetMethodID(boundaryExCls, "<init>", "(Ljava/lang/String;)V");
jobject msg = jobject msg = env->CallStaticObjectMethod(
env->CallStaticObjectMethod(boundaryExCls, getMessage, boundaryExCls, getMessage, static_cast<jdouble>(value),
static_cast<jdouble>(value), static_cast<jdouble>(lower), static_cast<jdouble>(upper));
static_cast<jdouble>(lower),
static_cast<jdouble>(upper));
jobject ex = env->NewObject(boundaryExCls, constructor, msg); jobject ex = env->NewObject(boundaryExCls, constructor, msg);
env->Throw(static_cast<jthrowable>(ex)); env->Throw(static_cast<jthrowable>(ex));
} }
jobject CreatePWMConfigDataResult(JNIEnv *env, int32_t maxPwm, jobject CreatePWMConfigDataResult(JNIEnv* env, int32_t maxPwm,
int32_t deadbandMaxPwm, int32_t centerPwm, int32_t deadbandMaxPwm, int32_t centerPwm,
int32_t deadbandMinPwm, int32_t minPwm) { int32_t deadbandMinPwm, int32_t minPwm) {
static jmethodID constructor = static jmethodID constructor =
env->GetMethodID(pwmConfigDataResultCls, "<init>", env->GetMethodID(pwmConfigDataResultCls, "<init>", "(IIIII)V");
"(IIIII)V");
return env->NewObject(pwmConfigDataResultCls, constructor, maxPwm, return env->NewObject(pwmConfigDataResultCls, constructor, maxPwm,
deadbandMaxPwm, centerPwm, deadbandMinPwm, deadbandMaxPwm, centerPwm, deadbandMinPwm, minPwm);
minPwm);
} }
void SetCanStatusObject(JNIEnv *env, jobject canStatus, void SetCanStatusObject(JNIEnv* env, jobject canStatus,
float percentBusUtilization, float percentBusUtilization, uint32_t busOffCount,
uint32_t busOffCount, uint32_t txFullCount, uint32_t txFullCount, uint32_t receiveErrorCount,
uint32_t receiveErrorCount,
uint32_t transmitErrorCount) { uint32_t transmitErrorCount) {
static jmethodID func = env->GetMethodID(canStatusCls, "setStatus", static jmethodID func =
"(DIIII)V"); env->GetMethodID(canStatusCls, "setStatus", "(DIIII)V");
env->CallVoidMethod(canStatus, func, (jdouble)percentBusUtilization, env->CallVoidMethod(canStatus, func, (jdouble)percentBusUtilization,
(jint)busOffCount, (jint)txFullCount, (jint)busOffCount, (jint)txFullCount,
(jint)receiveErrorCount, (jint)transmitErrorCount); (jint)receiveErrorCount, (jint)transmitErrorCount);
} }
void SetMatchInfoObject(JNIEnv* env, jobject matchStatus, void SetMatchInfoObject(JNIEnv* env, jobject matchStatus,
const HAL_MatchInfo& matchInfo) { const HAL_MatchInfo& matchInfo) {
static jmethodID func = env->GetMethodID(matchInfoDataCls, "setData", static jmethodID func =
"(Ljava/lang/String;Ljava/lang/String;III)V"); env->GetMethodID(matchInfoDataCls, "setData",
"(Ljava/lang/String;Ljava/lang/String;III)V");
env->CallVoidMethod(matchStatus, func, env->CallVoidMethod(matchStatus, func, MakeJString(env, matchInfo.eventName),
MakeJString(env, matchInfo.eventName), MakeJString(env, matchInfo.gameSpecificMessage),
MakeJString(env, matchInfo.gameSpecificMessage), (jint)matchInfo.matchNumber, (jint)matchInfo.replayNumber,
(jint)matchInfo.matchNumber, (jint)matchInfo.matchType);
(jint)matchInfo.replayNumber,
(jint)matchInfo.matchType);
} }
void SetAccumulatorResultObject(JNIEnv* env, jobject accumulatorResult, void SetAccumulatorResultObject(JNIEnv* env, jobject accumulatorResult,
int64_t value, int64_t count) { int64_t value, int64_t count) {
static jmethodID func = env->GetMethodID(accumulatorResultCls, "set", static jmethodID func =
"(JJ)V"); env->GetMethodID(accumulatorResultCls, "set", "(JJ)V");
env->CallVoidMethod(accumulatorResult, func, (jlong)value, (jlong)count); env->CallVoidMethod(accumulatorResult, func, (jlong)value, (jlong)count);
} }
JavaVM* GetJVM() { JavaVM* GetJVM() { return jvm; }
return jvm;
}
} // namespace frc } // namespace frc
namespace sim { namespace sim {
jint SimOnLoad(JavaVM* vm, void* reserved); jint SimOnLoad(JavaVM* vm, void* reserved);
void SimOnUnload(JavaVM* vm, void* reserved); void SimOnUnload(JavaVM* vm, void* reserved);
} } // namespace sim
using namespace frc; using namespace frc;
@@ -261,14 +253,14 @@ extern "C" {
// //
// indicate JNI version support desired and load classes // indicate JNI version support desired and load classes
// //
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved) {
jvm = vm; jvm = vm;
// set our logging level // set our logging level
Log::ReportingLevel() = logDEBUG; Log::ReportingLevel() = logDEBUG;
JNIEnv *env; JNIEnv* env;
if (vm->GetEnv(reinterpret_cast<void **>(&env), JNI_VERSION_1_6) != JNI_OK) if (vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6) != JNI_OK)
return JNI_ERR; return JNI_ERR;
runtimeExCls = JException(env, "java/lang/RuntimeException"); runtimeExCls = JException(env, "java/lang/RuntimeException");
@@ -277,31 +269,40 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) {
illegalArgExCls = JException(env, "java/lang/IllegalArgumentException"); illegalArgExCls = JException(env, "java/lang/IllegalArgumentException");
if (!illegalArgExCls) return JNI_ERR; if (!illegalArgExCls) return JNI_ERR;
boundaryExCls = JException(env, "edu/wpi/first/wpilibj/util/BoundaryException"); boundaryExCls =
JException(env, "edu/wpi/first/wpilibj/util/BoundaryException");
if (!boundaryExCls) return JNI_ERR; if (!boundaryExCls) return JNI_ERR;
allocationExCls = JException(env, "edu/wpi/first/wpilibj/util/AllocationException"); allocationExCls =
JException(env, "edu/wpi/first/wpilibj/util/AllocationException");
if (!allocationExCls) return JNI_ERR; if (!allocationExCls) return JNI_ERR;
halHandleExCls = JException(env, "edu/wpi/first/wpilibj/util/HalHandleException"); halHandleExCls =
JException(env, "edu/wpi/first/wpilibj/util/HalHandleException");
if (!halHandleExCls) return JNI_ERR; if (!halHandleExCls) return JNI_ERR;
canInvalidBufferExCls = JException(env, "edu/wpi/first/wpilibj/can/CANInvalidBufferException"); canInvalidBufferExCls =
JException(env, "edu/wpi/first/wpilibj/can/CANInvalidBufferException");
if (!canInvalidBufferExCls) return JNI_ERR; if (!canInvalidBufferExCls) return JNI_ERR;
canMessageNotFoundExCls = JException(env, "edu/wpi/first/wpilibj/can/CANMessageNotFoundException"); canMessageNotFoundExCls =
JException(env, "edu/wpi/first/wpilibj/can/CANMessageNotFoundException");
if (!canMessageNotFoundExCls) return JNI_ERR; if (!canMessageNotFoundExCls) return JNI_ERR;
canMessageNotAllowedExCls = JException(env, "edu/wpi/first/wpilibj/can/CANMessageNotAllowedException"); canMessageNotAllowedExCls = JException(
env, "edu/wpi/first/wpilibj/can/CANMessageNotAllowedException");
if (!canMessageNotAllowedExCls) return JNI_ERR; if (!canMessageNotAllowedExCls) return JNI_ERR;
canNotInitializedExCls = JException(env, "edu/wpi/first/wpilibj/can/CANNotInitializedException"); canNotInitializedExCls =
JException(env, "edu/wpi/first/wpilibj/can/CANNotInitializedException");
if (!canNotInitializedExCls) return JNI_ERR; if (!canNotInitializedExCls) return JNI_ERR;
uncleanStatusExCls = JException(env,"edu/wpi/first/wpilibj/util/UncleanStatusException"); uncleanStatusExCls =
JException(env, "edu/wpi/first/wpilibj/util/UncleanStatusException");
if (!uncleanStatusExCls) return JNI_ERR; if (!uncleanStatusExCls) return JNI_ERR;
pwmConfigDataResultCls = JClass(env, "edu/wpi/first/wpilibj/PWMConfigDataResult"); pwmConfigDataResultCls =
JClass(env, "edu/wpi/first/wpilibj/PWMConfigDataResult");
if (!pwmConfigDataResultCls) return JNI_ERR; if (!pwmConfigDataResultCls) return JNI_ERR;
canStatusCls = JClass(env, "edu/wpi/first/wpilibj/can/CANStatus"); canStatusCls = JClass(env, "edu/wpi/first/wpilibj/can/CANStatus");
@@ -316,11 +317,11 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) {
return sim::SimOnLoad(vm, reserved); return sim::SimOnLoad(vm, reserved);
} }
JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *vm, void *reserved) { JNIEXPORT void JNICALL JNI_OnUnload(JavaVM* vm, void* reserved) {
sim::SimOnUnload(vm, reserved); sim::SimOnUnload(vm, reserved);
JNIEnv *env; JNIEnv* env;
if (vm->GetEnv(reinterpret_cast<void **>(&env), JNI_VERSION_1_6) != JNI_OK) if (vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6) != JNI_OK)
return; return;
// Delete global references // Delete global references
runtimeExCls.free(env); runtimeExCls.free(env);
@@ -346,7 +347,9 @@ JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *vm, void *reserved) {
* Signature: ()S * Signature: ()S
*/ */
JNIEXPORT jshort JNICALL JNIEXPORT jshort JNICALL
Java_edu_wpi_first_wpilibj_hal_HALUtil_getFPGAVersion(JNIEnv *env, jclass) { Java_edu_wpi_first_wpilibj_hal_HALUtil_getFPGAVersion
(JNIEnv* env, jclass)
{
HALUTIL_LOG(logDEBUG) << "Calling HALUtil getFPGAVersion"; HALUTIL_LOG(logDEBUG) << "Calling HALUtil getFPGAVersion";
int32_t status = 0; int32_t status = 0;
jshort returnValue = HAL_GetFPGAVersion(&status); jshort returnValue = HAL_GetFPGAVersion(&status);
@@ -362,7 +365,9 @@ Java_edu_wpi_first_wpilibj_hal_HALUtil_getFPGAVersion(JNIEnv *env, jclass) {
* Signature: ()I * Signature: ()I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_HALUtil_getFPGARevision(JNIEnv *env, jclass) { Java_edu_wpi_first_wpilibj_hal_HALUtil_getFPGARevision
(JNIEnv* env, jclass)
{
HALUTIL_LOG(logDEBUG) << "Calling HALUtil getFPGARevision"; HALUTIL_LOG(logDEBUG) << "Calling HALUtil getFPGARevision";
int32_t status = 0; int32_t status = 0;
jint returnValue = HAL_GetFPGARevision(&status); jint returnValue = HAL_GetFPGARevision(&status);
@@ -378,7 +383,9 @@ Java_edu_wpi_first_wpilibj_hal_HALUtil_getFPGARevision(JNIEnv *env, jclass) {
* Signature: ()J * Signature: ()J
*/ */
JNIEXPORT jlong JNICALL JNIEXPORT jlong JNICALL
Java_edu_wpi_first_wpilibj_hal_HALUtil_getFPGATime(JNIEnv *env, jclass) { Java_edu_wpi_first_wpilibj_hal_HALUtil_getFPGATime
(JNIEnv* env, jclass)
{
// HALUTIL_LOG(logDEBUG) << "Calling HALUtil getFPGATime"; // HALUTIL_LOG(logDEBUG) << "Calling HALUtil getFPGATime";
int32_t status = 0; int32_t status = 0;
jlong returnValue = HAL_GetFPGATime(&status); jlong returnValue = HAL_GetFPGATime(&status);
@@ -394,7 +401,9 @@ Java_edu_wpi_first_wpilibj_hal_HALUtil_getFPGATime(JNIEnv *env, jclass) {
* Signature: ()I * Signature: ()I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_HALUtil_getHALRuntimeType(JNIEnv *env, jclass) { Java_edu_wpi_first_wpilibj_hal_HALUtil_getHALRuntimeType
(JNIEnv* env, jclass)
{
// HALUTIL_LOG(logDEBUG) << "Calling HALUtil getHALRuntimeType"; // HALUTIL_LOG(logDEBUG) << "Calling HALUtil getHALRuntimeType";
jint returnValue = HAL_GetRuntimeType(); jint returnValue = HAL_GetRuntimeType();
// HALUTIL_LOG(logDEBUG) << "RuntimeType = " << returnValue; // HALUTIL_LOG(logDEBUG) << "RuntimeType = " << returnValue;
@@ -404,10 +413,12 @@ Java_edu_wpi_first_wpilibj_hal_HALUtil_getHALRuntimeType(JNIEnv *env, jclass) {
/* /*
* Class: edu_wpi_first_wpilibj_hal_HALUtil * Class: edu_wpi_first_wpilibj_hal_HALUtil
* Method: getFPGAButton * Method: getFPGAButton
* Signature: ()I * Signature: ()Z
*/ */
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_HALUtil_getFPGAButton(JNIEnv *env, jclass) { Java_edu_wpi_first_wpilibj_hal_HALUtil_getFPGAButton
(JNIEnv* env, jclass)
{
// HALUTIL_LOG(logDEBUG) << "Calling HALUtil getFPGATime"; // HALUTIL_LOG(logDEBUG) << "Calling HALUtil getFPGATime";
int32_t status = 0; int32_t status = 0;
jboolean returnValue = HAL_GetFPGAButton(&status); jboolean returnValue = HAL_GetFPGAButton(&status);
@@ -423,9 +434,10 @@ Java_edu_wpi_first_wpilibj_hal_HALUtil_getFPGAButton(JNIEnv *env, jclass) {
* Signature: (I)Ljava/lang/String; * Signature: (I)Ljava/lang/String;
*/ */
JNIEXPORT jstring JNICALL JNIEXPORT jstring JNICALL
Java_edu_wpi_first_wpilibj_hal_HALUtil_getHALErrorMessage( Java_edu_wpi_first_wpilibj_hal_HALUtil_getHALErrorMessage
JNIEnv *paramEnv, jclass, jint paramId) { (JNIEnv* paramEnv, jclass, jint paramId)
const char *msg = HAL_GetErrorMessage(paramId); {
const char* msg = HAL_GetErrorMessage(paramId);
HALUTIL_LOG(logDEBUG) << "Calling HALUtil HAL_GetErrorMessage id=" << paramId HALUTIL_LOG(logDEBUG) << "Calling HALUtil HAL_GetErrorMessage id=" << paramId
<< " msg=" << msg; << " msg=" << msg;
return MakeJString(paramEnv, msg); return MakeJString(paramEnv, msg);
@@ -437,7 +449,9 @@ Java_edu_wpi_first_wpilibj_hal_HALUtil_getHALErrorMessage(
* Signature: ()I * Signature: ()I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_HALUtil_getHALErrno(JNIEnv *, jclass) { Java_edu_wpi_first_wpilibj_hal_HALUtil_getHALErrno
(JNIEnv*, jclass)
{
return errno; return errno;
} }
@@ -446,9 +460,11 @@ Java_edu_wpi_first_wpilibj_hal_HALUtil_getHALErrno(JNIEnv *, jclass) {
* Method: getHALstrerror * Method: getHALstrerror
* Signature: (I)Ljava/lang/String; * Signature: (I)Ljava/lang/String;
*/ */
JNIEXPORT jstring JNICALL Java_edu_wpi_first_wpilibj_hal_HALUtil_getHALstrerror( JNIEXPORT jstring JNICALL
JNIEnv *env, jclass, jint errorCode) { Java_edu_wpi_first_wpilibj_hal_HALUtil_getHALstrerror
const char *msg = strerror(errno); (JNIEnv* env, jclass, jint errorCode)
{
const char* msg = std::strerror(errno);
HALUTIL_LOG(logDEBUG) << "Calling HALUtil getHALstrerror errorCode=" HALUTIL_LOG(logDEBUG) << "Calling HALUtil getHALstrerror errorCode="
<< errorCode << " msg=" << msg; << errorCode << " msg=" << msg;
return MakeJString(env, msg); return MakeJString(env, msg);

View File

@@ -1,61 +1,59 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */ /* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
#ifndef HALUTIL_H #ifndef HAL_HAL_SRC_MAIN_NATIVE_CPP_JNI_HALUTIL_H_
#define HALUTIL_H #define HAL_HAL_SRC_MAIN_NATIVE_CPP_JNI_HALUTIL_H_
#include <stdint.h>
#include <jni.h> #include <jni.h>
#include <stdint.h>
struct HAL_MatchInfo; struct HAL_MatchInfo;
namespace frc { namespace frc {
void ReportError(JNIEnv *env, int32_t status, bool doThrow = true); void ReportError(JNIEnv* env, int32_t status, bool doThrow = true);
void ThrowError(JNIEnv *env, int32_t status, int32_t minRange, int32_t maxRange, void ThrowError(JNIEnv* env, int32_t status, int32_t minRange, int32_t maxRange,
int32_t requestedValue); int32_t requestedValue);
inline bool CheckStatus(JNIEnv *env, int32_t status, bool doThrow = true) { inline bool CheckStatus(JNIEnv* env, int32_t status, bool doThrow = true) {
if (status != 0) ReportError(env, status, doThrow); if (status != 0) ReportError(env, status, doThrow);
return status == 0; return status == 0;
} }
inline bool CheckStatusRange(JNIEnv *env, int32_t status, int32_t minRange, inline bool CheckStatusRange(JNIEnv* env, int32_t status, int32_t minRange,
int32_t maxRange, int32_t requestedValue) { int32_t maxRange, int32_t requestedValue) {
if (status != 0) ThrowError(env, status, minRange, maxRange, requestedValue); if (status != 0) ThrowError(env, status, minRange, maxRange, requestedValue);
return status == 0; return status == 0;
} }
inline bool CheckStatusForceThrow(JNIEnv *env, int32_t status) { inline bool CheckStatusForceThrow(JNIEnv* env, int32_t status) {
if (status != 0) ThrowError(env, status, 0, 0, 0); if (status != 0) ThrowError(env, status, 0, 0, 0);
return status == 0; return status == 0;
} }
void ReportCANError(JNIEnv *env, int32_t status, int32_t message_id); void ReportCANError(JNIEnv* env, int32_t status, int32_t message_id);
inline bool CheckCANStatus(JNIEnv *env, int32_t status, int32_t message_id) { inline bool CheckCANStatus(JNIEnv* env, int32_t status, int32_t message_id) {
if (status != 0) ReportCANError(env, status, message_id); if (status != 0) ReportCANError(env, status, message_id);
return status == 0; return status == 0;
} }
void ThrowIllegalArgumentException(JNIEnv *env, const char *msg); void ThrowIllegalArgumentException(JNIEnv* env, const char* msg);
void ThrowBoundaryException(JNIEnv *env, double value, double lower, void ThrowBoundaryException(JNIEnv* env, double value, double lower,
double upper); double upper);
jobject CreatePWMConfigDataResult(JNIEnv *env, int32_t maxPwm, jobject CreatePWMConfigDataResult(JNIEnv* env, int32_t maxPwm,
int32_t deadbandMaxPwm, int32_t centerPwm, int32_t deadbandMaxPwm, int32_t centerPwm,
int32_t deadbandMinPwm, int32_t minPwm); int32_t deadbandMinPwm, int32_t minPwm);
void SetCanStatusObject(JNIEnv *env, jobject canStatus, void SetCanStatusObject(JNIEnv* env, jobject canStatus,
float percentBusUtilization, float percentBusUtilization, uint32_t busOffCount,
uint32_t busOffCount, uint32_t txFullCount, uint32_t txFullCount, uint32_t receiveErrorCount,
uint32_t receiveErrorCount,
uint32_t transmitErrorCount); uint32_t transmitErrorCount);
void SetMatchInfoObject(JNIEnv* env, jobject matchStatus, void SetMatchInfoObject(JNIEnv* env, jobject matchStatus,
@@ -68,4 +66,4 @@ JavaVM* GetJVM();
} // namespace frc } // namespace frc
#endif // HALUTIL_H #endif // HAL_HAL_SRC_MAIN_NATIVE_CPP_JNI_HALUTIL_H_

View File

@@ -1,19 +1,20 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */ /* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
#include <assert.h>
#include <jni.h> #include <jni.h>
#include "HAL/cpp/Log.h"
#include "edu_wpi_first_wpilibj_hal_I2CJNI.h" #include <cassert>
#include <wpi/jni_util.h>
#include "HAL/I2C.h" #include "HAL/I2C.h"
#include "HAL/cpp/Log.h"
#include "HALUtil.h" #include "HALUtil.h"
#include "wpi/jni_util.h" #include "edu_wpi_first_wpilibj_hal_I2CJNI.h"
using namespace frc; using namespace frc;
using namespace wpi::java; using namespace wpi::java;
@@ -25,17 +26,19 @@ TLogLevel i2cJNILogLevel = logWARNING;
if (level > i2cJNILogLevel) \ if (level > i2cJNILogLevel) \
; \ ; \
else \ else \
Log().Get(level) Log().Get(level)
extern "C" { extern "C" {
/* /*
* Class: edu_wpi_first_wpilibj_hal_I2CJNI * Class: edu_wpi_first_wpilibj_hal_I2CJNI
* Method: i2cInitialize * Method: i2CInitialize
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CInitialize( JNIEXPORT void JNICALL
JNIEnv* env, jclass, jint port) { Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CInitialize
(JNIEnv* env, jclass, jint port)
{
I2CJNI_LOG(logDEBUG) << "Calling I2CJNI i2CInititalize"; I2CJNI_LOG(logDEBUG) << "Calling I2CJNI i2CInititalize";
I2CJNI_LOG(logDEBUG) << "Port: " << port; I2CJNI_LOG(logDEBUG) << "Port: " << port;
int32_t status = 0; int32_t status = 0;
@@ -47,26 +50,32 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CInitialize(
/* /*
* Class: edu_wpi_first_wpilibj_hal_I2CJNI * Class: edu_wpi_first_wpilibj_hal_I2CJNI
* Method: i2CTransaction * Method: i2CTransaction
* Signature: (IBLjava/nio/ByteBuffer;BLjava/nio/ByteBuffer;B)I * Signature: (IBLjava/lang/Object;BLjava/lang/Object;B)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CTransaction( JNIEXPORT jint JNICALL
JNIEnv* env, jclass, jint port, jbyte address, jobject dataToSend, Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CTransaction
jbyte sendSize, jobject dataReceived, jbyte receiveSize) { (JNIEnv* env, jclass, jint port, jbyte address, jobject dataToSend,
jbyte sendSize, jobject dataReceived, jbyte receiveSize)
{
I2CJNI_LOG(logDEBUG) << "Calling I2CJNI i2CTransaction"; I2CJNI_LOG(logDEBUG) << "Calling I2CJNI i2CTransaction";
I2CJNI_LOG(logDEBUG) << "Port = " << port; I2CJNI_LOG(logDEBUG) << "Port = " << port;
I2CJNI_LOG(logDEBUG) << "Address = " << (jint)address; I2CJNI_LOG(logDEBUG) << "Address = " << (jint)address;
uint8_t* dataToSendPtr = nullptr; uint8_t* dataToSendPtr = nullptr;
if (dataToSend != 0) { if (dataToSend != 0) {
dataToSendPtr = (uint8_t*)env->GetDirectBufferAddress(dataToSend); dataToSendPtr =
reinterpret_cast<uint8_t*>(env->GetDirectBufferAddress(dataToSend));
} }
I2CJNI_LOG(logDEBUG) << "DataToSendPtr = " << (jint*)dataToSendPtr; I2CJNI_LOG(logDEBUG) << "DataToSendPtr = "
<< reinterpret_cast<jint*>(dataToSendPtr);
I2CJNI_LOG(logDEBUG) << "SendSize = " << (jint)sendSize; I2CJNI_LOG(logDEBUG) << "SendSize = " << (jint)sendSize;
uint8_t* dataReceivedPtr = uint8_t* dataReceivedPtr =
(uint8_t*)env->GetDirectBufferAddress(dataReceived); reinterpret_cast<uint8_t*>(env->GetDirectBufferAddress(dataReceived));
I2CJNI_LOG(logDEBUG) << "DataReceivedPtr = " << (jint*)dataReceivedPtr; I2CJNI_LOG(logDEBUG) << "DataReceivedPtr = "
<< reinterpret_cast<jint*>(dataReceivedPtr);
I2CJNI_LOG(logDEBUG) << "ReceiveSize = " << (jint)receiveSize; I2CJNI_LOG(logDEBUG) << "ReceiveSize = " << (jint)receiveSize;
jint returnValue = HAL_TransactionI2C(static_cast<HAL_I2CPort>(port), address, dataToSendPtr, sendSize, jint returnValue =
dataReceivedPtr, receiveSize); HAL_TransactionI2C(static_cast<HAL_I2CPort>(port), address, dataToSendPtr,
sendSize, dataReceivedPtr, receiveSize);
I2CJNI_LOG(logDEBUG) << "ReturnValue = " << returnValue; I2CJNI_LOG(logDEBUG) << "ReturnValue = " << returnValue;
return returnValue; return returnValue;
} }
@@ -76,9 +85,11 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CTransaction(
* Method: i2CTransactionB * Method: i2CTransactionB
* Signature: (IB[BB[BB)I * Signature: (IB[BB[BB)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CTransactionB( JNIEXPORT jint JNICALL
JNIEnv* env, jclass, jint port, jbyte address, jbyteArray dataToSend, Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CTransactionB
jbyte sendSize, jbyteArray dataReceived, jbyte receiveSize) { (JNIEnv* env, jclass, jint port, jbyte address, jbyteArray dataToSend,
jbyte sendSize, jbyteArray dataReceived, jbyte receiveSize)
{
I2CJNI_LOG(logDEBUG) << "Calling I2CJNI i2CTransactionB"; I2CJNI_LOG(logDEBUG) << "Calling I2CJNI i2CTransactionB";
I2CJNI_LOG(logDEBUG) << "Port = " << port; I2CJNI_LOG(logDEBUG) << "Port = " << port;
I2CJNI_LOG(logDEBUG) << "Address = " << (jint)address; I2CJNI_LOG(logDEBUG) << "Address = " << (jint)address;
@@ -88,11 +99,11 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CTransactionB(
I2CJNI_LOG(logDEBUG) << "ReceiveSize = " << (jint)receiveSize; I2CJNI_LOG(logDEBUG) << "ReceiveSize = " << (jint)receiveSize;
jint returnValue = jint returnValue =
HAL_TransactionI2C(static_cast<HAL_I2CPort>(port), address, HAL_TransactionI2C(static_cast<HAL_I2CPort>(port), address,
reinterpret_cast<const uint8_t *>( reinterpret_cast<const uint8_t*>(
JByteArrayRef(env, dataToSend).array().data()), JByteArrayRef(env, dataToSend).array().data()),
sendSize, recvBuf.data(), receiveSize); sendSize, recvBuf.data(), receiveSize);
env->SetByteArrayRegion(dataReceived, 0, receiveSize, env->SetByteArrayRegion(dataReceived, 0, receiveSize,
reinterpret_cast<const jbyte *>(recvBuf.data())); reinterpret_cast<const jbyte*>(recvBuf.data()));
I2CJNI_LOG(logDEBUG) << "ReturnValue = " << returnValue; I2CJNI_LOG(logDEBUG) << "ReturnValue = " << returnValue;
return returnValue; return returnValue;
} }
@@ -100,22 +111,26 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CTransactionB(
/* /*
* Class: edu_wpi_first_wpilibj_hal_I2CJNI * Class: edu_wpi_first_wpilibj_hal_I2CJNI
* Method: i2CWrite * Method: i2CWrite
* Signature: (IBLjava/nio/ByteBuffer;B)I * Signature: (IBLjava/lang/Object;B)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CWrite( JNIEXPORT jint JNICALL
JNIEnv* env, jclass, jint port, jbyte address, jobject dataToSend, Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CWrite
jbyte sendSize) { (JNIEnv* env, jclass, jint port, jbyte address, jobject dataToSend,
jbyte sendSize)
{
I2CJNI_LOG(logDEBUG) << "Calling I2CJNI i2CWrite"; I2CJNI_LOG(logDEBUG) << "Calling I2CJNI i2CWrite";
I2CJNI_LOG(logDEBUG) << "Port = " << port; I2CJNI_LOG(logDEBUG) << "Port = " << port;
I2CJNI_LOG(logDEBUG) << "Address = " << (jint)address; I2CJNI_LOG(logDEBUG) << "Address = " << (jint)address;
uint8_t* dataToSendPtr = nullptr; uint8_t* dataToSendPtr = nullptr;
if (dataToSend != 0) { if (dataToSend != 0) {
dataToSendPtr = (uint8_t*)env->GetDirectBufferAddress(dataToSend); dataToSendPtr =
reinterpret_cast<uint8_t*>(env->GetDirectBufferAddress(dataToSend));
} }
I2CJNI_LOG(logDEBUG) << "DataToSendPtr = " << dataToSendPtr; I2CJNI_LOG(logDEBUG) << "DataToSendPtr = " << dataToSendPtr;
I2CJNI_LOG(logDEBUG) << "SendSize = " << (jint)sendSize; I2CJNI_LOG(logDEBUG) << "SendSize = " << (jint)sendSize;
jint returnValue = HAL_WriteI2C(static_cast<HAL_I2CPort>(port), address, dataToSendPtr, sendSize); jint returnValue = HAL_WriteI2C(static_cast<HAL_I2CPort>(port), address,
dataToSendPtr, sendSize);
I2CJNI_LOG(logDEBUG) << "ReturnValue = " << (jint)returnValue; I2CJNI_LOG(logDEBUG) << "ReturnValue = " << (jint)returnValue;
return returnValue; return returnValue;
} }
@@ -125,16 +140,18 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CWrite(
* Method: i2CWriteB * Method: i2CWriteB
* Signature: (IB[BB)I * Signature: (IB[BB)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CWriteB( JNIEXPORT jint JNICALL
JNIEnv* env, jclass, jint port, jbyte address, jbyteArray dataToSend, Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CWriteB
jbyte sendSize) { (JNIEnv* env, jclass, jint port, jbyte address, jbyteArray dataToSend,
jbyte sendSize)
{
I2CJNI_LOG(logDEBUG) << "Calling I2CJNI i2CWrite"; I2CJNI_LOG(logDEBUG) << "Calling I2CJNI i2CWrite";
I2CJNI_LOG(logDEBUG) << "Port = " << port; I2CJNI_LOG(logDEBUG) << "Port = " << port;
I2CJNI_LOG(logDEBUG) << "Address = " << (jint)address; I2CJNI_LOG(logDEBUG) << "Address = " << (jint)address;
I2CJNI_LOG(logDEBUG) << "SendSize = " << (jint)sendSize; I2CJNI_LOG(logDEBUG) << "SendSize = " << (jint)sendSize;
jint returnValue = jint returnValue =
HAL_WriteI2C(static_cast<HAL_I2CPort>(port), address, HAL_WriteI2C(static_cast<HAL_I2CPort>(port), address,
reinterpret_cast<const uint8_t *>( reinterpret_cast<const uint8_t*>(
JByteArrayRef(env, dataToSend).array().data()), JByteArrayRef(env, dataToSend).array().data()),
sendSize); sendSize);
I2CJNI_LOG(logDEBUG) << "ReturnValue = " << (jint)returnValue; I2CJNI_LOG(logDEBUG) << "ReturnValue = " << (jint)returnValue;
@@ -144,19 +161,22 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CWriteB(
/* /*
* Class: edu_wpi_first_wpilibj_hal_I2CJNI * Class: edu_wpi_first_wpilibj_hal_I2CJNI
* Method: i2CRead * Method: i2CRead
* Signature: (IBLjava/nio/ByteBuffer;B)I * Signature: (IBLjava/lang/Object;B)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CRead( JNIEXPORT jint JNICALL
JNIEnv* env, jclass, jint port, jbyte address, jobject dataReceived, Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CRead
jbyte receiveSize) { (JNIEnv* env, jclass, jint port, jbyte address, jobject dataReceived,
jbyte receiveSize)
{
I2CJNI_LOG(logDEBUG) << "Calling I2CJNI i2CRead"; I2CJNI_LOG(logDEBUG) << "Calling I2CJNI i2CRead";
I2CJNI_LOG(logDEBUG) << "Port = " << port; I2CJNI_LOG(logDEBUG) << "Port = " << port;
I2CJNI_LOG(logDEBUG) << "Address = " << address; I2CJNI_LOG(logDEBUG) << "Address = " << address;
uint8_t* dataReceivedPtr = uint8_t* dataReceivedPtr =
(uint8_t*)env->GetDirectBufferAddress(dataReceived); reinterpret_cast<uint8_t*>(env->GetDirectBufferAddress(dataReceived));
I2CJNI_LOG(logDEBUG) << "DataReceivedPtr = " << dataReceivedPtr; I2CJNI_LOG(logDEBUG) << "DataReceivedPtr = " << dataReceivedPtr;
I2CJNI_LOG(logDEBUG) << "ReceiveSize = " << receiveSize; I2CJNI_LOG(logDEBUG) << "ReceiveSize = " << receiveSize;
jint returnValue = HAL_ReadI2C(static_cast<HAL_I2CPort>(port), address, dataReceivedPtr, receiveSize); jint returnValue = HAL_ReadI2C(static_cast<HAL_I2CPort>(port), address,
dataReceivedPtr, receiveSize);
I2CJNI_LOG(logDEBUG) << "ReturnValue = " << returnValue; I2CJNI_LOG(logDEBUG) << "ReturnValue = " << returnValue;
return returnValue; return returnValue;
} }
@@ -166,18 +186,21 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CRead(
* Method: i2CReadB * Method: i2CReadB
* Signature: (IB[BB)I * Signature: (IB[BB)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CReadB( JNIEXPORT jint JNICALL
JNIEnv* env, jclass, jint port, jbyte address, jbyteArray dataReceived, Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CReadB
jbyte receiveSize) { (JNIEnv* env, jclass, jint port, jbyte address, jbyteArray dataReceived,
jbyte receiveSize)
{
I2CJNI_LOG(logDEBUG) << "Calling I2CJNI i2CRead"; I2CJNI_LOG(logDEBUG) << "Calling I2CJNI i2CRead";
I2CJNI_LOG(logDEBUG) << "Port = " << port; I2CJNI_LOG(logDEBUG) << "Port = " << port;
I2CJNI_LOG(logDEBUG) << "Address = " << address; I2CJNI_LOG(logDEBUG) << "Address = " << address;
I2CJNI_LOG(logDEBUG) << "ReceiveSize = " << receiveSize; I2CJNI_LOG(logDEBUG) << "ReceiveSize = " << receiveSize;
wpi::SmallVector<uint8_t, 128> recvBuf; wpi::SmallVector<uint8_t, 128> recvBuf;
recvBuf.resize(receiveSize); recvBuf.resize(receiveSize);
jint returnValue = HAL_ReadI2C(static_cast<HAL_I2CPort>(port), address, recvBuf.data(), receiveSize); jint returnValue = HAL_ReadI2C(static_cast<HAL_I2CPort>(port), address,
recvBuf.data(), receiveSize);
env->SetByteArrayRegion(dataReceived, 0, receiveSize, env->SetByteArrayRegion(dataReceived, 0, receiveSize,
reinterpret_cast<const jbyte *>(recvBuf.data())); reinterpret_cast<const jbyte*>(recvBuf.data()));
I2CJNI_LOG(logDEBUG) << "ReturnValue = " << returnValue; I2CJNI_LOG(logDEBUG) << "ReturnValue = " << returnValue;
return returnValue; return returnValue;
} }
@@ -188,7 +211,9 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CReadB(
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CClose(JNIEnv*, jclass, jint port) { Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CClose
(JNIEnv*, jclass, jint port)
{
I2CJNI_LOG(logDEBUG) << "Calling I2CJNI i2CClose"; I2CJNI_LOG(logDEBUG) << "Calling I2CJNI i2CClose";
HAL_CloseI2C(static_cast<HAL_I2CPort>(port)); HAL_CloseI2C(static_cast<HAL_I2CPort>(port));
} }

View File

@@ -1,21 +1,21 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */ /* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
#include <assert.h>
#include <jni.h> #include <jni.h>
#include <atomic> #include <atomic>
#include <cassert>
#include <thread> #include <thread>
#include <wpi/SafeThread.h> #include <wpi/SafeThread.h>
#include <wpi/mutex.h> #include <wpi/mutex.h>
#include "HAL/cpp/Log.h"
#include "HAL/Interrupts.h" #include "HAL/Interrupts.h"
#include "HAL/cpp/Log.h"
#include "HALUtil.h" #include "HALUtil.h"
#include "edu_wpi_first_wpilibj_hal_InterruptJNI.h" #include "edu_wpi_first_wpilibj_hal_InterruptJNI.h"
@@ -27,7 +27,7 @@ TLogLevel interruptJNILogLevel = logERROR;
if (level > interruptJNILogLevel) \ if (level > interruptJNILogLevel) \
; \ ; \
else \ else \
Log().Get(level) Log().Get(level)
// Thread where callbacks are actually performed. // Thread where callbacks are actually performed.
// //
@@ -84,8 +84,8 @@ void InterruptThreadJNI::Main() {
args.version = JNI_VERSION_1_2; args.version = JNI_VERSION_1_2;
args.name = const_cast<char*>("Interrupt"); args.name = const_cast<char*>("Interrupt");
args.group = nullptr; args.group = nullptr;
jint rs = GetJVM()->AttachCurrentThreadAsDaemon(reinterpret_cast<void**>(&env), jint rs = GetJVM()->AttachCurrentThreadAsDaemon(
&args); reinterpret_cast<void**>(&env), &args);
if (rs != JNI_OK) return; if (rs != JNI_OK) return;
std::unique_lock<wpi::mutex> lock(m_mutex); std::unique_lock<wpi::mutex> lock(m_mutex);
@@ -126,10 +126,11 @@ extern "C" {
* Signature: (Z)I * Signature: (Z)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_InterruptJNI_initializeInterrupts( Java_edu_wpi_first_wpilibj_hal_InterruptJNI_initializeInterrupts
JNIEnv* env, jclass, jboolean watcher) { (JNIEnv* env, jclass, jboolean watcher)
{
INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI initializeInterrupts"; INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI initializeInterrupts";
INTERRUPTJNI_LOG(logDEBUG) << "watcher = " << (bool)watcher; INTERRUPTJNI_LOG(logDEBUG) << "watcher = " << static_cast<bool>(watcher);
int32_t status = 0; int32_t status = 0;
HAL_InterruptHandle interrupt = HAL_InitializeInterrupts(watcher, &status); HAL_InterruptHandle interrupt = HAL_InitializeInterrupts(watcher, &status);
@@ -144,13 +145,15 @@ Java_edu_wpi_first_wpilibj_hal_InterruptJNI_initializeInterrupts(
/* /*
* Class: edu_wpi_first_wpilibj_hal_InterruptJNI * Class: edu_wpi_first_wpilibj_hal_InterruptJNI
* Method: cleanInterrupts * Method: cleanInterrupts
* Signature: (J)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_InterruptJNI_cleanInterrupts( Java_edu_wpi_first_wpilibj_hal_InterruptJNI_cleanInterrupts
JNIEnv* env, jclass, jint interruptHandle) { (JNIEnv* env, jclass, jint interruptHandle)
{
INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI cleanInterrupts"; INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI cleanInterrupts";
INTERRUPTJNI_LOG(logDEBUG) << "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle; INTERRUPTJNI_LOG(logDEBUG)
<< "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle;
int32_t status = 0; int32_t status = 0;
HAL_CleanInterrupts((HAL_InterruptHandle)interruptHandle, &status); HAL_CleanInterrupts((HAL_InterruptHandle)interruptHandle, &status);
@@ -163,14 +166,16 @@ Java_edu_wpi_first_wpilibj_hal_InterruptJNI_cleanInterrupts(
/* /*
* Class: edu_wpi_first_wpilibj_hal_InterruptJNI * Class: edu_wpi_first_wpilibj_hal_InterruptJNI
* Method: waitForInterrupt * Method: waitForInterrupt
* Signature: (JD)V * Signature: (IDZ)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_InterruptJNI_waitForInterrupt( Java_edu_wpi_first_wpilibj_hal_InterruptJNI_waitForInterrupt
JNIEnv* env, jclass, jint interruptHandle, jdouble timeout, (JNIEnv* env, jclass, jint interruptHandle, jdouble timeout,
jboolean ignorePrevious) { jboolean ignorePrevious)
{
INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI waitForInterrupt"; INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI waitForInterrupt";
INTERRUPTJNI_LOG(logDEBUG) << "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle; INTERRUPTJNI_LOG(logDEBUG)
<< "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle;
int32_t status = 0; int32_t status = 0;
int32_t result = HAL_WaitForInterrupt((HAL_InterruptHandle)interruptHandle, int32_t result = HAL_WaitForInterrupt((HAL_InterruptHandle)interruptHandle,
@@ -185,13 +190,15 @@ Java_edu_wpi_first_wpilibj_hal_InterruptJNI_waitForInterrupt(
/* /*
* Class: edu_wpi_first_wpilibj_hal_InterruptJNI * Class: edu_wpi_first_wpilibj_hal_InterruptJNI
* Method: enableInterrupts * Method: enableInterrupts
* Signature: (J)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_InterruptJNI_enableInterrupts( Java_edu_wpi_first_wpilibj_hal_InterruptJNI_enableInterrupts
JNIEnv* env, jclass, jint interruptHandle) { (JNIEnv* env, jclass, jint interruptHandle)
{
INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI enableInterrupts"; INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI enableInterrupts";
INTERRUPTJNI_LOG(logDEBUG) << "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle; INTERRUPTJNI_LOG(logDEBUG)
<< "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle;
int32_t status = 0; int32_t status = 0;
HAL_EnableInterrupts((HAL_InterruptHandle)interruptHandle, &status); HAL_EnableInterrupts((HAL_InterruptHandle)interruptHandle, &status);
@@ -204,13 +211,15 @@ Java_edu_wpi_first_wpilibj_hal_InterruptJNI_enableInterrupts(
/* /*
* Class: edu_wpi_first_wpilibj_hal_InterruptJNI * Class: edu_wpi_first_wpilibj_hal_InterruptJNI
* Method: disableInterrupts * Method: disableInterrupts
* Signature: (J)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_InterruptJNI_disableInterrupts( Java_edu_wpi_first_wpilibj_hal_InterruptJNI_disableInterrupts
JNIEnv* env, jclass, jint interruptHandle) { (JNIEnv* env, jclass, jint interruptHandle)
{
INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI disableInterrupts"; INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI disableInterrupts";
INTERRUPTJNI_LOG(logDEBUG) << "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle; INTERRUPTJNI_LOG(logDEBUG)
<< "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle;
int32_t status = 0; int32_t status = 0;
HAL_DisableInterrupts((HAL_InterruptHandle)interruptHandle, &status); HAL_DisableInterrupts((HAL_InterruptHandle)interruptHandle, &status);
@@ -223,16 +232,20 @@ Java_edu_wpi_first_wpilibj_hal_InterruptJNI_disableInterrupts(
/* /*
* Class: edu_wpi_first_wpilibj_hal_InterruptJNI * Class: edu_wpi_first_wpilibj_hal_InterruptJNI
* Method: readInterruptRisingTimestamp * Method: readInterruptRisingTimestamp
* Signature: (J)D * Signature: (I)D
*/ */
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_wpilibj_hal_InterruptJNI_readInterruptRisingTimestamp( Java_edu_wpi_first_wpilibj_hal_InterruptJNI_readInterruptRisingTimestamp
JNIEnv* env, jclass, jint interruptHandle) { (JNIEnv* env, jclass, jint interruptHandle)
INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI readInterruptRisingTimestamp"; {
INTERRUPTJNI_LOG(logDEBUG) << "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle; INTERRUPTJNI_LOG(logDEBUG)
<< "Calling INTERRUPTJNI readInterruptRisingTimestamp";
INTERRUPTJNI_LOG(logDEBUG)
<< "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle;
int32_t status = 0; int32_t status = 0;
jdouble timeStamp = HAL_ReadInterruptRisingTimestamp((HAL_InterruptHandle)interruptHandle, &status); jdouble timeStamp = HAL_ReadInterruptRisingTimestamp(
(HAL_InterruptHandle)interruptHandle, &status);
INTERRUPTJNI_LOG(logDEBUG) << "Status = " << status; INTERRUPTJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status); CheckStatus(env, status);
@@ -242,16 +255,20 @@ Java_edu_wpi_first_wpilibj_hal_InterruptJNI_readInterruptRisingTimestamp(
/* /*
* Class: edu_wpi_first_wpilibj_hal_InterruptJNI * Class: edu_wpi_first_wpilibj_hal_InterruptJNI
* Method: readInterruptFallingTimestamp * Method: readInterruptFallingTimestamp
* Signature: (J)D * Signature: (I)D
*/ */
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_wpilibj_hal_InterruptJNI_readInterruptFallingTimestamp( Java_edu_wpi_first_wpilibj_hal_InterruptJNI_readInterruptFallingTimestamp
JNIEnv* env, jclass, jint interruptHandle) { (JNIEnv* env, jclass, jint interruptHandle)
INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI readInterruptFallingTimestamp"; {
INTERRUPTJNI_LOG(logDEBUG) << "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle; INTERRUPTJNI_LOG(logDEBUG)
<< "Calling INTERRUPTJNI readInterruptFallingTimestamp";
INTERRUPTJNI_LOG(logDEBUG)
<< "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle;
int32_t status = 0; int32_t status = 0;
jdouble timeStamp = HAL_ReadInterruptFallingTimestamp((HAL_InterruptHandle)interruptHandle, &status); jdouble timeStamp = HAL_ReadInterruptFallingTimestamp(
(HAL_InterruptHandle)interruptHandle, &status);
INTERRUPTJNI_LOG(logDEBUG) << "Status = " << status; INTERRUPTJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status); CheckStatus(env, status);
@@ -264,17 +281,20 @@ Java_edu_wpi_first_wpilibj_hal_InterruptJNI_readInterruptFallingTimestamp(
* Signature: (III)V * Signature: (III)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_InterruptJNI_requestInterrupts( Java_edu_wpi_first_wpilibj_hal_InterruptJNI_requestInterrupts
JNIEnv* env, jclass, jint interruptHandle, jint digitalSourceHandle, (JNIEnv* env, jclass, jint interruptHandle, jint digitalSourceHandle,
jint analogTriggerType) { jint analogTriggerType)
{
INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI requestInterrupts"; INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI requestInterrupts";
INTERRUPTJNI_LOG(logDEBUG) << "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle; INTERRUPTJNI_LOG(logDEBUG)
<< "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle;
INTERRUPTJNI_LOG(logDEBUG) << "digitalSourceHandle = " << digitalSourceHandle; INTERRUPTJNI_LOG(logDEBUG) << "digitalSourceHandle = " << digitalSourceHandle;
INTERRUPTJNI_LOG(logDEBUG) << "analogTriggerType = " << analogTriggerType; INTERRUPTJNI_LOG(logDEBUG) << "analogTriggerType = " << analogTriggerType;
int32_t status = 0; int32_t status = 0;
HAL_RequestInterrupts((HAL_InterruptHandle)interruptHandle, (HAL_Handle)digitalSourceHandle, HAL_RequestInterrupts((HAL_InterruptHandle)interruptHandle,
(HAL_AnalogTriggerType)analogTriggerType, &status); (HAL_Handle)digitalSourceHandle,
(HAL_AnalogTriggerType)analogTriggerType, &status);
INTERRUPTJNI_LOG(logDEBUG) << "Status = " << status; INTERRUPTJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status); CheckStatus(env, status);
@@ -283,15 +303,15 @@ Java_edu_wpi_first_wpilibj_hal_InterruptJNI_requestInterrupts(
/* /*
* Class: edu_wpi_first_wpilibj_hal_InterruptJNI * Class: edu_wpi_first_wpilibj_hal_InterruptJNI
* Method: attachInterruptHandler * Method: attachInterruptHandler
* Signature: * Signature: (ILjava/lang/Object;Ljava/lang/Object;)V
* (JLedu/wpi/first/wpilibj/hal/InterruptJNI/InterruptHandlerFunction;Ljava/nio/ByteBuffer;)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_InterruptJNI_attachInterruptHandler( Java_edu_wpi_first_wpilibj_hal_InterruptJNI_attachInterruptHandler
JNIEnv* env, jclass, jint interruptHandle, jobject handler, (JNIEnv* env, jclass, jint interruptHandle, jobject handler, jobject param)
jobject param) { {
INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI attachInterruptHandler"; INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI attachInterruptHandler";
INTERRUPTJNI_LOG(logDEBUG) << "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle; INTERRUPTJNI_LOG(logDEBUG)
<< "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle;
jclass cls = env->GetObjectClass(handler); jclass cls = env->GetObjectClass(handler);
INTERRUPTJNI_LOG(logDEBUG) << "class = " << cls; INTERRUPTJNI_LOG(logDEBUG) << "class = " << cls;
@@ -315,8 +335,8 @@ Java_edu_wpi_first_wpilibj_hal_InterruptJNI_attachInterruptHandler(
INTERRUPTJNI_LOG(logDEBUG) << "InterruptThreadJNI Ptr = " << intr; INTERRUPTJNI_LOG(logDEBUG) << "InterruptThreadJNI Ptr = " << intr;
int32_t status = 0; int32_t status = 0;
HAL_AttachInterruptHandler((HAL_InterruptHandle)interruptHandle, interruptHandler, intr, HAL_AttachInterruptHandler((HAL_InterruptHandle)interruptHandle,
&status); interruptHandler, intr, &status);
INTERRUPTJNI_LOG(logDEBUG) << "Status = " << status; INTERRUPTJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status); CheckStatus(env, status);
@@ -325,20 +345,24 @@ Java_edu_wpi_first_wpilibj_hal_InterruptJNI_attachInterruptHandler(
/* /*
* Class: edu_wpi_first_wpilibj_hal_InterruptJNI * Class: edu_wpi_first_wpilibj_hal_InterruptJNI
* Method: setInterruptUpSourceEdge * Method: setInterruptUpSourceEdge
* Signature: (JZZ)V * Signature: (IZZ)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_InterruptJNI_setInterruptUpSourceEdge( Java_edu_wpi_first_wpilibj_hal_InterruptJNI_setInterruptUpSourceEdge
JNIEnv* env, jclass, jint interruptHandle, jboolean risingEdge, (JNIEnv* env, jclass, jint interruptHandle, jboolean risingEdge,
jboolean fallingEdge) { jboolean fallingEdge)
{
INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI setInterruptUpSourceEdge"; INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI setInterruptUpSourceEdge";
INTERRUPTJNI_LOG(logDEBUG) << "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle; INTERRUPTJNI_LOG(logDEBUG)
INTERRUPTJNI_LOG(logDEBUG) << "Rising Edge = " << (bool)risingEdge; << "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle;
INTERRUPTJNI_LOG(logDEBUG) << "Falling Edge = " << (bool)fallingEdge; INTERRUPTJNI_LOG(logDEBUG)
<< "Rising Edge = " << static_cast<bool>(risingEdge);
INTERRUPTJNI_LOG(logDEBUG)
<< "Falling Edge = " << static_cast<bool>(fallingEdge);
int32_t status = 0; int32_t status = 0;
HAL_SetInterruptUpSourceEdge((HAL_InterruptHandle)interruptHandle, risingEdge, fallingEdge, HAL_SetInterruptUpSourceEdge((HAL_InterruptHandle)interruptHandle, risingEdge,
&status); fallingEdge, &status);
INTERRUPTJNI_LOG(logDEBUG) << "Status = " << status; INTERRUPTJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status); CheckStatus(env, status);

View File

@@ -1,16 +1,18 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */ /* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
#include "HAL/Notifier.h"
#include <assert.h>
#include <jni.h> #include <jni.h>
#include <stdio.h>
#include "HALUtil.h" #include <cassert>
#include <cstdio>
#include "HAL/Notifier.h"
#include "HAL/cpp/Log.h" #include "HAL/cpp/Log.h"
#include "HALUtil.h"
#include "edu_wpi_first_wpilibj_hal_NotifierJNI.h" #include "edu_wpi_first_wpilibj_hal_NotifierJNI.h"
using namespace frc; using namespace frc;
@@ -22,7 +24,7 @@ TLogLevel notifierJNILogLevel = logWARNING;
if (level > notifierJNILogLevel) \ if (level > notifierJNILogLevel) \
; \ ; \
else \ else \
Log().Get(level) Log().Get(level)
extern "C" { extern "C" {
@@ -32,8 +34,9 @@ extern "C" {
* Signature: ()I * Signature: ()I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_NotifierJNI_initializeNotifier( Java_edu_wpi_first_wpilibj_hal_NotifierJNI_initializeNotifier
JNIEnv *env, jclass) { (JNIEnv* env, jclass)
{
NOTIFIERJNI_LOG(logDEBUG) << "Calling NOTIFIERJNI initializeNotifier"; NOTIFIERJNI_LOG(logDEBUG) << "Calling NOTIFIERJNI initializeNotifier";
int32_t status = 0; int32_t status = 0;
@@ -43,7 +46,7 @@ Java_edu_wpi_first_wpilibj_hal_NotifierJNI_initializeNotifier(
NOTIFIERJNI_LOG(logDEBUG) << "Status = " << status; NOTIFIERJNI_LOG(logDEBUG) << "Status = " << status;
if (notifierHandle <= 0 || !CheckStatusForceThrow(env, status)) { if (notifierHandle <= 0 || !CheckStatusForceThrow(env, status)) {
return 0; // something went wrong in HAL return 0; // something went wrong in HAL
} }
return (jint)notifierHandle; return (jint)notifierHandle;
@@ -55,8 +58,9 @@ Java_edu_wpi_first_wpilibj_hal_NotifierJNI_initializeNotifier(
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_NotifierJNI_stopNotifier( Java_edu_wpi_first_wpilibj_hal_NotifierJNI_stopNotifier
JNIEnv *env, jclass cls, jint notifierHandle) { (JNIEnv* env, jclass cls, jint notifierHandle)
{
NOTIFIERJNI_LOG(logDEBUG) << "Calling NOTIFIERJNI stopNotifier"; NOTIFIERJNI_LOG(logDEBUG) << "Calling NOTIFIERJNI stopNotifier";
NOTIFIERJNI_LOG(logDEBUG) << "Notifier Handle = " << notifierHandle; NOTIFIERJNI_LOG(logDEBUG) << "Notifier Handle = " << notifierHandle;
@@ -72,8 +76,10 @@ Java_edu_wpi_first_wpilibj_hal_NotifierJNI_stopNotifier(
* Method: cleanNotifier * Method: cleanNotifier
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_NotifierJNI_cleanNotifier( JNIEXPORT void JNICALL
JNIEnv *env, jclass, jint notifierHandle) { Java_edu_wpi_first_wpilibj_hal_NotifierJNI_cleanNotifier
(JNIEnv* env, jclass, jint notifierHandle)
{
NOTIFIERJNI_LOG(logDEBUG) << "Calling NOTIFIERJNI cleanNotifier"; NOTIFIERJNI_LOG(logDEBUG) << "Calling NOTIFIERJNI cleanNotifier";
NOTIFIERJNI_LOG(logDEBUG) << "Notifier Handle = " << notifierHandle; NOTIFIERJNI_LOG(logDEBUG) << "Notifier Handle = " << notifierHandle;
@@ -90,8 +96,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_NotifierJNI_cleanNotifier(
* Signature: (IJ)V * Signature: (IJ)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_NotifierJNI_updateNotifierAlarm( Java_edu_wpi_first_wpilibj_hal_NotifierJNI_updateNotifierAlarm
JNIEnv *env, jclass cls, jint notifierHandle, jlong triggerTime) { (JNIEnv* env, jclass cls, jint notifierHandle, jlong triggerTime)
{
NOTIFIERJNI_LOG(logDEBUG) << "Calling NOTIFIERJNI updateNotifierAlarm"; NOTIFIERJNI_LOG(logDEBUG) << "Calling NOTIFIERJNI updateNotifierAlarm";
NOTIFIERJNI_LOG(logDEBUG) << "Notifier Handle = " << notifierHandle; NOTIFIERJNI_LOG(logDEBUG) << "Notifier Handle = " << notifierHandle;
@@ -99,7 +106,8 @@ Java_edu_wpi_first_wpilibj_hal_NotifierJNI_updateNotifierAlarm(
NOTIFIERJNI_LOG(logDEBUG) << "triggerTime = " << triggerTime; NOTIFIERJNI_LOG(logDEBUG) << "triggerTime = " << triggerTime;
int32_t status = 0; int32_t status = 0;
HAL_UpdateNotifierAlarm((HAL_NotifierHandle)notifierHandle, (uint64_t)triggerTime, &status); HAL_UpdateNotifierAlarm((HAL_NotifierHandle)notifierHandle,
static_cast<uint64_t>(triggerTime), &status);
NOTIFIERJNI_LOG(logDEBUG) << "Status = " << status; NOTIFIERJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status); CheckStatus(env, status);
} }
@@ -110,8 +118,9 @@ Java_edu_wpi_first_wpilibj_hal_NotifierJNI_updateNotifierAlarm(
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_NotifierJNI_cancelNotifierAlarm( Java_edu_wpi_first_wpilibj_hal_NotifierJNI_cancelNotifierAlarm
JNIEnv *env, jclass cls, jint notifierHandle) { (JNIEnv* env, jclass cls, jint notifierHandle)
{
NOTIFIERJNI_LOG(logDEBUG) << "Calling NOTIFIERJNI cancelNotifierAlarm"; NOTIFIERJNI_LOG(logDEBUG) << "Calling NOTIFIERJNI cancelNotifierAlarm";
NOTIFIERJNI_LOG(logDEBUG) << "Notifier Handle = " << notifierHandle; NOTIFIERJNI_LOG(logDEBUG) << "Notifier Handle = " << notifierHandle;
@@ -128,8 +137,9 @@ Java_edu_wpi_first_wpilibj_hal_NotifierJNI_cancelNotifierAlarm(
* Signature: (I)J * Signature: (I)J
*/ */
JNIEXPORT jlong JNICALL JNIEXPORT jlong JNICALL
Java_edu_wpi_first_wpilibj_hal_NotifierJNI_waitForNotifierAlarm( Java_edu_wpi_first_wpilibj_hal_NotifierJNI_waitForNotifierAlarm
JNIEnv *env, jclass cls, jint notifierHandle) { (JNIEnv* env, jclass cls, jint notifierHandle)
{
NOTIFIERJNI_LOG(logDEBUG) << "Calling NOTIFIERJNI waitForNotifierAlarm"; NOTIFIERJNI_LOG(logDEBUG) << "Calling NOTIFIERJNI waitForNotifierAlarm";
NOTIFIERJNI_LOG(logDEBUG) << "Notifier Handle = " << notifierHandle; NOTIFIERJNI_LOG(logDEBUG) << "Notifier Handle = " << notifierHandle;

View File

@@ -1,19 +1,20 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */ /* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
#include <assert.h>
#include <jni.h> #include <jni.h>
#include "HAL/cpp/Log.h"
#include "edu_wpi_first_wpilibj_hal_OSSerialPortJNI.h" #include <cassert>
#include <wpi/jni_util.h>
#include "HAL/OSSerialPort.h" #include "HAL/OSSerialPort.h"
#include "HAL/cpp/Log.h"
#include "HALUtil.h" #include "HALUtil.h"
#include "wpi/jni_util.h" #include "edu_wpi_first_wpilibj_hal_OSSerialPortJNI.h"
using namespace frc; using namespace frc;
using namespace wpi::java; using namespace wpi::java;
@@ -25,7 +26,7 @@ TLogLevel osserialJNILogLevel = logWARNING;
if (level > osserialJNILogLevel) \ if (level > osserialJNILogLevel) \
; \ ; \
else \ else \
Log().Get(level) Log().Get(level)
extern "C" { extern "C" {
@@ -35,8 +36,9 @@ extern "C" {
* Signature: (B)V * Signature: (B)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialInitializePort( Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialInitializePort
JNIEnv* env, jclass, jbyte port) { (JNIEnv* env, jclass, jbyte port)
{
SERIALJNI_LOG(logDEBUG) << "Calling Serial Initialize"; SERIALJNI_LOG(logDEBUG) << "Calling Serial Initialize";
SERIALJNI_LOG(logDEBUG) << "Port = " << (jint)port; SERIALJNI_LOG(logDEBUG) << "Port = " << (jint)port;
int32_t status = 0; int32_t status = 0;
@@ -51,8 +53,9 @@ Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialInitializePort(
* Signature: (BI)V * Signature: (BI)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetBaudRate( Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetBaudRate
JNIEnv* env, jclass, jbyte port, jint rate) { (JNIEnv* env, jclass, jbyte port, jint rate)
{
SERIALJNI_LOG(logDEBUG) << "Setting Serial Baud Rate"; SERIALJNI_LOG(logDEBUG) << "Setting Serial Baud Rate";
SERIALJNI_LOG(logDEBUG) << "Baud: " << rate; SERIALJNI_LOG(logDEBUG) << "Baud: " << rate;
int32_t status = 0; int32_t status = 0;
@@ -67,8 +70,9 @@ Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetBaudRate(
* Signature: (BB)V * Signature: (BB)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetDataBits( Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetDataBits
JNIEnv* env, jclass, jbyte port, jbyte bits) { (JNIEnv* env, jclass, jbyte port, jbyte bits)
{
SERIALJNI_LOG(logDEBUG) << "Setting Serial Data Bits"; SERIALJNI_LOG(logDEBUG) << "Setting Serial Data Bits";
SERIALJNI_LOG(logDEBUG) << "Data Bits: " << bits; SERIALJNI_LOG(logDEBUG) << "Data Bits: " << bits;
int32_t status = 0; int32_t status = 0;
@@ -83,8 +87,9 @@ Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetDataBits(
* Signature: (BB)V * Signature: (BB)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetParity( Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetParity
JNIEnv* env, jclass, jbyte port, jbyte parity) { (JNIEnv* env, jclass, jbyte port, jbyte parity)
{
SERIALJNI_LOG(logDEBUG) << "Setting Serial Parity"; SERIALJNI_LOG(logDEBUG) << "Setting Serial Parity";
SERIALJNI_LOG(logDEBUG) << "Parity: " << parity; SERIALJNI_LOG(logDEBUG) << "Parity: " << parity;
int32_t status = 0; int32_t status = 0;
@@ -99,8 +104,9 @@ Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetParity(
* Signature: (BB)V * Signature: (BB)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetStopBits( Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetStopBits
JNIEnv* env, jclass, jbyte port, jbyte bits) { (JNIEnv* env, jclass, jbyte port, jbyte bits)
{
SERIALJNI_LOG(logDEBUG) << "Setting Serial Stop Bits"; SERIALJNI_LOG(logDEBUG) << "Setting Serial Stop Bits";
SERIALJNI_LOG(logDEBUG) << "Stop Bits: " << bits; SERIALJNI_LOG(logDEBUG) << "Stop Bits: " << bits;
int32_t status = 0; int32_t status = 0;
@@ -115,8 +121,9 @@ Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetStopBits(
* Signature: (BB)V * Signature: (BB)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetWriteMode( Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetWriteMode
JNIEnv* env, jclass, jbyte port, jbyte mode) { (JNIEnv* env, jclass, jbyte port, jbyte mode)
{
SERIALJNI_LOG(logDEBUG) << "Setting Serial Write Mode"; SERIALJNI_LOG(logDEBUG) << "Setting Serial Write Mode";
SERIALJNI_LOG(logDEBUG) << "Write mode: " << mode; SERIALJNI_LOG(logDEBUG) << "Write mode: " << mode;
int32_t status = 0; int32_t status = 0;
@@ -131,8 +138,9 @@ Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetWriteMode(
* Signature: (BB)V * Signature: (BB)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetFlowControl( Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetFlowControl
JNIEnv* env, jclass, jbyte port, jbyte flow) { (JNIEnv* env, jclass, jbyte port, jbyte flow)
{
SERIALJNI_LOG(logDEBUG) << "Setting Serial Flow Control"; SERIALJNI_LOG(logDEBUG) << "Setting Serial Flow Control";
SERIALJNI_LOG(logDEBUG) << "Flow Control: " << flow; SERIALJNI_LOG(logDEBUG) << "Flow Control: " << flow;
int32_t status = 0; int32_t status = 0;
@@ -147,8 +155,9 @@ Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetFlowControl(
* Signature: (BD)V * Signature: (BD)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetTimeout( Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetTimeout
JNIEnv* env, jclass, jbyte port, jdouble timeout) { (JNIEnv* env, jclass, jbyte port, jdouble timeout)
{
SERIALJNI_LOG(logDEBUG) << "Setting Serial Timeout"; SERIALJNI_LOG(logDEBUG) << "Setting Serial Timeout";
SERIALJNI_LOG(logDEBUG) << "Timeout: " << timeout; SERIALJNI_LOG(logDEBUG) << "Timeout: " << timeout;
int32_t status = 0; int32_t status = 0;
@@ -163,12 +172,14 @@ Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetTimeout(
* Signature: (BC)V * Signature: (BC)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialEnableTermination( Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialEnableTermination
JNIEnv* env, jclass, jbyte port, jchar terminator) { (JNIEnv* env, jclass, jbyte port, jchar terminator)
{
SERIALJNI_LOG(logDEBUG) << "Setting Serial Enable Termination"; SERIALJNI_LOG(logDEBUG) << "Setting Serial Enable Termination";
SERIALJNI_LOG(logDEBUG) << "Terminator: " << terminator; SERIALJNI_LOG(logDEBUG) << "Terminator: " << terminator;
int32_t status = 0; int32_t status = 0;
HAL_EnableOSSerialTermination(static_cast<HAL_SerialPort>(port), terminator, &status); HAL_EnableOSSerialTermination(static_cast<HAL_SerialPort>(port), terminator,
&status);
SERIALJNI_LOG(logDEBUG) << "Status = " << status; SERIALJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status); CheckStatus(env, status);
} }
@@ -179,8 +190,9 @@ Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialEnableTermination(
* Signature: (B)V * Signature: (B)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialDisableTermination( Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialDisableTermination
JNIEnv* env, jclass, jbyte port) { (JNIEnv* env, jclass, jbyte port)
{
SERIALJNI_LOG(logDEBUG) << "Setting Serial Disable termination"; SERIALJNI_LOG(logDEBUG) << "Setting Serial Disable termination";
int32_t status = 0; int32_t status = 0;
HAL_DisableOSSerialTermination(static_cast<HAL_SerialPort>(port), &status); HAL_DisableOSSerialTermination(static_cast<HAL_SerialPort>(port), &status);
@@ -194,12 +206,14 @@ Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialDisableTermination(
* Signature: (BI)V * Signature: (BI)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetReadBufferSize( Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetReadBufferSize
JNIEnv* env, jclass, jbyte port, jint size) { (JNIEnv* env, jclass, jbyte port, jint size)
{
SERIALJNI_LOG(logDEBUG) << "Setting Serial Read Buffer Size"; SERIALJNI_LOG(logDEBUG) << "Setting Serial Read Buffer Size";
SERIALJNI_LOG(logDEBUG) << "Size: " << size; SERIALJNI_LOG(logDEBUG) << "Size: " << size;
int32_t status = 0; int32_t status = 0;
HAL_SetOSSerialReadBufferSize(static_cast<HAL_SerialPort>(port), size, &status); HAL_SetOSSerialReadBufferSize(static_cast<HAL_SerialPort>(port), size,
&status);
SERIALJNI_LOG(logDEBUG) << "Status = " << status; SERIALJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status); CheckStatus(env, status);
} }
@@ -210,12 +224,14 @@ Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetReadBufferSize(
* Signature: (BI)V * Signature: (BI)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetWriteBufferSize( Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetWriteBufferSize
JNIEnv* env, jclass, jbyte port, jint size) { (JNIEnv* env, jclass, jbyte port, jint size)
{
SERIALJNI_LOG(logDEBUG) << "Setting Serial Write Buffer Size"; SERIALJNI_LOG(logDEBUG) << "Setting Serial Write Buffer Size";
SERIALJNI_LOG(logDEBUG) << "Size: " << size; SERIALJNI_LOG(logDEBUG) << "Size: " << size;
int32_t status = 0; int32_t status = 0;
HAL_SetOSSerialWriteBufferSize(static_cast<HAL_SerialPort>(port), size, &status); HAL_SetOSSerialWriteBufferSize(static_cast<HAL_SerialPort>(port), size,
&status);
SERIALJNI_LOG(logDEBUG) << "Status = " << status; SERIALJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status); CheckStatus(env, status);
} }
@@ -226,11 +242,13 @@ Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetWriteBufferSize(
* Signature: (B)I * Signature: (B)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialGetBytesReceived( Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialGetBytesReceived
JNIEnv* env, jclass, jbyte port) { (JNIEnv* env, jclass, jbyte port)
{
SERIALJNI_LOG(logDEBUG) << "Serial Get Bytes Received"; SERIALJNI_LOG(logDEBUG) << "Serial Get Bytes Received";
int32_t status = 0; int32_t status = 0;
jint retVal = HAL_GetOSSerialBytesReceived(static_cast<HAL_SerialPort>(port), &status); jint retVal =
HAL_GetOSSerialBytesReceived(static_cast<HAL_SerialPort>(port), &status);
SERIALJNI_LOG(logDEBUG) << "Status = " << status; SERIALJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status); CheckStatus(env, status);
return retVal; return retVal;
@@ -241,16 +259,18 @@ Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialGetBytesReceived(
* Method: serialRead * Method: serialRead
* Signature: (B[BI)I * Signature: (B[BI)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialRead( JNIEXPORT jint JNICALL
JNIEnv* env, jclass, jbyte port, jbyteArray dataReceived, jint size) { Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialRead
(JNIEnv* env, jclass, jbyte port, jbyteArray dataReceived, jint size)
{
SERIALJNI_LOG(logDEBUG) << "Serial Read"; SERIALJNI_LOG(logDEBUG) << "Serial Read";
wpi::SmallVector<char, 128> recvBuf; wpi::SmallVector<char, 128> recvBuf;
recvBuf.resize(size); recvBuf.resize(size);
int32_t status = 0; int32_t status = 0;
jint retVal = HAL_ReadOSSerial(static_cast<HAL_SerialPort>(port), recvBuf.data(), jint retVal = HAL_ReadOSSerial(static_cast<HAL_SerialPort>(port),
size, &status); recvBuf.data(), size, &status);
env->SetByteArrayRegion(dataReceived, 0, size, env->SetByteArrayRegion(dataReceived, 0, size,
reinterpret_cast<const jbyte *>(recvBuf.data())); reinterpret_cast<const jbyte*>(recvBuf.data()));
SERIALJNI_LOG(logDEBUG) << "ReturnValue = " << retVal; SERIALJNI_LOG(logDEBUG) << "ReturnValue = " << retVal;
SERIALJNI_LOG(logDEBUG) << "Status = " << status; SERIALJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status); CheckStatus(env, status);
@@ -262,13 +282,15 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialRead
* Method: serialWrite * Method: serialWrite
* Signature: (B[BI)I * Signature: (B[BI)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialWrite( JNIEXPORT jint JNICALL
JNIEnv* env, jclass, jbyte port, jbyteArray dataToSend, jint size) { Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialWrite
(JNIEnv* env, jclass, jbyte port, jbyteArray dataToSend, jint size)
{
SERIALJNI_LOG(logDEBUG) << "Serial Write"; SERIALJNI_LOG(logDEBUG) << "Serial Write";
int32_t status = 0; int32_t status = 0;
jint retVal = jint retVal =
HAL_WriteOSSerial(static_cast<HAL_SerialPort>(port), HAL_WriteOSSerial(static_cast<HAL_SerialPort>(port),
reinterpret_cast<const char *>( reinterpret_cast<const char*>(
JByteArrayRef(env, dataToSend).array().data()), JByteArrayRef(env, dataToSend).array().data()),
size, &status); size, &status);
SERIALJNI_LOG(logDEBUG) << "ReturnValue = " << retVal; SERIALJNI_LOG(logDEBUG) << "ReturnValue = " << retVal;
@@ -282,8 +304,10 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialWrit
* Method: serialFlush * Method: serialFlush
* Signature: (B)V * Signature: (B)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialFlush( JNIEXPORT void JNICALL
JNIEnv* env, jclass, jbyte port) { Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialFlush
(JNIEnv* env, jclass, jbyte port)
{
SERIALJNI_LOG(logDEBUG) << "Serial Flush"; SERIALJNI_LOG(logDEBUG) << "Serial Flush";
int32_t status = 0; int32_t status = 0;
HAL_FlushOSSerial(static_cast<HAL_SerialPort>(port), &status); HAL_FlushOSSerial(static_cast<HAL_SerialPort>(port), &status);
@@ -296,8 +320,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialFlus
* Method: serialClear * Method: serialClear
* Signature: (B)V * Signature: (B)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialClear( JNIEXPORT void JNICALL
JNIEnv* env, jclass, jbyte port) { Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialClear
(JNIEnv* env, jclass, jbyte port)
{
SERIALJNI_LOG(logDEBUG) << "Serial Clear"; SERIALJNI_LOG(logDEBUG) << "Serial Clear";
int32_t status = 0; int32_t status = 0;
HAL_ClearOSSerial(static_cast<HAL_SerialPort>(port), &status); HAL_ClearOSSerial(static_cast<HAL_SerialPort>(port), &status);
@@ -310,8 +336,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialClea
* Method: serialClose * Method: serialClose
* Signature: (B)V * Signature: (B)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialClose( JNIEXPORT void JNICALL
JNIEnv* env, jclass, jbyte port) { Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialClose
(JNIEnv* env, jclass, jbyte port)
{
SERIALJNI_LOG(logDEBUG) << "Serial Close"; SERIALJNI_LOG(logDEBUG) << "Serial Close";
int32_t status = 0; int32_t status = 0;
HAL_CloseOSSerial(static_cast<HAL_SerialPort>(port), &status); HAL_CloseOSSerial(static_cast<HAL_SerialPort>(port), &status);

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */ /* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */
@@ -16,11 +16,13 @@ extern "C" {
/* /*
* Class: edu_wpi_first_wpilibj_hal_PDPJNI * Class: edu_wpi_first_wpilibj_hal_PDPJNI
* Method: getPDPTemperature * Method: initializePDP
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PDPJNI_initializePDP( JNIEXPORT void JNICALL
JNIEnv *env, jclass, jint module) { Java_edu_wpi_first_wpilibj_hal_PDPJNI_initializePDP
(JNIEnv* env, jclass, jint module)
{
int32_t status = 0; int32_t status = 0;
HAL_InitializePDP(module, &status); HAL_InitializePDP(module, &status);
CheckStatusRange(env, status, 0, HAL_GetNumPDPModules(), module); CheckStatusRange(env, status, 0, HAL_GetNumPDPModules(), module);
@@ -29,20 +31,24 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PDPJNI_initializePDP(
/* /*
* Class: edu_wpi_first_wpilibj_hal_PDPJNI * Class: edu_wpi_first_wpilibj_hal_PDPJNI
* Method: checkPDPChannel * Method: checkPDPChannel
* Signature: (I)Z; * Signature: (I)Z
*/ */
JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_PDPJNI_checkPDPChannel( JNIEXPORT jboolean JNICALL
JNIEnv *env, jclass, jint channel) { Java_edu_wpi_first_wpilibj_hal_PDPJNI_checkPDPChannel
(JNIEnv* env, jclass, jint channel)
{
return HAL_CheckPDPChannel(channel); return HAL_CheckPDPChannel(channel);
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_PDPJNI * Class: edu_wpi_first_wpilibj_hal_PDPJNI
* Method: checkPDPModule * Method: checkPDPModule
* Signature: (I)Z; * Signature: (I)Z
*/ */
JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_PDPJNI_checkPDPModule( JNIEXPORT jboolean JNICALL
JNIEnv *env, jclass, jint module) { Java_edu_wpi_first_wpilibj_hal_PDPJNI_checkPDPModule
(JNIEnv* env, jclass, jint module)
{
return HAL_CheckPDPModule(module); return HAL_CheckPDPModule(module);
} }
@@ -52,8 +58,9 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_PDPJNI_checkPDPModule(
* Signature: (I)D * Signature: (I)D
*/ */
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPTemperature( Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPTemperature
JNIEnv *env, jclass, jint module) { (JNIEnv* env, jclass, jint module)
{
int32_t status = 0; int32_t status = 0;
double temperature = HAL_GetPDPTemperature(module, &status); double temperature = HAL_GetPDPTemperature(module, &status);
CheckStatus(env, status, false); CheckStatus(env, status, false);
@@ -65,8 +72,10 @@ Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPTemperature(
* Method: getPDPVoltage * Method: getPDPVoltage
* Signature: (I)D * Signature: (I)D
*/ */
JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPVoltage( JNIEXPORT jdouble JNICALL
JNIEnv *env, jclass, jint module) { Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPVoltage
(JNIEnv* env, jclass, jint module)
{
int32_t status = 0; int32_t status = 0;
double voltage = HAL_GetPDPVoltage(module, &status); double voltage = HAL_GetPDPVoltage(module, &status);
CheckStatus(env, status, false); CheckStatus(env, status, false);
@@ -79,8 +88,9 @@ JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPVoltage(
* Signature: (BI)D * Signature: (BI)D
*/ */
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPChannelCurrent( Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPChannelCurrent
JNIEnv *env, jclass, jbyte channel, jint module) { (JNIEnv* env, jclass, jbyte channel, jint module)
{
int32_t status = 0; int32_t status = 0;
double current = HAL_GetPDPChannelCurrent(module, channel, &status); double current = HAL_GetPDPChannelCurrent(module, channel, &status);
CheckStatus(env, status, false); CheckStatus(env, status, false);
@@ -93,8 +103,9 @@ Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPChannelCurrent(
* Signature: (I)D * Signature: (I)D
*/ */
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPTotalCurrent( Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPTotalCurrent
JNIEnv *env, jclass, jint module) { (JNIEnv* env, jclass, jint module)
{
int32_t status = 0; int32_t status = 0;
double current = HAL_GetPDPTotalCurrent(module, &status); double current = HAL_GetPDPTotalCurrent(module, &status);
CheckStatus(env, status, false); CheckStatus(env, status, false);
@@ -107,8 +118,9 @@ Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPTotalCurrent(
* Signature: (I)D * Signature: (I)D
*/ */
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPTotalPower( Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPTotalPower
JNIEnv *env, jclass, jint module) { (JNIEnv* env, jclass, jint module)
{
int32_t status = 0; int32_t status = 0;
double power = HAL_GetPDPTotalPower(module, &status); double power = HAL_GetPDPTotalPower(module, &status);
CheckStatus(env, status, false); CheckStatus(env, status, false);
@@ -117,12 +129,13 @@ Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPTotalPower(
/* /*
* Class: edu_wpi_first_wpilibj_hal_PDPJNI * Class: edu_wpi_first_wpilibj_hal_PDPJNI
* Method: resetPDPTotalEnergy * Method: getPDPTotalEnergy
* Signature: (I)D * Signature: (I)D
*/ */
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPTotalEnergy( Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPTotalEnergy
JNIEnv *env, jclass, jint module) { (JNIEnv* env, jclass, jint module)
{
int32_t status = 0; int32_t status = 0;
double energy = HAL_GetPDPTotalEnergy(module, &status); double energy = HAL_GetPDPTotalEnergy(module, &status);
CheckStatus(env, status, false); CheckStatus(env, status, false);
@@ -135,8 +148,9 @@ Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPTotalEnergy(
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_PDPJNI_resetPDPTotalEnergy( Java_edu_wpi_first_wpilibj_hal_PDPJNI_resetPDPTotalEnergy
JNIEnv *env, jclass, jint module) { (JNIEnv* env, jclass, jint module)
{
int32_t status = 0; int32_t status = 0;
HAL_ResetPDPTotalEnergy(module, &status); HAL_ResetPDPTotalEnergy(module, &status);
CheckStatus(env, status, false); CheckStatus(env, status, false);
@@ -144,12 +158,13 @@ Java_edu_wpi_first_wpilibj_hal_PDPJNI_resetPDPTotalEnergy(
/* /*
* Class: edu_wpi_first_wpilibj_hal_PDPJNI * Class: edu_wpi_first_wpilibj_hal_PDPJNI
* Method: clearStickyFaults * Method: clearPDPStickyFaults
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_PDPJNI_clearPDPStickyFaults( Java_edu_wpi_first_wpilibj_hal_PDPJNI_clearPDPStickyFaults
JNIEnv *env, jclass, jint module) { (JNIEnv* env, jclass, jint module)
{
int32_t status = 0; int32_t status = 0;
HAL_ClearPDPStickyFaults(module, &status); HAL_ClearPDPStickyFaults(module, &status);
CheckStatus(env, status, false); CheckStatus(env, status, false);

View File

@@ -1,21 +1,21 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */ /* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
#include <assert.h>
#include <jni.h> #include <jni.h>
#include "HAL/cpp/Log.h"
#include "edu_wpi_first_wpilibj_hal_PWMJNI.h" #include <cassert>
#include "HAL/DIO.h" #include "HAL/DIO.h"
#include "HAL/PWM.h" #include "HAL/PWM.h"
#include "HAL/Ports.h" #include "HAL/Ports.h"
#include "HALUtil.h" #include "HAL/cpp/Log.h"
#include "HAL/handles/HandlesInternal.h" #include "HAL/handles/HandlesInternal.h"
#include "HALUtil.h"
#include "edu_wpi_first_wpilibj_hal_PWMJNI.h"
using namespace frc; using namespace frc;
@@ -26,18 +26,19 @@ TLogLevel pwmJNILogLevel = logWARNING;
if (level > pwmJNILogLevel) \ if (level > pwmJNILogLevel) \
; \ ; \
else \ else \
Log().Get(level) Log().Get(level)
extern "C" { extern "C" {
/* /*
* Class: edu_wpi_first_wpilibj_hal_PWMJNI * Class: edu_wpi_first_wpilibj_hal_PWMJNI
* Method: initializePWMPort * Method: initializePWMPort
* Signature: (I)I; * Signature: (I)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_PWMJNI_initializePWMPort( Java_edu_wpi_first_wpilibj_hal_PWMJNI_initializePWMPort
JNIEnv *env, jclass, jint id) { (JNIEnv* env, jclass, jint id)
{
PWMJNI_LOG(logDEBUG) << "Calling PWMJNI initializePWMPort"; PWMJNI_LOG(logDEBUG) << "Calling PWMJNI initializePWMPort";
PWMJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_PortHandle)id; PWMJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_PortHandle)id;
int32_t status = 0; int32_t status = 0;
@@ -52,22 +53,26 @@ Java_edu_wpi_first_wpilibj_hal_PWMJNI_initializePWMPort(
/* /*
* Class: edu_wpi_first_wpilibj_hal_PWMJNI * Class: edu_wpi_first_wpilibj_hal_PWMJNI
* Method: checkPWMChannel * Method: checkPWMChannel
* Signature: (I)Z; * Signature: (I)Z
*/ */
JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_checkPWMChannel( JNIEXPORT jboolean JNICALL
JNIEnv *env, jclass, jint channel) { Java_edu_wpi_first_wpilibj_hal_PWMJNI_checkPWMChannel
(JNIEnv* env, jclass, jint channel)
{
PWMJNI_LOG(logDEBUG) << "Calling PWMJNI checkPWMChannel"; PWMJNI_LOG(logDEBUG) << "Calling PWMJNI checkPWMChannel";
PWMJNI_LOG(logDEBUG) << "Channel = " << channel; PWMJNI_LOG(logDEBUG) << "Channel = " << channel;
return HAL_CheckPWMChannel(channel); return HAL_CheckPWMChannel(channel);
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_DIOJNI * Class: edu_wpi_first_wpilibj_hal_PWMJNI
* Method: freeDIOPort * Method: freePWMPort
* Signature: (I)V; * Signature: (I)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_freePWMPort( JNIEXPORT void JNICALL
JNIEnv *env, jclass, jint id) { Java_edu_wpi_first_wpilibj_hal_PWMJNI_freePWMPort
(JNIEnv* env, jclass, jint id)
{
PWMJNI_LOG(logDEBUG) << "Calling PWMJNI freePWMPort"; PWMJNI_LOG(logDEBUG) << "Calling PWMJNI freePWMPort";
PWMJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_DigitalHandle)id; PWMJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_DigitalHandle)id;
int32_t status = 0; int32_t status = 0;
@@ -76,44 +81,50 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_freePWMPort(
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_DIOJNI * Class: edu_wpi_first_wpilibj_hal_PWMJNI
* Method: setPWMConfigRaw * Method: setPWMConfigRaw
* Signature: (IIIIII)V; * Signature: (IIIIII)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMConfigRaw( JNIEXPORT void JNICALL
JNIEnv *env, jclass, jint id, jint maxPwm, jint deadbandMaxPwm, Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMConfigRaw
jint centerPwm, jint deadbandMinPwm, jint minPwm) { (JNIEnv* env, jclass, jint id, jint maxPwm, jint deadbandMaxPwm,
jint centerPwm, jint deadbandMinPwm, jint minPwm)
{
PWMJNI_LOG(logDEBUG) << "Calling PWMJNI setPWMConfigRaw"; PWMJNI_LOG(logDEBUG) << "Calling PWMJNI setPWMConfigRaw";
PWMJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_DigitalHandle)id; PWMJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_DigitalHandle)id;
int32_t status = 0; int32_t status = 0;
HAL_SetPWMConfigRaw((HAL_DigitalHandle)id, maxPwm, deadbandMaxPwm, centerPwm, HAL_SetPWMConfigRaw((HAL_DigitalHandle)id, maxPwm, deadbandMaxPwm, centerPwm,
deadbandMinPwm, minPwm, &status); deadbandMinPwm, minPwm, &status);
CheckStatus(env, status); CheckStatus(env, status);
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_DIOJNI * Class: edu_wpi_first_wpilibj_hal_PWMJNI
* Method: setPWMConfig * Method: setPWMConfig
* Signature: (IDDDDD)V; * Signature: (IDDDDD)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMConfig( JNIEXPORT void JNICALL
JNIEnv *env, jclass, jint id, jdouble maxPwm, jdouble deadbandMaxPwm, Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMConfig
jdouble centerPwm, jdouble deadbandMinPwm, jdouble minPwm) { (JNIEnv* env, jclass, jint id, jdouble maxPwm, jdouble deadbandMaxPwm,
jdouble centerPwm, jdouble deadbandMinPwm, jdouble minPwm)
{
PWMJNI_LOG(logDEBUG) << "Calling PWMJNI setPWMConfig"; PWMJNI_LOG(logDEBUG) << "Calling PWMJNI setPWMConfig";
PWMJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_DigitalHandle)id; PWMJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_DigitalHandle)id;
int32_t status = 0; int32_t status = 0;
HAL_SetPWMConfig((HAL_DigitalHandle)id, maxPwm, deadbandMaxPwm, centerPwm, HAL_SetPWMConfig((HAL_DigitalHandle)id, maxPwm, deadbandMaxPwm, centerPwm,
deadbandMinPwm, minPwm, &status); deadbandMinPwm, minPwm, &status);
CheckStatus(env, status); CheckStatus(env, status);
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_DIOJNI * Class: edu_wpi_first_wpilibj_hal_PWMJNI
* Method: getPWMConfigRaw * Method: getPWMConfigRaw
* Signature: (I)Ledu/wpi/first/wpilibj/PWMConfigDataResult; * Signature: (I)Ljava/lang/Object;
*/ */
JNIEXPORT jobject JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_getPWMConfigRaw( JNIEXPORT jobject JNICALL
JNIEnv *env, jclass, jint id) { Java_edu_wpi_first_wpilibj_hal_PWMJNI_getPWMConfigRaw
(JNIEnv* env, jclass, jint id)
{
PWMJNI_LOG(logDEBUG) << "Calling PWMJNI getPWMConfigRaw"; PWMJNI_LOG(logDEBUG) << "Calling PWMJNI getPWMConfigRaw";
PWMJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_DigitalHandle)id; PWMJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_DigitalHandle)id;
int32_t status = 0; int32_t status = 0;
@@ -122,8 +133,8 @@ JNIEXPORT jobject JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_getPWMConfigRaw(
int32_t centerPwm = 0; int32_t centerPwm = 0;
int32_t deadbandMinPwm = 0; int32_t deadbandMinPwm = 0;
int32_t minPwm = 0; int32_t minPwm = 0;
HAL_GetPWMConfigRaw((HAL_DigitalHandle)id, &maxPwm, &deadbandMaxPwm, &centerPwm, HAL_GetPWMConfigRaw((HAL_DigitalHandle)id, &maxPwm, &deadbandMaxPwm,
&deadbandMinPwm, &minPwm, &status); &centerPwm, &deadbandMinPwm, &minPwm, &status);
CheckStatus(env, status); CheckStatus(env, status);
return CreatePWMConfigDataResult(env, maxPwm, deadbandMaxPwm, centerPwm, return CreatePWMConfigDataResult(env, maxPwm, deadbandMaxPwm, centerPwm,
deadbandMinPwm, minPwm); deadbandMinPwm, minPwm);
@@ -134,8 +145,10 @@ JNIEXPORT jobject JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_getPWMConfigRaw(
* Method: setPWMEliminateDeadband * Method: setPWMEliminateDeadband
* Signature: (IZ)V * Signature: (IZ)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMEliminateDeadband( JNIEXPORT void JNICALL
JNIEnv* env, jclass, jint id, jboolean value) { Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMEliminateDeadband
(JNIEnv* env, jclass, jint id, jboolean value)
{
PWMJNI_LOG(logDEBUG) << "PWM Handle = " << (HAL_DigitalHandle)id; PWMJNI_LOG(logDEBUG) << "PWM Handle = " << (HAL_DigitalHandle)id;
int32_t status = 0; int32_t status = 0;
HAL_SetPWMEliminateDeadband((HAL_DigitalHandle)id, value, &status); HAL_SetPWMEliminateDeadband((HAL_DigitalHandle)id, value, &status);
@@ -148,8 +161,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMEliminateDead
* Method: getPWMEliminateDeadband * Method: getPWMEliminateDeadband
* Signature: (I)Z * Signature: (I)Z
*/ */
JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_getPWMEliminateDeadband( JNIEXPORT jboolean JNICALL
JNIEnv* env, jclass, jint id) { Java_edu_wpi_first_wpilibj_hal_PWMJNI_getPWMEliminateDeadband
(JNIEnv* env, jclass, jint id)
{
PWMJNI_LOG(logDEBUG) << "PWM Handle = " << (HAL_DigitalHandle)id; PWMJNI_LOG(logDEBUG) << "PWM Handle = " << (HAL_DigitalHandle)id;
int32_t status = 0; int32_t status = 0;
auto val = HAL_GetPWMEliminateDeadband((HAL_DigitalHandle)id, &status); auto val = HAL_GetPWMEliminateDeadband((HAL_DigitalHandle)id, &status);
@@ -163,8 +178,10 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_getPWMEliminate
* Method: setPWMRaw * Method: setPWMRaw
* Signature: (IS)V * Signature: (IS)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMRaw( JNIEXPORT void JNICALL
JNIEnv* env, jclass, jint id, jshort value) { Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMRaw
(JNIEnv* env, jclass, jint id, jshort value)
{
PWMJNI_LOG(logDEBUG) << "PWM Handle = " << (HAL_DigitalHandle)id; PWMJNI_LOG(logDEBUG) << "PWM Handle = " << (HAL_DigitalHandle)id;
PWMJNI_LOG(logDEBUG) << "PWM Value = " << value; PWMJNI_LOG(logDEBUG) << "PWM Value = " << value;
int32_t status = 0; int32_t status = 0;
@@ -178,8 +195,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMRaw(
* Method: setPWMSpeed * Method: setPWMSpeed
* Signature: (ID)V * Signature: (ID)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMSpeed( JNIEXPORT void JNICALL
JNIEnv* env, jclass, jint id, jdouble value) { Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMSpeed
(JNIEnv* env, jclass, jint id, jdouble value)
{
PWMJNI_LOG(logDEBUG) << "PWM Handle = " << (HAL_DigitalHandle)id; PWMJNI_LOG(logDEBUG) << "PWM Handle = " << (HAL_DigitalHandle)id;
PWMJNI_LOG(logDEBUG) << "PWM Value = " << value; PWMJNI_LOG(logDEBUG) << "PWM Value = " << value;
int32_t status = 0; int32_t status = 0;
@@ -193,8 +212,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMSpeed(
* Method: setPWMPosition * Method: setPWMPosition
* Signature: (ID)V * Signature: (ID)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMPosition( JNIEXPORT void JNICALL
JNIEnv* env, jclass, jint id, jdouble value) { Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMPosition
(JNIEnv* env, jclass, jint id, jdouble value)
{
PWMJNI_LOG(logDEBUG) << "PWM Handle = " << (HAL_DigitalHandle)id; PWMJNI_LOG(logDEBUG) << "PWM Handle = " << (HAL_DigitalHandle)id;
PWMJNI_LOG(logDEBUG) << "PWM Value = " << value; PWMJNI_LOG(logDEBUG) << "PWM Value = " << value;
int32_t status = 0; int32_t status = 0;
@@ -209,8 +230,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMPosition(
* Signature: (I)S * Signature: (I)S
*/ */
JNIEXPORT jshort JNICALL JNIEXPORT jshort JNICALL
Java_edu_wpi_first_wpilibj_hal_PWMJNI_getPWMRaw( Java_edu_wpi_first_wpilibj_hal_PWMJNI_getPWMRaw
JNIEnv* env, jclass, jint id) { (JNIEnv* env, jclass, jint id)
{
PWMJNI_LOG(logDEBUG) << "PWM Handle = " << (HAL_DigitalHandle)id; PWMJNI_LOG(logDEBUG) << "PWM Handle = " << (HAL_DigitalHandle)id;
int32_t status = 0; int32_t status = 0;
jshort returnValue = HAL_GetPWMRaw((HAL_DigitalHandle)id, &status); jshort returnValue = HAL_GetPWMRaw((HAL_DigitalHandle)id, &status);
@@ -226,8 +248,9 @@ Java_edu_wpi_first_wpilibj_hal_PWMJNI_getPWMRaw(
* Signature: (I)D * Signature: (I)D
*/ */
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_wpilibj_hal_PWMJNI_getPWMSpeed( Java_edu_wpi_first_wpilibj_hal_PWMJNI_getPWMSpeed
JNIEnv* env, jclass, jint id) { (JNIEnv* env, jclass, jint id)
{
PWMJNI_LOG(logDEBUG) << "PWM Handle = " << (HAL_DigitalHandle)id; PWMJNI_LOG(logDEBUG) << "PWM Handle = " << (HAL_DigitalHandle)id;
int32_t status = 0; int32_t status = 0;
jdouble returnValue = HAL_GetPWMSpeed((HAL_DigitalHandle)id, &status); jdouble returnValue = HAL_GetPWMSpeed((HAL_DigitalHandle)id, &status);
@@ -243,8 +266,9 @@ Java_edu_wpi_first_wpilibj_hal_PWMJNI_getPWMSpeed(
* Signature: (I)D * Signature: (I)D
*/ */
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_wpilibj_hal_PWMJNI_getPWMPosition( Java_edu_wpi_first_wpilibj_hal_PWMJNI_getPWMPosition
JNIEnv* env, jclass, jint id) { (JNIEnv* env, jclass, jint id)
{
PWMJNI_LOG(logDEBUG) << "PWM Handle = " << (HAL_DigitalHandle)id; PWMJNI_LOG(logDEBUG) << "PWM Handle = " << (HAL_DigitalHandle)id;
int32_t status = 0; int32_t status = 0;
jdouble returnValue = HAL_GetPWMPosition((HAL_DigitalHandle)id, &status); jdouble returnValue = HAL_GetPWMPosition((HAL_DigitalHandle)id, &status);
@@ -259,8 +283,10 @@ Java_edu_wpi_first_wpilibj_hal_PWMJNI_getPWMPosition(
* Method: setPWMDisabled * Method: setPWMDisabled
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMDisabled( JNIEXPORT void JNICALL
JNIEnv* env, jclass, jint id) { Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMDisabled
(JNIEnv* env, jclass, jint id)
{
PWMJNI_LOG(logDEBUG) << "PWM Handle = " << (HAL_DigitalHandle)id; PWMJNI_LOG(logDEBUG) << "PWM Handle = " << (HAL_DigitalHandle)id;
int32_t status = 0; int32_t status = 0;
HAL_SetPWMDisabled((HAL_DigitalHandle)id, &status); HAL_SetPWMDisabled((HAL_DigitalHandle)id, &status);
@@ -273,8 +299,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMDisabled(
* Method: latchPWMZero * Method: latchPWMZero
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_latchPWMZero( JNIEXPORT void JNICALL
JNIEnv* env, jclass, jint id) { Java_edu_wpi_first_wpilibj_hal_PWMJNI_latchPWMZero
(JNIEnv* env, jclass, jint id)
{
PWMJNI_LOG(logDEBUG) << "PWM Handle = " << (HAL_DigitalHandle)id; PWMJNI_LOG(logDEBUG) << "PWM Handle = " << (HAL_DigitalHandle)id;
int32_t status = 0; int32_t status = 0;
HAL_LatchPWMZero((HAL_DigitalHandle)id, &status); HAL_LatchPWMZero((HAL_DigitalHandle)id, &status);
@@ -287,8 +315,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_latchPWMZero(
* Method: setPWMPeriodScale * Method: setPWMPeriodScale
* Signature: (II)V * Signature: (II)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMPeriodScale( JNIEXPORT void JNICALL
JNIEnv* env, jclass, jint id, jint value) { Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMPeriodScale
(JNIEnv* env, jclass, jint id, jint value)
{
PWMJNI_LOG(logDEBUG) << "PWM Handle = " << (HAL_DigitalHandle)id; PWMJNI_LOG(logDEBUG) << "PWM Handle = " << (HAL_DigitalHandle)id;
PWMJNI_LOG(logDEBUG) << "PeriodScale Value = " << value; PWMJNI_LOG(logDEBUG) << "PeriodScale Value = " << value;
int32_t status = 0; int32_t status = 0;

View File

@@ -1,18 +1,18 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */ /* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
#include <assert.h>
#include <jni.h> #include <jni.h>
#include "HAL/cpp/Log.h"
#include "edu_wpi_first_wpilibj_hal_PortsJNI.h" #include <cassert>
#include "HAL/Ports.h" #include "HAL/Ports.h"
#include "HAL/cpp/Log.h"
#include "HALUtil.h" #include "HALUtil.h"
#include "edu_wpi_first_wpilibj_hal_PortsJNI.h"
using namespace frc; using namespace frc;
@@ -21,9 +21,9 @@ TLogLevel portsJNILogLevel = logWARNING;
#define PORTSJNI_LOG(level) \ #define PORTSJNI_LOG(level) \
if (level > portsJNILogLevel) \ if (level > portsJNILogLevel) \
; \ ; \
else \ else \
Log().Get(level) Log().Get(level)
extern "C" { extern "C" {
/* /*
@@ -32,266 +32,267 @@ extern "C" {
* Signature: ()I * Signature: ()I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumAccumulators( Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumAccumulators
JNIEnv *env, jclass) { (JNIEnv* env, jclass)
{
PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumAccumulators"; PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumAccumulators";
jint value = HAL_GetNumAccumulators(); jint value = HAL_GetNumAccumulators();
PORTSJNI_LOG(logDEBUG) << "Value = " << value; PORTSJNI_LOG(logDEBUG) << "Value = " << value;
return value; return value;
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_PortsJNI * Class: edu_wpi_first_wpilibj_hal_PortsJNI
* Method: getNumAnalogTriggers * Method: getNumAnalogTriggers
* Signature: ()I * Signature: ()I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumAnalogTriggers( Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumAnalogTriggers
JNIEnv *env, jclass) { (JNIEnv* env, jclass)
{
PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumAnalogTriggers"; PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumAnalogTriggers";
jint value = HAL_GetNumAnalogTriggers(); jint value = HAL_GetNumAnalogTriggers();
PORTSJNI_LOG(logDEBUG) << "Value = " << value; PORTSJNI_LOG(logDEBUG) << "Value = " << value;
return value; return value;
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_PortsJNI * Class: edu_wpi_first_wpilibj_hal_PortsJNI
* Method: getNumAnalogInputs * Method: getNumAnalogInputs
* Signature: ()I * Signature: ()I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumAnalogInputs( Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumAnalogInputs
JNIEnv *env, jclass) { (JNIEnv* env, jclass)
{
PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumAnalogInputs"; PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumAnalogInputs";
jint value = HAL_GetNumAnalogInputs(); jint value = HAL_GetNumAnalogInputs();
PORTSJNI_LOG(logDEBUG) << "Value = " << value; PORTSJNI_LOG(logDEBUG) << "Value = " << value;
return value; return value;
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_PortsJNI * Class: edu_wpi_first_wpilibj_hal_PortsJNI
* Method: getNumAnalogOutputs * Method: getNumAnalogOutputs
* Signature: ()I * Signature: ()I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumAnalogOutputs( Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumAnalogOutputs
JNIEnv *env, jclass) { (JNIEnv* env, jclass)
{
PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumAnalogOutputs"; PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumAnalogOutputs";
jint value = HAL_GetNumAnalogOutputs(); jint value = HAL_GetNumAnalogOutputs();
PORTSJNI_LOG(logDEBUG) << "Value = " << value; PORTSJNI_LOG(logDEBUG) << "Value = " << value;
return value; return value;
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_PortsJNI * Class: edu_wpi_first_wpilibj_hal_PortsJNI
* Method: getNumCounters * Method: getNumCounters
* Signature: ()I * Signature: ()I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumCounters( Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumCounters
JNIEnv *env, jclass) { (JNIEnv* env, jclass)
{
PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumCounters"; PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumCounters";
jint value = HAL_GetNumCounters(); jint value = HAL_GetNumCounters();
PORTSJNI_LOG(logDEBUG) << "Value = " << value; PORTSJNI_LOG(logDEBUG) << "Value = " << value;
return value; return value;
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_PortsJNI * Class: edu_wpi_first_wpilibj_hal_PortsJNI
* Method: getNumDigitalHeaders * Method: getNumDigitalHeaders
* Signature: ()I * Signature: ()I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumDigitalHeaders( Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumDigitalHeaders
JNIEnv *env, jclass) { (JNIEnv* env, jclass)
{
PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumDigitalHeaders"; PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumDigitalHeaders";
jint value = HAL_GetNumDigitalHeaders(); jint value = HAL_GetNumDigitalHeaders();
PORTSJNI_LOG(logDEBUG) << "Value = " << value; PORTSJNI_LOG(logDEBUG) << "Value = " << value;
return value; return value;
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_PortsJNI * Class: edu_wpi_first_wpilibj_hal_PortsJNI
* Method: getNumPWMHeaders * Method: getNumPWMHeaders
* Signature: ()I * Signature: ()I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumPWMHeaders( Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumPWMHeaders
JNIEnv *env, jclass) { (JNIEnv* env, jclass)
{
PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumPWMHeaders"; PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumPWMHeaders";
jint value = HAL_GetNumPWMHeaders(); jint value = HAL_GetNumPWMHeaders();
PORTSJNI_LOG(logDEBUG) << "Value = " << value; PORTSJNI_LOG(logDEBUG) << "Value = " << value;
return value; return value;
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_PortsJNI * Class: edu_wpi_first_wpilibj_hal_PortsJNI
* Method: getNumDigitalChannels * Method: getNumDigitalChannels
* Signature: ()I * Signature: ()I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumDigitalChannels( Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumDigitalChannels
JNIEnv *env, jclass) { (JNIEnv* env, jclass)
{
PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumDigitalChannels"; PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumDigitalChannels";
jint value = HAL_GetNumDigitalChannels(); jint value = HAL_GetNumDigitalChannels();
PORTSJNI_LOG(logDEBUG) << "Value = " << value; PORTSJNI_LOG(logDEBUG) << "Value = " << value;
return value; return value;
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_PortsJNI * Class: edu_wpi_first_wpilibj_hal_PortsJNI
* Method: getNumPWMChannels * Method: getNumPWMChannels
* Signature: ()I * Signature: ()I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumPWMChannels( Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumPWMChannels
JNIEnv *env, jclass) { (JNIEnv* env, jclass)
{
PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumPWMChannels"; PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumPWMChannels";
jint value = HAL_GetNumPWMChannels(); jint value = HAL_GetNumPWMChannels();
PORTSJNI_LOG(logDEBUG) << "Value = " << value; PORTSJNI_LOG(logDEBUG) << "Value = " << value;
return value; return value;
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_PortsJNI * Class: edu_wpi_first_wpilibj_hal_PortsJNI
* Method: getNumDigitalPWMOutputs * Method: getNumDigitalPWMOutputs
* Signature: ()I * Signature: ()I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumDigitalPWMOutputs( Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumDigitalPWMOutputs
JNIEnv *env, jclass) { (JNIEnv* env, jclass)
{
PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumDigitalPWMOutputs"; PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumDigitalPWMOutputs";
jint value = HAL_GetNumDigitalPWMOutputs(); jint value = HAL_GetNumDigitalPWMOutputs();
PORTSJNI_LOG(logDEBUG) << "Value = " << value; PORTSJNI_LOG(logDEBUG) << "Value = " << value;
return value; return value;
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_PortsJNI * Class: edu_wpi_first_wpilibj_hal_PortsJNI
* Method: getNumEncoders * Method: getNumEncoders
* Signature: ()I * Signature: ()I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumEncoders( Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumEncoders
JNIEnv *env, jclass) { (JNIEnv* env, jclass)
{
PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumEncoders"; PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumEncoders";
jint value = HAL_GetNumEncoders(); jint value = HAL_GetNumEncoders();
PORTSJNI_LOG(logDEBUG) << "Value = " << value; PORTSJNI_LOG(logDEBUG) << "Value = " << value;
return value; return value;
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_PortsJNI * Class: edu_wpi_first_wpilibj_hal_PortsJNI
* Method: getNumInterrupts * Method: getNumInterrupts
* Signature: ()I * Signature: ()I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumInterrupts( Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumInterrupts
JNIEnv *env, jclass) { (JNIEnv* env, jclass)
{
PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumInterrupts"; PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumInterrupts";
jint value = HAL_GetNumInterrupts(); jint value = HAL_GetNumInterrupts();
PORTSJNI_LOG(logDEBUG) << "Value = " << value; PORTSJNI_LOG(logDEBUG) << "Value = " << value;
return value; return value;
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_PortsJNI * Class: edu_wpi_first_wpilibj_hal_PortsJNI
* Method: getNumRelayChannels * Method: getNumRelayChannels
* Signature: ()I * Signature: ()I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumRelayChannels( Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumRelayChannels
JNIEnv *env, jclass) { (JNIEnv* env, jclass)
{
PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumRelayChannels"; PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumRelayChannels";
jint value = HAL_GetNumRelayChannels(); jint value = HAL_GetNumRelayChannels();
PORTSJNI_LOG(logDEBUG) << "Value = " << value; PORTSJNI_LOG(logDEBUG) << "Value = " << value;
return value; return value;
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_PortsJNI * Class: edu_wpi_first_wpilibj_hal_PortsJNI
* Method: getNumRelayHeaders * Method: getNumRelayHeaders
* Signature: ()I * Signature: ()I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumRelayHeaders( Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumRelayHeaders
JNIEnv *env, jclass) { (JNIEnv* env, jclass)
{
PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumRelayHeaders"; PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumRelayHeaders";
jint value = HAL_GetNumRelayHeaders(); jint value = HAL_GetNumRelayHeaders();
PORTSJNI_LOG(logDEBUG) << "Value = " << value; PORTSJNI_LOG(logDEBUG) << "Value = " << value;
return value; return value;
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_PortsJNI * Class: edu_wpi_first_wpilibj_hal_PortsJNI
* Method: getNumPCMModules * Method: getNumPCMModules
* Signature: ()I * Signature: ()I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumPCMModules( Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumPCMModules
JNIEnv *env, jclass) { (JNIEnv* env, jclass)
{
PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumPCMModules"; PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumPCMModules";
jint value = HAL_GetNumPCMModules(); jint value = HAL_GetNumPCMModules();
PORTSJNI_LOG(logDEBUG) << "Value = " << value; PORTSJNI_LOG(logDEBUG) << "Value = " << value;
return value; return value;
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_PortsJNI * Class: edu_wpi_first_wpilibj_hal_PortsJNI
* Method: getNumSolenoidChannels * Method: getNumSolenoidChannels
* Signature: ()I * Signature: ()I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumSolenoidChannels( Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumSolenoidChannels
JNIEnv *env, jclass) { (JNIEnv* env, jclass)
{
PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumSolenoidChannels"; PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumSolenoidChannels";
jint value = HAL_GetNumSolenoidChannels(); jint value = HAL_GetNumSolenoidChannels();
PORTSJNI_LOG(logDEBUG) << "Value = " << value; PORTSJNI_LOG(logDEBUG) << "Value = " << value;
return value; return value;
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_PortsJNI * Class: edu_wpi_first_wpilibj_hal_PortsJNI
* Method: getNumPDPModules * Method: getNumPDPModules
* Signature: ()I * Signature: ()I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumPDPModules( Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumPDPModules
JNIEnv *env, jclass) { (JNIEnv* env, jclass)
{
PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumPDPModules"; PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumPDPModules";
jint value = HAL_GetNumPDPModules(); jint value = HAL_GetNumPDPModules();
PORTSJNI_LOG(logDEBUG) << "Value = " << value; PORTSJNI_LOG(logDEBUG) << "Value = " << value;
return value; return value;
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_PortsJNI * Class: edu_wpi_first_wpilibj_hal_PortsJNI
* Method: getNumPDPChannels * Method: getNumPDPChannels
* Signature: ()I * Signature: ()I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumPDPChannels( Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumPDPChannels
JNIEnv *env, jclass) { (JNIEnv* env, jclass)
{
PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumPDPChannels"; PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumPDPChannels";
jint value = HAL_GetNumPDPChannels(); jint value = HAL_GetNumPDPChannels();
PORTSJNI_LOG(logDEBUG) << "Value = " << value; PORTSJNI_LOG(logDEBUG) << "Value = " << value;
return value; return value;
} }
} } // extern "C"

View File

@@ -1,12 +1,13 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */ /* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
#include "HAL/Power.h"
#include <jni.h> #include <jni.h>
#include "HAL/Power.h"
#include "HALUtil.h" #include "HALUtil.h"
#include "edu_wpi_first_wpilibj_hal_PowerJNI.h" #include "edu_wpi_first_wpilibj_hal_PowerJNI.h"
@@ -20,7 +21,9 @@ extern "C" {
* Signature: ()D * Signature: ()D
*/ */
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_wpilibj_hal_PowerJNI_getVinVoltage(JNIEnv* env, jclass) { Java_edu_wpi_first_wpilibj_hal_PowerJNI_getVinVoltage
(JNIEnv* env, jclass)
{
int32_t status = 0; int32_t status = 0;
double val = HAL_GetVinVoltage(&status); double val = HAL_GetVinVoltage(&status);
CheckStatus(env, status); CheckStatus(env, status);
@@ -33,7 +36,9 @@ Java_edu_wpi_first_wpilibj_hal_PowerJNI_getVinVoltage(JNIEnv* env, jclass) {
* Signature: ()D * Signature: ()D
*/ */
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_wpilibj_hal_PowerJNI_getVinCurrent(JNIEnv* env, jclass) { Java_edu_wpi_first_wpilibj_hal_PowerJNI_getVinCurrent
(JNIEnv* env, jclass)
{
int32_t status = 0; int32_t status = 0;
double val = HAL_GetVinCurrent(&status); double val = HAL_GetVinCurrent(&status);
CheckStatus(env, status); CheckStatus(env, status);
@@ -46,7 +51,9 @@ Java_edu_wpi_first_wpilibj_hal_PowerJNI_getVinCurrent(JNIEnv* env, jclass) {
* Signature: ()D * Signature: ()D
*/ */
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserVoltage6V(JNIEnv* env, jclass) { Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserVoltage6V
(JNIEnv* env, jclass)
{
int32_t status = 0; int32_t status = 0;
double val = HAL_GetUserVoltage6V(&status); double val = HAL_GetUserVoltage6V(&status);
CheckStatus(env, status); CheckStatus(env, status);
@@ -59,7 +66,9 @@ Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserVoltage6V(JNIEnv* env, jclass) {
* Signature: ()D * Signature: ()D
*/ */
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserCurrent6V(JNIEnv* env, jclass) { Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserCurrent6V
(JNIEnv* env, jclass)
{
int32_t status = 0; int32_t status = 0;
double val = HAL_GetUserCurrent6V(&status); double val = HAL_GetUserCurrent6V(&status);
CheckStatus(env, status); CheckStatus(env, status);
@@ -72,7 +81,9 @@ Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserCurrent6V(JNIEnv* env, jclass) {
* Signature: ()Z * Signature: ()Z
*/ */
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserActive6V(JNIEnv* env, jclass) { Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserActive6V
(JNIEnv* env, jclass)
{
int32_t status = 0; int32_t status = 0;
bool val = HAL_GetUserActive6V(&status); bool val = HAL_GetUserActive6V(&status);
CheckStatus(env, status); CheckStatus(env, status);
@@ -85,8 +96,9 @@ Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserActive6V(JNIEnv* env, jclass) {
* Signature: ()I * Signature: ()I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserCurrentFaults6V( Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserCurrentFaults6V
JNIEnv* env, jclass) { (JNIEnv* env, jclass)
{
int32_t status = 0; int32_t status = 0;
int32_t val = HAL_GetUserCurrentFaults6V(&status); int32_t val = HAL_GetUserCurrentFaults6V(&status);
CheckStatus(env, status); CheckStatus(env, status);
@@ -99,7 +111,9 @@ Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserCurrentFaults6V(
* Signature: ()D * Signature: ()D
*/ */
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserVoltage5V(JNIEnv* env, jclass) { Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserVoltage5V
(JNIEnv* env, jclass)
{
int32_t status = 0; int32_t status = 0;
double val = HAL_GetUserVoltage5V(&status); double val = HAL_GetUserVoltage5V(&status);
CheckStatus(env, status); CheckStatus(env, status);
@@ -112,7 +126,9 @@ Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserVoltage5V(JNIEnv* env, jclass) {
* Signature: ()D * Signature: ()D
*/ */
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserCurrent5V(JNIEnv* env, jclass) { Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserCurrent5V
(JNIEnv* env, jclass)
{
int32_t status = 0; int32_t status = 0;
double val = HAL_GetUserCurrent5V(&status); double val = HAL_GetUserCurrent5V(&status);
CheckStatus(env, status); CheckStatus(env, status);
@@ -125,7 +141,9 @@ Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserCurrent5V(JNIEnv* env, jclass) {
* Signature: ()Z * Signature: ()Z
*/ */
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserActive5V(JNIEnv* env, jclass) { Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserActive5V
(JNIEnv* env, jclass)
{
int32_t status = 0; int32_t status = 0;
bool val = HAL_GetUserActive5V(&status); bool val = HAL_GetUserActive5V(&status);
CheckStatus(env, status); CheckStatus(env, status);
@@ -138,8 +156,9 @@ Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserActive5V(JNIEnv* env, jclass) {
* Signature: ()I * Signature: ()I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserCurrentFaults5V( Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserCurrentFaults5V
JNIEnv* env, jclass) { (JNIEnv* env, jclass)
{
int32_t status = 0; int32_t status = 0;
int32_t val = HAL_GetUserCurrentFaults5V(&status); int32_t val = HAL_GetUserCurrentFaults5V(&status);
CheckStatus(env, status); CheckStatus(env, status);
@@ -152,7 +171,9 @@ Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserCurrentFaults5V(
* Signature: ()D * Signature: ()D
*/ */
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserVoltage3V3(JNIEnv* env, jclass) { Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserVoltage3V3
(JNIEnv* env, jclass)
{
int32_t status = 0; int32_t status = 0;
double val = HAL_GetUserVoltage3V3(&status); double val = HAL_GetUserVoltage3V3(&status);
CheckStatus(env, status); CheckStatus(env, status);
@@ -165,7 +186,9 @@ Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserVoltage3V3(JNIEnv* env, jclass) {
* Signature: ()D * Signature: ()D
*/ */
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserCurrent3V3(JNIEnv* env, jclass) { Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserCurrent3V3
(JNIEnv* env, jclass)
{
int32_t status = 0; int32_t status = 0;
double val = HAL_GetUserCurrent3V3(&status); double val = HAL_GetUserCurrent3V3(&status);
CheckStatus(env, status); CheckStatus(env, status);
@@ -178,7 +201,9 @@ Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserCurrent3V3(JNIEnv* env, jclass) {
* Signature: ()Z * Signature: ()Z
*/ */
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserActive3V3(JNIEnv* env, jclass) { Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserActive3V3
(JNIEnv* env, jclass)
{
int32_t status = 0; int32_t status = 0;
bool val = HAL_GetUserActive3V3(&status); bool val = HAL_GetUserActive3V3(&status);
CheckStatus(env, status); CheckStatus(env, status);
@@ -191,8 +216,9 @@ Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserActive3V3(JNIEnv* env, jclass) {
* Signature: ()I * Signature: ()I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserCurrentFaults3V3( Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserCurrentFaults3V3
JNIEnv* env, jclass) { (JNIEnv* env, jclass)
{
int32_t status = 0; int32_t status = 0;
int32_t val = HAL_GetUserCurrentFaults3V3(&status); int32_t val = HAL_GetUserCurrentFaults3V3(&status);
CheckStatus(env, status); CheckStatus(env, status);

View File

@@ -1,20 +1,20 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */ /* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
#include <assert.h>
#include <jni.h> #include <jni.h>
#include "HAL/cpp/Log.h"
#include "edu_wpi_first_wpilibj_hal_RelayJNI.h" #include <cassert>
#include "HAL/Relay.h"
#include "HAL/Ports.h" #include "HAL/Ports.h"
#include "HALUtil.h" #include "HAL/Relay.h"
#include "HAL/cpp/Log.h"
#include "HAL/handles/HandlesInternal.h" #include "HAL/handles/HandlesInternal.h"
#include "HALUtil.h"
#include "edu_wpi_first_wpilibj_hal_RelayJNI.h"
using namespace frc; using namespace frc;
@@ -25,51 +25,58 @@ TLogLevel relayJNILogLevel = logWARNING;
if (level > relayJNILogLevel) \ if (level > relayJNILogLevel) \
; \ ; \
else \ else \
Log().Get(level) Log().Get(level)
extern "C" { extern "C" {
/* /*
* Class: edu_wpi_first_wpilibj_hal_RelayJNI * Class: edu_wpi_first_wpilibj_hal_RelayJNI
* Method: initializeRelayPort * Method: initializeRelayPort
* Signature: (IZ)I; * Signature: (IZ)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_RelayJNI_initializeRelayPort( JNIEXPORT jint JNICALL
JNIEnv* env, jclass, jint id, jboolean fwd) { Java_edu_wpi_first_wpilibj_hal_RelayJNI_initializeRelayPort
(JNIEnv* env, jclass, jint id, jboolean fwd)
{
RELAYJNI_LOG(logDEBUG) << "Calling RELAYJNI initializeRelayPort"; RELAYJNI_LOG(logDEBUG) << "Calling RELAYJNI initializeRelayPort";
RELAYJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_PortHandle)id; RELAYJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_PortHandle)id;
RELAYJNI_LOG(logDEBUG) << "Forward = " << (jint)fwd; RELAYJNI_LOG(logDEBUG) << "Forward = " << (jint)fwd;
int32_t status = 0; int32_t status = 0;
HAL_RelayHandle handle = HAL_InitializeRelayPort((HAL_PortHandle)id, (uint8_t) fwd, &status); HAL_RelayHandle handle = HAL_InitializeRelayPort(
(HAL_PortHandle)id, static_cast<uint8_t>(fwd), &status);
RELAYJNI_LOG(logDEBUG) << "Status = " << status; RELAYJNI_LOG(logDEBUG) << "Status = " << status;
RELAYJNI_LOG(logDEBUG) << "Relay Handle = " << handle; RELAYJNI_LOG(logDEBUG) << "Relay Handle = " << handle;
CheckStatusRange(env, status, 0, HAL_GetNumRelayChannels(), CheckStatusRange(env, status, 0, HAL_GetNumRelayChannels(),
hal::getPortHandleChannel((HAL_PortHandle)id)); hal::getPortHandleChannel((HAL_PortHandle)id));
return (jint) handle; return (jint)handle;
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_RelayJNI * Class: edu_wpi_first_wpilibj_hal_RelayJNI
* Method: freeRelayPort * Method: freeRelayPort
* Signature: (I)V; * Signature: (I)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_RelayJNI_freeRelayPort( JNIEXPORT void JNICALL
JNIEnv *env, jclass, jint id) { Java_edu_wpi_first_wpilibj_hal_RelayJNI_freeRelayPort
(JNIEnv* env, jclass, jint id)
{
RELAYJNI_LOG(logDEBUG) << "Calling RELAYJNI freeRelayPort"; RELAYJNI_LOG(logDEBUG) << "Calling RELAYJNI freeRelayPort";
RELAYJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_RelayHandle)id; RELAYJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_RelayHandle)id;
HAL_FreeRelayPort((HAL_RelayHandle)id); HAL_FreeRelayPort((HAL_RelayHandle)id);
} }
/* /*
* Class: edu_wpi_first_wpilibj_hal_RelayJNI * Class: edu_wpi_first_wpilibj_hal_RelayJNI
* Method: checkRelayChannel * Method: checkRelayChannel
* Signature: (I)Z; * Signature: (I)Z
*/ */
JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_RelayJNI_checkRelayChannel( JNIEXPORT jboolean JNICALL
JNIEnv *env, jclass, jint channel) { Java_edu_wpi_first_wpilibj_hal_RelayJNI_checkRelayChannel
(JNIEnv* env, jclass, jint channel)
{
RELAYJNI_LOG(logDEBUG) << "Calling RELAYJNI checkRelayChannel"; RELAYJNI_LOG(logDEBUG) << "Calling RELAYJNI checkRelayChannel";
RELAYJNI_LOG(logDEBUG) << "Channel = " << channel; RELAYJNI_LOG(logDEBUG) << "Channel = " << channel;
return (jboolean)HAL_CheckRelayChannel((uint8_t) channel); return (jboolean)HAL_CheckRelayChannel(static_cast<uint8_t>(channel));
} }
/* /*
@@ -77,8 +84,10 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_RelayJNI_checkRelayCha
* Method: setRelay * Method: setRelay
* Signature: (IZ)V * Signature: (IZ)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_RelayJNI_setRelay( JNIEXPORT void JNICALL
JNIEnv* env, jclass, jint id, jboolean value) { Java_edu_wpi_first_wpilibj_hal_RelayJNI_setRelay
(JNIEnv* env, jclass, jint id, jboolean value)
{
RELAYJNI_LOG(logDEBUG) << "Calling RELAYJNI setRelay"; RELAYJNI_LOG(logDEBUG) << "Calling RELAYJNI setRelay";
RELAYJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_RelayHandle)id; RELAYJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_RelayHandle)id;
RELAYJNI_LOG(logDEBUG) << "Flag = " << (jint)value; RELAYJNI_LOG(logDEBUG) << "Flag = " << (jint)value;
@@ -94,8 +103,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_RelayJNI_setRelay(
* Signature: (I)Z * Signature: (I)Z
*/ */
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_RelayJNI_getRelay( Java_edu_wpi_first_wpilibj_hal_RelayJNI_getRelay
JNIEnv* env, jclass, jint id) { (JNIEnv* env, jclass, jint id)
{
RELAYJNI_LOG(logDEBUG) << "Calling RELAYJNI getRelay"; RELAYJNI_LOG(logDEBUG) << "Calling RELAYJNI getRelay";
RELAYJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_RelayHandle)id; RELAYJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_RelayHandle)id;
int32_t status = 0; int32_t status = 0;

View File

@@ -1,19 +1,20 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */ /* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
#include <assert.h>
#include <jni.h> #include <jni.h>
#include "HAL/cpp/Log.h"
#include "edu_wpi_first_wpilibj_hal_SPIJNI.h" #include <cassert>
#include <wpi/jni_util.h>
#include "HAL/SPI.h" #include "HAL/SPI.h"
#include "HAL/cpp/Log.h"
#include "HALUtil.h" #include "HALUtil.h"
#include "wpi/jni_util.h" #include "edu_wpi_first_wpilibj_hal_SPIJNI.h"
using namespace frc; using namespace frc;
using namespace wpi::java; using namespace wpi::java;
@@ -25,7 +26,7 @@ TLogLevel spiJNILogLevel = logWARNING;
if (level > spiJNILogLevel) \ if (level > spiJNILogLevel) \
; \ ; \
else \ else \
Log().Get(level) Log().Get(level)
extern "C" { extern "C" {
@@ -34,8 +35,10 @@ extern "C" {
* Method: spiInitialize * Method: spiInitialize
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiInitialize( JNIEXPORT void JNICALL
JNIEnv *env, jclass, jint port) { Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiInitialize
(JNIEnv* env, jclass, jint port)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiInitialize"; SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiInitialize";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port; SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
int32_t status = 0; int32_t status = 0;
@@ -47,23 +50,27 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiInitialize(
/* /*
* Class: edu_wpi_first_wpilibj_hal_SPIJNI * Class: edu_wpi_first_wpilibj_hal_SPIJNI
* Method: spiTransaction * Method: spiTransaction
* Signature: (ILjava/nio/ByteBuffer;Ljava/nio/ByteBuffer;B)I * Signature: (ILjava/lang/Object;Ljava/lang/Object;B)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiTransaction( JNIEXPORT jint JNICALL
JNIEnv *env, jclass, jint port, jobject dataToSend, jobject dataReceived, Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiTransaction
jbyte size) { (JNIEnv* env, jclass, jint port, jobject dataToSend, jobject dataReceived,
jbyte size)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiTransaction"; SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiTransaction";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port; SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
uint8_t *dataToSendPtr = nullptr; uint8_t* dataToSendPtr = nullptr;
if (dataToSend != 0) { if (dataToSend != 0) {
dataToSendPtr = (uint8_t *)env->GetDirectBufferAddress(dataToSend); dataToSendPtr =
reinterpret_cast<uint8_t*>(env->GetDirectBufferAddress(dataToSend));
} }
uint8_t *dataReceivedPtr = uint8_t* dataReceivedPtr =
(uint8_t *)env->GetDirectBufferAddress(dataReceived); reinterpret_cast<uint8_t*>(env->GetDirectBufferAddress(dataReceived));
SPIJNI_LOG(logDEBUG) << "Size = " << (jint)size; SPIJNI_LOG(logDEBUG) << "Size = " << (jint)size;
SPIJNI_LOG(logDEBUG) << "DataToSendPtr = " << dataToSendPtr; SPIJNI_LOG(logDEBUG) << "DataToSendPtr = " << dataToSendPtr;
SPIJNI_LOG(logDEBUG) << "DataReceivedPtr = " << dataReceivedPtr; SPIJNI_LOG(logDEBUG) << "DataReceivedPtr = " << dataReceivedPtr;
jint retVal = HAL_TransactionSPI(static_cast<HAL_SPIPort>(port), dataToSendPtr, dataReceivedPtr, size); jint retVal = HAL_TransactionSPI(static_cast<HAL_SPIPort>(port),
dataToSendPtr, dataReceivedPtr, size);
SPIJNI_LOG(logDEBUG) << "ReturnValue = " << (jint)retVal; SPIJNI_LOG(logDEBUG) << "ReturnValue = " << (jint)retVal;
return retVal; return retVal;
} }
@@ -73,9 +80,11 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiTransaction(
* Method: spiTransactionB * Method: spiTransactionB
* Signature: (I[B[BB)I * Signature: (I[B[BB)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiTransactionB( JNIEXPORT jint JNICALL
JNIEnv *env, jclass, jint port, jbyteArray dataToSend, jbyteArray dataReceived, Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiTransactionB
jbyte size) { (JNIEnv* env, jclass, jint port, jbyteArray dataToSend,
jbyteArray dataReceived, jbyte size)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiTransactionB"; SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiTransactionB";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port; SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
SPIJNI_LOG(logDEBUG) << "Size = " << (jint)size; SPIJNI_LOG(logDEBUG) << "Size = " << (jint)size;
@@ -83,11 +92,11 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiTransactionB(
recvBuf.resize(size); recvBuf.resize(size);
jint retVal = jint retVal =
HAL_TransactionSPI(static_cast<HAL_SPIPort>(port), HAL_TransactionSPI(static_cast<HAL_SPIPort>(port),
reinterpret_cast<const uint8_t *>( reinterpret_cast<const uint8_t*>(
JByteArrayRef(env, dataToSend).array().data()), JByteArrayRef(env, dataToSend).array().data()),
recvBuf.data(), size); recvBuf.data(), size);
env->SetByteArrayRegion(dataReceived, 0, size, env->SetByteArrayRegion(dataReceived, 0, size,
reinterpret_cast<const jbyte *>(recvBuf.data())); reinterpret_cast<const jbyte*>(recvBuf.data()));
SPIJNI_LOG(logDEBUG) << "ReturnValue = " << (jint)retVal; SPIJNI_LOG(logDEBUG) << "ReturnValue = " << (jint)retVal;
return retVal; return retVal;
} }
@@ -95,19 +104,23 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiTransactionB(
/* /*
* Class: edu_wpi_first_wpilibj_hal_SPIJNI * Class: edu_wpi_first_wpilibj_hal_SPIJNI
* Method: spiWrite * Method: spiWrite
* Signature: (ILjava/nio/ByteBuffer;B)I * Signature: (ILjava/lang/Object;B)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiWrite( JNIEXPORT jint JNICALL
JNIEnv *env, jclass, jint port, jobject dataToSend, jbyte size) { Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiWrite
(JNIEnv* env, jclass, jint port, jobject dataToSend, jbyte size)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiWrite"; SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiWrite";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port; SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
uint8_t *dataToSendPtr = nullptr; uint8_t* dataToSendPtr = nullptr;
if (dataToSend != 0) { if (dataToSend != 0) {
dataToSendPtr = (uint8_t *)env->GetDirectBufferAddress(dataToSend); dataToSendPtr =
reinterpret_cast<uint8_t*>(env->GetDirectBufferAddress(dataToSend));
} }
SPIJNI_LOG(logDEBUG) << "Size = " << (jint)size; SPIJNI_LOG(logDEBUG) << "Size = " << (jint)size;
SPIJNI_LOG(logDEBUG) << "DataToSendPtr = " << dataToSendPtr; SPIJNI_LOG(logDEBUG) << "DataToSendPtr = " << dataToSendPtr;
jint retVal = HAL_WriteSPI(static_cast<HAL_SPIPort>(port), dataToSendPtr, size); jint retVal =
HAL_WriteSPI(static_cast<HAL_SPIPort>(port), dataToSendPtr, size);
SPIJNI_LOG(logDEBUG) << "ReturnValue = " << (jint)retVal; SPIJNI_LOG(logDEBUG) << "ReturnValue = " << (jint)retVal;
return retVal; return retVal;
} }
@@ -117,13 +130,15 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiWrite(
* Method: spiWriteB * Method: spiWriteB
* Signature: (I[BB)I * Signature: (I[BB)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiWriteB( JNIEXPORT jint JNICALL
JNIEnv *env, jclass, jint port, jbyteArray dataToSend, jbyte size) { Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiWriteB
(JNIEnv* env, jclass, jint port, jbyteArray dataToSend, jbyte size)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiWriteB"; SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiWriteB";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port; SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
SPIJNI_LOG(logDEBUG) << "Size = " << (jint)size; SPIJNI_LOG(logDEBUG) << "Size = " << (jint)size;
jint retVal = HAL_WriteSPI(static_cast<HAL_SPIPort>(port), jint retVal = HAL_WriteSPI(static_cast<HAL_SPIPort>(port),
reinterpret_cast<const uint8_t *>( reinterpret_cast<const uint8_t*>(
JByteArrayRef(env, dataToSend).array().data()), JByteArrayRef(env, dataToSend).array().data()),
size); size);
SPIJNI_LOG(logDEBUG) << "ReturnValue = " << (jint)retVal; SPIJNI_LOG(logDEBUG) << "ReturnValue = " << (jint)retVal;
@@ -133,24 +148,29 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiWriteB(
/* /*
* Class: edu_wpi_first_wpilibj_hal_SPIJNI * Class: edu_wpi_first_wpilibj_hal_SPIJNI
* Method: spiRead * Method: spiRead
* Signature: (IZLjava/nio/ByteBuffer;B)I * Signature: (IZLjava/lang/Object;B)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiRead( JNIEXPORT jint JNICALL
JNIEnv *env, jclass, jint port, jboolean initiate, jobject dataReceived, jbyte size) { Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiRead
(JNIEnv* env, jclass, jint port, jboolean initiate, jobject dataReceived,
jbyte size)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiRead"; SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiRead";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port; SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
SPIJNI_LOG(logDEBUG) << "Initiate = " << (jboolean)initiate; SPIJNI_LOG(logDEBUG) << "Initiate = " << (jboolean)initiate;
uint8_t *dataReceivedPtr = uint8_t* dataReceivedPtr =
(uint8_t *)env->GetDirectBufferAddress(dataReceived); reinterpret_cast<uint8_t*>(env->GetDirectBufferAddress(dataReceived));
SPIJNI_LOG(logDEBUG) << "Size = " << (jint)size; SPIJNI_LOG(logDEBUG) << "Size = " << (jint)size;
SPIJNI_LOG(logDEBUG) << "DataReceivedPtr = " << dataReceivedPtr; SPIJNI_LOG(logDEBUG) << "DataReceivedPtr = " << dataReceivedPtr;
jint retVal; jint retVal;
if (initiate) { if (initiate) {
wpi::SmallVector<uint8_t, 128> sendBuf; wpi::SmallVector<uint8_t, 128> sendBuf;
sendBuf.resize(size); sendBuf.resize(size);
retVal = HAL_TransactionSPI(static_cast<HAL_SPIPort>(port), sendBuf.data(), dataReceivedPtr, size); retVal = HAL_TransactionSPI(static_cast<HAL_SPIPort>(port), sendBuf.data(),
dataReceivedPtr, size);
} else { } else {
retVal = HAL_ReadSPI(static_cast<HAL_SPIPort>(port), (uint8_t *)dataReceivedPtr, size); retVal = HAL_ReadSPI(static_cast<HAL_SPIPort>(port),
reinterpret_cast<uint8_t*>(dataReceivedPtr), size);
} }
SPIJNI_LOG(logDEBUG) << "ReturnValue = " << (jint)retVal; SPIJNI_LOG(logDEBUG) << "ReturnValue = " << (jint)retVal;
return retVal; return retVal;
@@ -161,8 +181,11 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiRead(
* Method: spiReadB * Method: spiReadB
* Signature: (IZ[BB)I * Signature: (IZ[BB)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiReadB( JNIEXPORT jint JNICALL
JNIEnv *env, jclass, jint port, jboolean initiate, jbyteArray dataReceived, jbyte size) { Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiReadB
(JNIEnv* env, jclass, jint port, jboolean initiate, jbyteArray dataReceived,
jbyte size)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiReadB"; SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiReadB";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port; SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
SPIJNI_LOG(logDEBUG) << "Initiate = " << (jboolean)initiate; SPIJNI_LOG(logDEBUG) << "Initiate = " << (jboolean)initiate;
@@ -173,12 +196,13 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiReadB(
if (initiate) { if (initiate) {
wpi::SmallVector<uint8_t, 128> sendBuf; wpi::SmallVector<uint8_t, 128> sendBuf;
sendBuf.resize(size); sendBuf.resize(size);
retVal = HAL_TransactionSPI(static_cast<HAL_SPIPort>(port), sendBuf.data(), recvBuf.data(), size); retVal = HAL_TransactionSPI(static_cast<HAL_SPIPort>(port), sendBuf.data(),
recvBuf.data(), size);
} else { } else {
retVal = HAL_ReadSPI(static_cast<HAL_SPIPort>(port), recvBuf.data(), size); retVal = HAL_ReadSPI(static_cast<HAL_SPIPort>(port), recvBuf.data(), size);
} }
env->SetByteArrayRegion(dataReceived, 0, size, env->SetByteArrayRegion(dataReceived, 0, size,
reinterpret_cast<const jbyte *>(recvBuf.data())); reinterpret_cast<const jbyte*>(recvBuf.data()));
SPIJNI_LOG(logDEBUG) << "ReturnValue = " << (jint)retVal; SPIJNI_LOG(logDEBUG) << "ReturnValue = " << (jint)retVal;
return retVal; return retVal;
} }
@@ -189,7 +213,9 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiReadB(
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiClose(JNIEnv *, jclass, jint port) { Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiClose
(JNIEnv*, jclass, jint port)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiClose"; SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiClose";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port; SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
HAL_CloseSPI(static_cast<HAL_SPIPort>(port)); HAL_CloseSPI(static_cast<HAL_SPIPort>(port));
@@ -200,8 +226,10 @@ Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiClose(JNIEnv *, jclass, jint port) {
* Method: spiSetSpeed * Method: spiSetSpeed
* Signature: (II)V * Signature: (II)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetSpeed( JNIEXPORT void JNICALL
JNIEnv *, jclass, jint port, jint speed) { Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetSpeed
(JNIEnv*, jclass, jint port, jint speed)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiSetSpeed"; SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiSetSpeed";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port; SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
SPIJNI_LOG(logDEBUG) << "Speed = " << (jint)speed; SPIJNI_LOG(logDEBUG) << "Speed = " << (jint)speed;
@@ -213,15 +241,18 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetSpeed(
* Method: spiSetOpts * Method: spiSetOpts
* Signature: (IIII)V * Signature: (IIII)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetOpts( JNIEXPORT void JNICALL
JNIEnv *, jclass, jint port, jint msb_first, jint sample_on_trailing, Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetOpts
jint clk_idle_high) { (JNIEnv*, jclass, jint port, jint msb_first, jint sample_on_trailing,
jint clk_idle_high)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiSetOpts"; SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiSetOpts";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port; SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
SPIJNI_LOG(logDEBUG) << "msb_first = " << msb_first; SPIJNI_LOG(logDEBUG) << "msb_first = " << msb_first;
SPIJNI_LOG(logDEBUG) << "sample_on_trailing = " << sample_on_trailing; SPIJNI_LOG(logDEBUG) << "sample_on_trailing = " << sample_on_trailing;
SPIJNI_LOG(logDEBUG) << "clk_idle_high = " << clk_idle_high; SPIJNI_LOG(logDEBUG) << "clk_idle_high = " << clk_idle_high;
HAL_SetSPIOpts(static_cast<HAL_SPIPort>(port), msb_first, sample_on_trailing, clk_idle_high); HAL_SetSPIOpts(static_cast<HAL_SPIPort>(port), msb_first, sample_on_trailing,
clk_idle_high);
} }
/* /*
@@ -230,8 +261,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetOpts(
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetChipSelectActiveHigh( Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetChipSelectActiveHigh
JNIEnv *env, jclass, jint port) { (JNIEnv* env, jclass, jint port)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiSetCSActiveHigh"; SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiSetCSActiveHigh";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port; SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
int32_t status = 0; int32_t status = 0;
@@ -246,8 +278,9 @@ Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetChipSelectActiveHigh(
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetChipSelectActiveLow( Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetChipSelectActiveLow
JNIEnv *env, jclass, jint port) { (JNIEnv* env, jclass, jint port)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiSetCSActiveLow"; SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiSetCSActiveLow";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port; SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
int32_t status = 0; int32_t status = 0;
@@ -261,8 +294,10 @@ Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetChipSelectActiveLow(
* Method: spiInitAuto * Method: spiInitAuto
* Signature: (II)V * Signature: (II)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiInitAuto JNIEXPORT void JNICALL
(JNIEnv *env, jclass, jint port, jint bufferSize) { Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiInitAuto
(JNIEnv* env, jclass, jint port, jint bufferSize)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiInitAuto"; SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiInitAuto";
SPIJNI_LOG(logDEBUG) << "Port = " << port; SPIJNI_LOG(logDEBUG) << "Port = " << port;
SPIJNI_LOG(logDEBUG) << "BufferSize = " << bufferSize; SPIJNI_LOG(logDEBUG) << "BufferSize = " << bufferSize;
@@ -277,8 +312,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiInitAuto
* Method: spiFreeAuto * Method: spiFreeAuto
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiFreeAuto JNIEXPORT void JNICALL
(JNIEnv *env, jclass, jint port) { Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiFreeAuto
(JNIEnv* env, jclass, jint port)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiFreeAuto"; SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiFreeAuto";
SPIJNI_LOG(logDEBUG) << "Port = " << port; SPIJNI_LOG(logDEBUG) << "Port = " << port;
int32_t status = 0; int32_t status = 0;
@@ -292,8 +329,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiFreeAuto
* Method: spiStartAutoRate * Method: spiStartAutoRate
* Signature: (ID)V * Signature: (ID)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiStartAutoRate JNIEXPORT void JNICALL
(JNIEnv *env, jclass, jint port, jdouble period) { Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiStartAutoRate
(JNIEnv* env, jclass, jint port, jdouble period)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiStartAutoRate"; SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiStartAutoRate";
SPIJNI_LOG(logDEBUG) << "Port = " << port; SPIJNI_LOG(logDEBUG) << "Port = " << port;
SPIJNI_LOG(logDEBUG) << "Period = " << period; SPIJNI_LOG(logDEBUG) << "Period = " << period;
@@ -308,8 +347,11 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiStartAutoRate
* Method: spiStartAutoTrigger * Method: spiStartAutoTrigger
* Signature: (IIIZZ)V * Signature: (IIIZZ)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiStartAutoTrigger JNIEXPORT void JNICALL
(JNIEnv *env, jclass, jint port, jint digitalSourceHandle, jint analogTriggerType, jboolean triggerRising, jboolean triggerFalling) { Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiStartAutoTrigger
(JNIEnv* env, jclass, jint port, jint digitalSourceHandle,
jint analogTriggerType, jboolean triggerRising, jboolean triggerFalling)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiStartAutoTrigger"; SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiStartAutoTrigger";
SPIJNI_LOG(logDEBUG) << "Port = " << port; SPIJNI_LOG(logDEBUG) << "Port = " << port;
SPIJNI_LOG(logDEBUG) << "DigitalSourceHandle = " << digitalSourceHandle; SPIJNI_LOG(logDEBUG) << "DigitalSourceHandle = " << digitalSourceHandle;
@@ -318,8 +360,8 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiStartAutoTrigger
SPIJNI_LOG(logDEBUG) << "TriggerFalling = " << (jint)triggerFalling; SPIJNI_LOG(logDEBUG) << "TriggerFalling = " << (jint)triggerFalling;
int32_t status = 0; int32_t status = 0;
HAL_StartSPIAutoTrigger(static_cast<HAL_SPIPort>(port), digitalSourceHandle, HAL_StartSPIAutoTrigger(static_cast<HAL_SPIPort>(port), digitalSourceHandle,
static_cast<HAL_AnalogTriggerType>(analogTriggerType), triggerRising, static_cast<HAL_AnalogTriggerType>(analogTriggerType),
triggerFalling, &status); triggerRising, triggerFalling, &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status; SPIJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status); CheckStatus(env, status);
} }
@@ -329,8 +371,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiStartAutoTrigger
* Method: spiStopAuto * Method: spiStopAuto
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiStopAuto JNIEXPORT void JNICALL
(JNIEnv *env, jclass, jint port) { Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiStopAuto
(JNIEnv* env, jclass, jint port)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiStopAuto"; SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiStopAuto";
SPIJNI_LOG(logDEBUG) << "Port = " << port; SPIJNI_LOG(logDEBUG) << "Port = " << port;
int32_t status = 0; int32_t status = 0;
@@ -344,14 +388,17 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiStopAuto
* Method: spiSetAutoTransmitData * Method: spiSetAutoTransmitData
* Signature: (I[BI)V * Signature: (I[BI)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetAutoTransmitData JNIEXPORT void JNICALL
(JNIEnv *env, jclass, jint port, jbyteArray dataToSend, jint zeroSize) { Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetAutoTransmitData
(JNIEnv* env, jclass, jint port, jbyteArray dataToSend, jint zeroSize)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiSetAutoTransmitData"; SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiSetAutoTransmitData";
SPIJNI_LOG(logDEBUG) << "Port = " << port; SPIJNI_LOG(logDEBUG) << "Port = " << port;
SPIJNI_LOG(logDEBUG) << "ZeroSize = " << zeroSize; SPIJNI_LOG(logDEBUG) << "ZeroSize = " << zeroSize;
JByteArrayRef jarr(env, dataToSend); JByteArrayRef jarr(env, dataToSend);
int32_t status = 0; int32_t status = 0;
HAL_SetSPIAutoTransmitData(static_cast<HAL_SPIPort>(port), HAL_SetSPIAutoTransmitData(
static_cast<HAL_SPIPort>(port),
reinterpret_cast<const uint8_t*>(jarr.array().data()), reinterpret_cast<const uint8_t*>(jarr.array().data()),
jarr.array().size(), zeroSize, &status); jarr.array().size(), zeroSize, &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status; SPIJNI_LOG(logDEBUG) << "Status = " << status;
@@ -363,8 +410,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetAutoTransmitD
* Method: spiForceAutoRead * Method: spiForceAutoRead
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiForceAutoRead JNIEXPORT void JNICALL
(JNIEnv *env, jclass, jint port) { Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiForceAutoRead
(JNIEnv* env, jclass, jint port)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiForceAutoRead"; SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiForceAutoRead";
SPIJNI_LOG(logDEBUG) << "Port = " << port; SPIJNI_LOG(logDEBUG) << "Port = " << port;
int32_t status = 0; int32_t status = 0;
@@ -376,17 +425,22 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiForceAutoRead
/* /*
* Class: edu_wpi_first_wpilibj_hal_SPIJNI * Class: edu_wpi_first_wpilibj_hal_SPIJNI
* Method: spiReadAutoReceivedData * Method: spiReadAutoReceivedData
* Signature: (ILjava/nio/ByteBuffer;ID)I * Signature: (ILjava/lang/Object;ID)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiReadAutoReceivedData__ILjava_nio_ByteBuffer_2ID JNIEXPORT jint JNICALL
(JNIEnv *env, jclass, jint port, jobject buffer, jint numToRead, jdouble timeout) { Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiReadAutoReceivedData__ILjava_nio_ByteBuffer_2ID
(JNIEnv* env, jclass, jint port, jobject buffer, jint numToRead,
jdouble timeout)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiReadAutoReceivedData"; SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiReadAutoReceivedData";
SPIJNI_LOG(logDEBUG) << "Port = " << port; SPIJNI_LOG(logDEBUG) << "Port = " << port;
SPIJNI_LOG(logDEBUG) << "NumToRead = " << numToRead; SPIJNI_LOG(logDEBUG) << "NumToRead = " << numToRead;
SPIJNI_LOG(logDEBUG) << "Timeout = " << timeout; SPIJNI_LOG(logDEBUG) << "Timeout = " << timeout;
uint8_t *recvBuf = (uint8_t *)env->GetDirectBufferAddress(buffer); uint8_t* recvBuf =
reinterpret_cast<uint8_t*>(env->GetDirectBufferAddress(buffer));
int32_t status = 0; int32_t status = 0;
jint retval = HAL_ReadSPIAutoReceivedData(static_cast<HAL_SPIPort>(port), recvBuf, numToRead, timeout, &status); jint retval = HAL_ReadSPIAutoReceivedData(
static_cast<HAL_SPIPort>(port), recvBuf, numToRead, timeout, &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status; SPIJNI_LOG(logDEBUG) << "Status = " << status;
SPIJNI_LOG(logDEBUG) << "Return = " << retval; SPIJNI_LOG(logDEBUG) << "Return = " << retval;
CheckStatus(env, status); CheckStatus(env, status);
@@ -398,8 +452,11 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiReadAutoReceived
* Method: spiReadAutoReceivedData * Method: spiReadAutoReceivedData
* Signature: (I[BID)I * Signature: (I[BID)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiReadAutoReceivedData__I_3BID JNIEXPORT jint JNICALL
(JNIEnv *env, jclass, jint port, jbyteArray buffer, jint numToRead, jdouble timeout) { Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiReadAutoReceivedData__I_3BID
(JNIEnv* env, jclass, jint port, jbyteArray buffer, jint numToRead,
jdouble timeout)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiReadAutoReceivedData"; SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiReadAutoReceivedData";
SPIJNI_LOG(logDEBUG) << "Port = " << port; SPIJNI_LOG(logDEBUG) << "Port = " << port;
SPIJNI_LOG(logDEBUG) << "NumToRead = " << numToRead; SPIJNI_LOG(logDEBUG) << "NumToRead = " << numToRead;
@@ -407,13 +464,15 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiReadAutoReceived
wpi::SmallVector<uint8_t, 128> recvBuf; wpi::SmallVector<uint8_t, 128> recvBuf;
recvBuf.resize(numToRead); recvBuf.resize(numToRead);
int32_t status = 0; int32_t status = 0;
jint retval = HAL_ReadSPIAutoReceivedData(static_cast<HAL_SPIPort>(port), recvBuf.data(), numToRead, timeout, &status); jint retval =
HAL_ReadSPIAutoReceivedData(static_cast<HAL_SPIPort>(port),
recvBuf.data(), numToRead, timeout, &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status; SPIJNI_LOG(logDEBUG) << "Status = " << status;
SPIJNI_LOG(logDEBUG) << "Return = " << retval; SPIJNI_LOG(logDEBUG) << "Return = " << retval;
if (!CheckStatus(env, status)) return retval; if (!CheckStatus(env, status)) return retval;
if (numToRead > 0) { if (numToRead > 0) {
env->SetByteArrayRegion(buffer, 0, numToRead, env->SetByteArrayRegion(buffer, 0, numToRead,
reinterpret_cast<const jbyte *>(recvBuf.data())); reinterpret_cast<const jbyte*>(recvBuf.data()));
} }
return retval; return retval;
} }
@@ -423,12 +482,15 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiReadAutoReceived
* Method: spiGetAutoDroppedCount * Method: spiGetAutoDroppedCount
* Signature: (I)I * Signature: (I)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiGetAutoDroppedCount JNIEXPORT jint JNICALL
(JNIEnv *env, jclass, jint port) { Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiGetAutoDroppedCount
(JNIEnv* env, jclass, jint port)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiGetAutoDroppedCount"; SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiGetAutoDroppedCount";
SPIJNI_LOG(logDEBUG) << "Port = " << port; SPIJNI_LOG(logDEBUG) << "Port = " << port;
int32_t status = 0; int32_t status = 0;
auto retval = HAL_GetSPIAutoDroppedCount(static_cast<HAL_SPIPort>(port), &status); auto retval =
HAL_GetSPIAutoDroppedCount(static_cast<HAL_SPIPort>(port), &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status; SPIJNI_LOG(logDEBUG) << "Status = " << status;
SPIJNI_LOG(logDEBUG) << "Return = " << retval; SPIJNI_LOG(logDEBUG) << "Return = " << retval;
CheckStatus(env, status); CheckStatus(env, status);

View File

@@ -1,19 +1,20 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */ /* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
#include <assert.h>
#include <jni.h> #include <jni.h>
#include "HAL/cpp/Log.h"
#include "edu_wpi_first_wpilibj_hal_SerialPortJNI.h" #include <cassert>
#include <wpi/jni_util.h>
#include "HAL/SerialPort.h" #include "HAL/SerialPort.h"
#include "HAL/cpp/Log.h"
#include "HALUtil.h" #include "HALUtil.h"
#include "wpi/jni_util.h" #include "edu_wpi_first_wpilibj_hal_SerialPortJNI.h"
using namespace frc; using namespace frc;
using namespace wpi::java; using namespace wpi::java;
@@ -25,7 +26,7 @@ TLogLevel serialJNILogLevel = logWARNING;
if (level > serialJNILogLevel) \ if (level > serialJNILogLevel) \
; \ ; \
else \ else \
Log().Get(level) Log().Get(level)
extern "C" { extern "C" {
@@ -35,8 +36,9 @@ extern "C" {
* Signature: (B)V * Signature: (B)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialInitializePort( Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialInitializePort
JNIEnv* env, jclass, jbyte port) { (JNIEnv* env, jclass, jbyte port)
{
SERIALJNI_LOG(logDEBUG) << "Calling Serial Initialize"; SERIALJNI_LOG(logDEBUG) << "Calling Serial Initialize";
SERIALJNI_LOG(logDEBUG) << "Port = " << (jint)port; SERIALJNI_LOG(logDEBUG) << "Port = " << (jint)port;
int32_t status = 0; int32_t status = 0;
@@ -51,8 +53,9 @@ Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialInitializePort(
* Signature: (BLjava/lang/String;)V * Signature: (BLjava/lang/String;)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialInitializePortDirect( Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialInitializePortDirect
JNIEnv* env, jclass, jbyte port, jstring portName) { (JNIEnv* env, jclass, jbyte port, jstring portName)
{
SERIALJNI_LOG(logDEBUG) << "Calling Serial Initialize Direct"; SERIALJNI_LOG(logDEBUG) << "Calling Serial Initialize Direct";
SERIALJNI_LOG(logDEBUG) << "Port = " << (jint)port; SERIALJNI_LOG(logDEBUG) << "Port = " << (jint)port;
JStringRef portNameRef{env, portName}; JStringRef portNameRef{env, portName};
@@ -70,8 +73,9 @@ Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialInitializePortDirect(
* Signature: (BI)V * Signature: (BI)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetBaudRate( Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetBaudRate
JNIEnv* env, jclass, jbyte port, jint rate) { (JNIEnv* env, jclass, jbyte port, jint rate)
{
SERIALJNI_LOG(logDEBUG) << "Setting Serial Baud Rate"; SERIALJNI_LOG(logDEBUG) << "Setting Serial Baud Rate";
SERIALJNI_LOG(logDEBUG) << "Baud: " << rate; SERIALJNI_LOG(logDEBUG) << "Baud: " << rate;
int32_t status = 0; int32_t status = 0;
@@ -86,8 +90,9 @@ Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetBaudRate(
* Signature: (BB)V * Signature: (BB)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetDataBits( Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetDataBits
JNIEnv* env, jclass, jbyte port, jbyte bits) { (JNIEnv* env, jclass, jbyte port, jbyte bits)
{
SERIALJNI_LOG(logDEBUG) << "Setting Serial Data Bits"; SERIALJNI_LOG(logDEBUG) << "Setting Serial Data Bits";
SERIALJNI_LOG(logDEBUG) << "Data Bits: " << bits; SERIALJNI_LOG(logDEBUG) << "Data Bits: " << bits;
int32_t status = 0; int32_t status = 0;
@@ -102,8 +107,9 @@ Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetDataBits(
* Signature: (BB)V * Signature: (BB)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetParity( Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetParity
JNIEnv* env, jclass, jbyte port, jbyte parity) { (JNIEnv* env, jclass, jbyte port, jbyte parity)
{
SERIALJNI_LOG(logDEBUG) << "Setting Serial Parity"; SERIALJNI_LOG(logDEBUG) << "Setting Serial Parity";
SERIALJNI_LOG(logDEBUG) << "Parity: " << parity; SERIALJNI_LOG(logDEBUG) << "Parity: " << parity;
int32_t status = 0; int32_t status = 0;
@@ -118,8 +124,9 @@ Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetParity(
* Signature: (BB)V * Signature: (BB)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetStopBits( Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetStopBits
JNIEnv* env, jclass, jbyte port, jbyte bits) { (JNIEnv* env, jclass, jbyte port, jbyte bits)
{
SERIALJNI_LOG(logDEBUG) << "Setting Serial Stop Bits"; SERIALJNI_LOG(logDEBUG) << "Setting Serial Stop Bits";
SERIALJNI_LOG(logDEBUG) << "Stop Bits: " << bits; SERIALJNI_LOG(logDEBUG) << "Stop Bits: " << bits;
int32_t status = 0; int32_t status = 0;
@@ -134,8 +141,9 @@ Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetStopBits(
* Signature: (BB)V * Signature: (BB)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetWriteMode( Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetWriteMode
JNIEnv* env, jclass, jbyte port, jbyte mode) { (JNIEnv* env, jclass, jbyte port, jbyte mode)
{
SERIALJNI_LOG(logDEBUG) << "Setting Serial Write Mode"; SERIALJNI_LOG(logDEBUG) << "Setting Serial Write Mode";
SERIALJNI_LOG(logDEBUG) << "Write mode: " << mode; SERIALJNI_LOG(logDEBUG) << "Write mode: " << mode;
int32_t status = 0; int32_t status = 0;
@@ -150,8 +158,9 @@ Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetWriteMode(
* Signature: (BB)V * Signature: (BB)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetFlowControl( Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetFlowControl
JNIEnv* env, jclass, jbyte port, jbyte flow) { (JNIEnv* env, jclass, jbyte port, jbyte flow)
{
SERIALJNI_LOG(logDEBUG) << "Setting Serial Flow Control"; SERIALJNI_LOG(logDEBUG) << "Setting Serial Flow Control";
SERIALJNI_LOG(logDEBUG) << "Flow Control: " << flow; SERIALJNI_LOG(logDEBUG) << "Flow Control: " << flow;
int32_t status = 0; int32_t status = 0;
@@ -166,8 +175,9 @@ Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetFlowControl(
* Signature: (BD)V * Signature: (BD)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetTimeout( Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetTimeout
JNIEnv* env, jclass, jbyte port, jdouble timeout) { (JNIEnv* env, jclass, jbyte port, jdouble timeout)
{
SERIALJNI_LOG(logDEBUG) << "Setting Serial Timeout"; SERIALJNI_LOG(logDEBUG) << "Setting Serial Timeout";
SERIALJNI_LOG(logDEBUG) << "Timeout: " << timeout; SERIALJNI_LOG(logDEBUG) << "Timeout: " << timeout;
int32_t status = 0; int32_t status = 0;
@@ -182,12 +192,14 @@ Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetTimeout(
* Signature: (BC)V * Signature: (BC)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialEnableTermination( Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialEnableTermination
JNIEnv* env, jclass, jbyte port, jchar terminator) { (JNIEnv* env, jclass, jbyte port, jchar terminator)
{
SERIALJNI_LOG(logDEBUG) << "Setting Serial Enable Termination"; SERIALJNI_LOG(logDEBUG) << "Setting Serial Enable Termination";
SERIALJNI_LOG(logDEBUG) << "Terminator: " << terminator; SERIALJNI_LOG(logDEBUG) << "Terminator: " << terminator;
int32_t status = 0; int32_t status = 0;
HAL_EnableSerialTermination(static_cast<HAL_SerialPort>(port), terminator, &status); HAL_EnableSerialTermination(static_cast<HAL_SerialPort>(port), terminator,
&status);
SERIALJNI_LOG(logDEBUG) << "Status = " << status; SERIALJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status); CheckStatus(env, status);
} }
@@ -198,8 +210,9 @@ Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialEnableTermination(
* Signature: (B)V * Signature: (B)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialDisableTermination( Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialDisableTermination
JNIEnv* env, jclass, jbyte port) { (JNIEnv* env, jclass, jbyte port)
{
SERIALJNI_LOG(logDEBUG) << "Setting Serial Disable termination"; SERIALJNI_LOG(logDEBUG) << "Setting Serial Disable termination";
int32_t status = 0; int32_t status = 0;
HAL_DisableSerialTermination(static_cast<HAL_SerialPort>(port), &status); HAL_DisableSerialTermination(static_cast<HAL_SerialPort>(port), &status);
@@ -213,8 +226,9 @@ Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialDisableTermination(
* Signature: (BI)V * Signature: (BI)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetReadBufferSize( Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetReadBufferSize
JNIEnv* env, jclass, jbyte port, jint size) { (JNIEnv* env, jclass, jbyte port, jint size)
{
SERIALJNI_LOG(logDEBUG) << "Setting Serial Read Buffer Size"; SERIALJNI_LOG(logDEBUG) << "Setting Serial Read Buffer Size";
SERIALJNI_LOG(logDEBUG) << "Size: " << size; SERIALJNI_LOG(logDEBUG) << "Size: " << size;
int32_t status = 0; int32_t status = 0;
@@ -229,12 +243,14 @@ Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetReadBufferSize(
* Signature: (BI)V * Signature: (BI)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetWriteBufferSize( Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetWriteBufferSize
JNIEnv* env, jclass, jbyte port, jint size) { (JNIEnv* env, jclass, jbyte port, jint size)
{
SERIALJNI_LOG(logDEBUG) << "Setting Serial Write Buffer Size"; SERIALJNI_LOG(logDEBUG) << "Setting Serial Write Buffer Size";
SERIALJNI_LOG(logDEBUG) << "Size: " << size; SERIALJNI_LOG(logDEBUG) << "Size: " << size;
int32_t status = 0; int32_t status = 0;
HAL_SetSerialWriteBufferSize(static_cast<HAL_SerialPort>(port), size, &status); HAL_SetSerialWriteBufferSize(static_cast<HAL_SerialPort>(port), size,
&status);
SERIALJNI_LOG(logDEBUG) << "Status = " << status; SERIALJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status); CheckStatus(env, status);
} }
@@ -245,11 +261,13 @@ Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetWriteBufferSize(
* Signature: (B)I * Signature: (B)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialGetBytesReceived( Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialGetBytesReceived
JNIEnv* env, jclass, jbyte port) { (JNIEnv* env, jclass, jbyte port)
{
SERIALJNI_LOG(logDEBUG) << "Serial Get Bytes Received"; SERIALJNI_LOG(logDEBUG) << "Serial Get Bytes Received";
int32_t status = 0; int32_t status = 0;
jint retVal = HAL_GetSerialBytesReceived(static_cast<HAL_SerialPort>(port), &status); jint retVal =
HAL_GetSerialBytesReceived(static_cast<HAL_SerialPort>(port), &status);
SERIALJNI_LOG(logDEBUG) << "Status = " << status; SERIALJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status); CheckStatus(env, status);
return retVal; return retVal;
@@ -260,16 +278,18 @@ Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialGetBytesReceived(
* Method: serialRead * Method: serialRead
* Signature: (B[BI)I * Signature: (B[BI)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialRead( JNIEXPORT jint JNICALL
JNIEnv* env, jclass, jbyte port, jbyteArray dataReceived, jint size) { Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialRead
(JNIEnv* env, jclass, jbyte port, jbyteArray dataReceived, jint size)
{
SERIALJNI_LOG(logDEBUG) << "Serial Read"; SERIALJNI_LOG(logDEBUG) << "Serial Read";
wpi::SmallVector<char, 128> recvBuf; wpi::SmallVector<char, 128> recvBuf;
recvBuf.resize(size); recvBuf.resize(size);
int32_t status = 0; int32_t status = 0;
jint retVal = HAL_ReadSerial(static_cast<HAL_SerialPort>(port), recvBuf.data(), jint retVal = HAL_ReadSerial(static_cast<HAL_SerialPort>(port),
size, &status); recvBuf.data(), size, &status);
env->SetByteArrayRegion(dataReceived, 0, size, env->SetByteArrayRegion(dataReceived, 0, size,
reinterpret_cast<const jbyte *>(recvBuf.data())); reinterpret_cast<const jbyte*>(recvBuf.data()));
SERIALJNI_LOG(logDEBUG) << "ReturnValue = " << retVal; SERIALJNI_LOG(logDEBUG) << "ReturnValue = " << retVal;
SERIALJNI_LOG(logDEBUG) << "Status = " << status; SERIALJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status); CheckStatus(env, status);
@@ -281,13 +301,15 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialRead(
* Method: serialWrite * Method: serialWrite
* Signature: (B[BI)I * Signature: (B[BI)I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialWrite( JNIEXPORT jint JNICALL
JNIEnv* env, jclass, jbyte port, jbyteArray dataToSend, jint size) { Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialWrite
(JNIEnv* env, jclass, jbyte port, jbyteArray dataToSend, jint size)
{
SERIALJNI_LOG(logDEBUG) << "Serial Write"; SERIALJNI_LOG(logDEBUG) << "Serial Write";
int32_t status = 0; int32_t status = 0;
jint retVal = jint retVal =
HAL_WriteSerial(static_cast<HAL_SerialPort>(port), HAL_WriteSerial(static_cast<HAL_SerialPort>(port),
reinterpret_cast<const char *>( reinterpret_cast<const char*>(
JByteArrayRef(env, dataToSend).array().data()), JByteArrayRef(env, dataToSend).array().data()),
size, &status); size, &status);
SERIALJNI_LOG(logDEBUG) << "ReturnValue = " << retVal; SERIALJNI_LOG(logDEBUG) << "ReturnValue = " << retVal;
@@ -301,8 +323,10 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialWrite(
* Method: serialFlush * Method: serialFlush
* Signature: (B)V * Signature: (B)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialFlush( JNIEXPORT void JNICALL
JNIEnv* env, jclass, jbyte port) { Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialFlush
(JNIEnv* env, jclass, jbyte port)
{
SERIALJNI_LOG(logDEBUG) << "Serial Flush"; SERIALJNI_LOG(logDEBUG) << "Serial Flush";
int32_t status = 0; int32_t status = 0;
HAL_FlushSerial(static_cast<HAL_SerialPort>(port), &status); HAL_FlushSerial(static_cast<HAL_SerialPort>(port), &status);
@@ -315,8 +339,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialFlush(
* Method: serialClear * Method: serialClear
* Signature: (B)V * Signature: (B)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialClear( JNIEXPORT void JNICALL
JNIEnv* env, jclass, jbyte port) { Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialClear
(JNIEnv* env, jclass, jbyte port)
{
SERIALJNI_LOG(logDEBUG) << "Serial Clear"; SERIALJNI_LOG(logDEBUG) << "Serial Clear";
int32_t status = 0; int32_t status = 0;
HAL_ClearSerial(static_cast<HAL_SerialPort>(port), &status); HAL_ClearSerial(static_cast<HAL_SerialPort>(port), &status);
@@ -329,8 +355,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialClear(
* Method: serialClose * Method: serialClose
* Signature: (B)V * Signature: (B)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialClose( JNIEXPORT void JNICALL
JNIEnv* env, jclass, jbyte port) { Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialClose
(JNIEnv* env, jclass, jbyte port)
{
SERIALJNI_LOG(logDEBUG) << "Serial Close"; SERIALJNI_LOG(logDEBUG) << "Serial Close";
int32_t status = 0; int32_t status = 0;
HAL_CloseSerial(static_cast<HAL_SerialPort>(port), &status); HAL_CloseSerial(static_cast<HAL_SerialPort>(port), &status);

View File

@@ -1,19 +1,18 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */ /* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
#include <jni.h> #include <jni.h>
#include "HAL/Solenoid.h"
#include "HAL/Ports.h" #include "HAL/Ports.h"
#include "HAL/handles/HandlesInternal.h" #include "HAL/Solenoid.h"
#include "HAL/cpp/Log.h" #include "HAL/cpp/Log.h"
#include "HAL/handles/HandlesInternal.h"
#include "edu_wpi_first_wpilibj_hal_SolenoidJNI.h"
#include "HALUtil.h" #include "HALUtil.h"
#include "edu_wpi_first_wpilibj_hal_SolenoidJNI.h"
using namespace frc; using namespace frc;
@@ -23,7 +22,7 @@ TLogLevel solenoidJNILogLevel = logERROR;
if (level > solenoidJNILogLevel) \ if (level > solenoidJNILogLevel) \
; \ ; \
else \ else \
Log().Get(level) Log().Get(level)
extern "C" { extern "C" {
@@ -33,8 +32,9 @@ extern "C" {
* Signature: (I)I * Signature: (I)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_initializeSolenoidPort( Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_initializeSolenoidPort
JNIEnv *env, jclass, jint id) { (JNIEnv* env, jclass, jint id)
{
SOLENOIDJNI_LOG(logDEBUG) << "Calling SolenoidJNI initializeSolenoidPort"; SOLENOIDJNI_LOG(logDEBUG) << "Calling SolenoidJNI initializeSolenoidPort";
SOLENOIDJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_PortHandle)id; SOLENOIDJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_PortHandle)id;
@@ -55,10 +55,12 @@ Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_initializeSolenoidPort(
/* /*
* Class: edu_wpi_first_wpilibj_hal_SolenoidJNI * Class: edu_wpi_first_wpilibj_hal_SolenoidJNI
* Method: checkSolenoidChannel * Method: checkSolenoidChannel
* Signature: (I)Z; * Signature: (I)Z
*/ */
JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_checkSolenoidChannel( JNIEXPORT jboolean JNICALL
JNIEnv *env, jclass, jint channel) { Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_checkSolenoidChannel
(JNIEnv* env, jclass, jint channel)
{
SOLENOIDJNI_LOG(logDEBUG) << "Calling SolenoidJNI checkSolenoidChannel"; SOLENOIDJNI_LOG(logDEBUG) << "Calling SolenoidJNI checkSolenoidChannel";
SOLENOIDJNI_LOG(logDEBUG) << "Channel = " << channel; SOLENOIDJNI_LOG(logDEBUG) << "Channel = " << channel;
return HAL_CheckSolenoidChannel(channel); return HAL_CheckSolenoidChannel(channel);
@@ -67,10 +69,12 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_checkSolen
/* /*
* Class: edu_wpi_first_wpilibj_hal_SolenoidJNI * Class: edu_wpi_first_wpilibj_hal_SolenoidJNI
* Method: checkSolenoidModule * Method: checkSolenoidModule
* Signature: (I)Z; * Signature: (I)Z
*/ */
JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_checkSolenoidModule( JNIEXPORT jboolean JNICALL
JNIEnv *env, jclass, jint module) { Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_checkSolenoidModule
(JNIEnv* env, jclass, jint module)
{
SOLENOIDJNI_LOG(logDEBUG) << "Calling SolenoidJNI checkSolenoidModule"; SOLENOIDJNI_LOG(logDEBUG) << "Calling SolenoidJNI checkSolenoidModule";
SOLENOIDJNI_LOG(logDEBUG) << "Module = " << module; SOLENOIDJNI_LOG(logDEBUG) << "Module = " << module;
return HAL_CheckSolenoidModule(module); return HAL_CheckSolenoidModule(module);
@@ -82,8 +86,9 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_checkSolen
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_freeSolenoidPort( Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_freeSolenoidPort
JNIEnv *env, jclass, jint id) { (JNIEnv* env, jclass, jint id)
{
SOLENOIDJNI_LOG(logDEBUG) << "Calling SolenoidJNI initializeSolenoidPort"; SOLENOIDJNI_LOG(logDEBUG) << "Calling SolenoidJNI initializeSolenoidPort";
SOLENOIDJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_SolenoidHandle)id; SOLENOIDJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_SolenoidHandle)id;
@@ -95,12 +100,14 @@ Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_freeSolenoidPort(
* Method: setSolenoid * Method: setSolenoid
* Signature: (IZ)V * Signature: (IZ)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_setSolenoid( JNIEXPORT void JNICALL
JNIEnv *env, jclass, jint solenoid_port, jboolean value) { Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_setSolenoid
(JNIEnv* env, jclass, jint solenoid_port, jboolean value)
{
SOLENOIDJNI_LOG(logDEBUG) << "Calling SolenoidJNI SetSolenoid"; SOLENOIDJNI_LOG(logDEBUG) << "Calling SolenoidJNI SetSolenoid";
SOLENOIDJNI_LOG(logDEBUG) << "Solenoid Port Handle = " SOLENOIDJNI_LOG(logDEBUG)
<< (HAL_SolenoidHandle)solenoid_port; << "Solenoid Port Handle = " << (HAL_SolenoidHandle)solenoid_port;
int32_t status = 0; int32_t status = 0;
HAL_SetSolenoid((HAL_SolenoidHandle)solenoid_port, value, &status); HAL_SetSolenoid((HAL_SolenoidHandle)solenoid_port, value, &status);
@@ -113,8 +120,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_setSolenoid(
* Signature: (I)Z * Signature: (I)Z
*/ */
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getSolenoid( Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getSolenoid
JNIEnv *env, jclass, jint solenoid_port) { (JNIEnv* env, jclass, jint solenoid_port)
{
int32_t status = 0; int32_t status = 0;
jboolean val = HAL_GetSolenoid((HAL_SolenoidHandle)solenoid_port, &status); jboolean val = HAL_GetSolenoid((HAL_SolenoidHandle)solenoid_port, &status);
CheckStatus(env, status); CheckStatus(env, status);
@@ -127,8 +135,9 @@ Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getSolenoid(
* Signature: (I)I * Signature: (I)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getAllSolenoids( Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getAllSolenoids
JNIEnv *env, jclass, jint module) { (JNIEnv* env, jclass, jint module)
{
int32_t status = 0; int32_t status = 0;
jint val = HAL_GetAllSolenoids(module, &status); jint val = HAL_GetAllSolenoids(module, &status);
CheckStatus(env, status); CheckStatus(env, status);
@@ -141,8 +150,9 @@ Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getAllSolenoids(
* Signature: (I)I * Signature: (I)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getPCMSolenoidBlackList( Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getPCMSolenoidBlackList
JNIEnv *env, jclass, jint module) { (JNIEnv* env, jclass, jint module)
{
int32_t status = 0; int32_t status = 0;
jint val = HAL_GetPCMSolenoidBlackList(module, &status); jint val = HAL_GetPCMSolenoidBlackList(module, &status);
CheckStatus(env, status); CheckStatus(env, status);
@@ -154,8 +164,9 @@ Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getPCMSolenoidBlackList(
* Signature: (I)Z * Signature: (I)Z
*/ */
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getPCMSolenoidVoltageStickyFault( Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getPCMSolenoidVoltageStickyFault
JNIEnv *env, jclass, jint module) { (JNIEnv* env, jclass, jint module)
{
int32_t status = 0; int32_t status = 0;
bool val = HAL_GetPCMSolenoidVoltageStickyFault(module, &status); bool val = HAL_GetPCMSolenoidVoltageStickyFault(module, &status);
CheckStatus(env, status); CheckStatus(env, status);
@@ -167,8 +178,9 @@ Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getPCMSolenoidVoltageStickyFault(
* Signature: (I)Z * Signature: (I)Z
*/ */
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getPCMSolenoidVoltageFault( Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getPCMSolenoidVoltageFault
JNIEnv *env, jclass, jint module) { (JNIEnv* env, jclass, jint module)
{
int32_t status = 0; int32_t status = 0;
bool val = HAL_GetPCMSolenoidVoltageFault(module, &status); bool val = HAL_GetPCMSolenoidVoltageFault(module, &status);
CheckStatus(env, status); CheckStatus(env, status);
@@ -180,8 +192,9 @@ Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getPCMSolenoidVoltageFault(
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_clearAllPCMStickyFaults( Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_clearAllPCMStickyFaults
JNIEnv *env, jclass, jint module) { (JNIEnv* env, jclass, jint module)
{
int32_t status = 0; int32_t status = 0;
HAL_ClearAllPCMStickyFaults(module, &status); HAL_ClearAllPCMStickyFaults(module, &status);
CheckStatus(env, status); CheckStatus(env, status);
@@ -192,17 +205,19 @@ Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_clearAllPCMStickyFaults(
* Method: setOneShotDuration * Method: setOneShotDuration
* Signature: (IJ)V * Signature: (IJ)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_setOneShotDuration JNIEXPORT void JNICALL
(JNIEnv *env, jclass, jint solenoid_port, jlong durationMS) Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_setOneShotDuration
(JNIEnv* env, jclass, jint solenoid_port, jlong durationMS)
{ {
SOLENOIDJNI_LOG(logDEBUG) << "Calling SolenoidJNI SetOneShotDuration"; SOLENOIDJNI_LOG(logDEBUG) << "Calling SolenoidJNI SetOneShotDuration";
SOLENOIDJNI_LOG(logDEBUG) << "Solenoid Port Handle = " SOLENOIDJNI_LOG(logDEBUG)
<< (HAL_SolenoidHandle)solenoid_port; << "Solenoid Port Handle = " << (HAL_SolenoidHandle)solenoid_port;
SOLENOIDJNI_LOG(logDEBUG) << "Duration (MS) = " << durationMS; SOLENOIDJNI_LOG(logDEBUG) << "Duration (MS) = " << durationMS;
int32_t status = 0; int32_t status = 0;
HAL_SetOneShotDuration((HAL_SolenoidHandle)solenoid_port, durationMS, &status); HAL_SetOneShotDuration((HAL_SolenoidHandle)solenoid_port, durationMS,
&status);
CheckStatus(env, status); CheckStatus(env, status);
} }
@@ -211,13 +226,14 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_setOneShotDura
* Method: fireOneShot * Method: fireOneShot
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_fireOneShot JNIEXPORT void JNICALL
(JNIEnv *env, jclass, jint solenoid_port) Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_fireOneShot
(JNIEnv* env, jclass, jint solenoid_port)
{ {
SOLENOIDJNI_LOG(logDEBUG) << "Calling SolenoidJNI fireOneShot"; SOLENOIDJNI_LOG(logDEBUG) << "Calling SolenoidJNI fireOneShot";
SOLENOIDJNI_LOG(logDEBUG) << "Solenoid Port Handle = " SOLENOIDJNI_LOG(logDEBUG)
<< (HAL_SolenoidHandle)solenoid_port; << "Solenoid Port Handle = " << (HAL_SolenoidHandle)solenoid_port;
int32_t status = 0; int32_t status = 0;
HAL_FireOneShot((HAL_SolenoidHandle)solenoid_port, &status); HAL_FireOneShot((HAL_SolenoidHandle)solenoid_port, &status);

View File

@@ -1,18 +1,18 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */ /* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
#include <assert.h>
#include <jni.h> #include <jni.h>
#include "HAL/cpp/Log.h"
#include "edu_wpi_first_wpilibj_hal_ThreadsJNI.h" #include <cassert>
#include "HAL/Threads.h" #include "HAL/Threads.h"
#include "HAL/cpp/Log.h"
#include "HALUtil.h" #include "HALUtil.h"
#include "edu_wpi_first_wpilibj_hal_ThreadsJNI.h"
using namespace frc; using namespace frc;
@@ -21,18 +21,20 @@ TLogLevel threadsJNILogLevel = logWARNING;
#define THREADSJNI_LOG(level) \ #define THREADSJNI_LOG(level) \
if (level > threadsJNILogLevel) \ if (level > threadsJNILogLevel) \
; \ ; \
else \ else \
Log().Get(level) Log().Get(level)
extern "C" { extern "C" {
/* /*
* Class: edu_wpi_first_wpilibj_hal_ThreadsJNI * Class: edu_wpi_first_wpilibj_hal_ThreadsJNI
* Method: GetCurrentThreadPriority * Method: getCurrentThreadPriority
* Signature: ()I * Signature: ()I
*/ */
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_ThreadsJNI_getCurrentThreadPriority JNIEXPORT jint JNICALL
(JNIEnv *env, jclass) { Java_edu_wpi_first_wpilibj_hal_ThreadsJNI_getCurrentThreadPriority
(JNIEnv* env, jclass)
{
THREADSJNI_LOG(logDEBUG) << "Callling GetCurrentThreadPriority"; THREADSJNI_LOG(logDEBUG) << "Callling GetCurrentThreadPriority";
int32_t status = 0; int32_t status = 0;
HAL_Bool isRT = false; HAL_Bool isRT = false;
@@ -43,11 +45,13 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_ThreadsJNI_getCurrentThrea
/* /*
* Class: edu_wpi_first_wpilibj_hal_ThreadsJNI * Class: edu_wpi_first_wpilibj_hal_ThreadsJNI
* Method: GetCurrentThreadIsRealTime * Method: getCurrentThreadIsRealTime
* Signature: ()Z * Signature: ()Z
*/ */
JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_ThreadsJNI_getCurrentThreadIsRealTime JNIEXPORT jboolean JNICALL
(JNIEnv *env, jclass) { Java_edu_wpi_first_wpilibj_hal_ThreadsJNI_getCurrentThreadIsRealTime
(JNIEnv* env, jclass)
{
THREADSJNI_LOG(logDEBUG) << "Callling GetCurrentThreadIsRealTime"; THREADSJNI_LOG(logDEBUG) << "Callling GetCurrentThreadIsRealTime";
int32_t status = 0; int32_t status = 0;
HAL_Bool isRT = false; HAL_Bool isRT = false;
@@ -58,16 +62,19 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_ThreadsJNI_getCurrentT
/* /*
* Class: edu_wpi_first_wpilibj_hal_ThreadsJNI * Class: edu_wpi_first_wpilibj_hal_ThreadsJNI
* Method: SetCurrentThreadPriority * Method: setCurrentThreadPriority
* Signature: (ZI)Z * Signature: (ZI)Z
*/ */
JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_ThreadsJNI_setCurrentThreadPriority JNIEXPORT jboolean JNICALL
(JNIEnv *env, jclass, jboolean realTime, jint priority) { Java_edu_wpi_first_wpilibj_hal_ThreadsJNI_setCurrentThreadPriority
(JNIEnv* env, jclass, jboolean realTime, jint priority)
{
THREADSJNI_LOG(logDEBUG) << "Callling SetCurrentThreadPriority"; THREADSJNI_LOG(logDEBUG) << "Callling SetCurrentThreadPriority";
int32_t status = 0; int32_t status = 0;
auto ret = HAL_SetCurrentThreadPriority((HAL_Bool)realTime, (int32_t)priority, &status); auto ret = HAL_SetCurrentThreadPriority(
(HAL_Bool)realTime, static_cast<int32_t>(priority), &status);
CheckStatus(env, status); CheckStatus(env, status);
return (jboolean)ret; return (jboolean)ret;
} }
} } // extern "C"

View File

@@ -9,10 +9,10 @@
#ifndef __FRC_ROBORIO__ #ifndef __FRC_ROBORIO__
#include <wpi/StringRef.h>
#include <functional> #include <functional>
#include <wpi/StringRef.h>
#include "MockData/HAL_Value.h" #include "MockData/HAL_Value.h"
namespace frc { namespace frc {

View File

@@ -13,148 +13,266 @@
extern "C" { extern "C" {
/*
* Class: edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI
* Method: registerActiveCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_registerActiveCallback( Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_registerActiveCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterAccelerometerActiveCallback); &HALSIM_RegisterAccelerometerActiveCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI
* Method: cancelActiveCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_cancelActiveCallback( Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_cancelActiveCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelAccelerometerActiveCallback); &HALSIM_CancelAccelerometerActiveCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI
* Method: getActive
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_getActive(JNIEnv*, Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_getActive
jclass, (JNIEnv*, jclass, jint index)
jint index) { {
return HALSIM_GetAccelerometerActive(index); return HALSIM_GetAccelerometerActive(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI
* Method: setActive
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_setActive( Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_setActive
JNIEnv*, jclass, jint index, jboolean value) { (JNIEnv*, jclass, jint index, jboolean value)
{
HALSIM_SetAccelerometerActive(index, value); HALSIM_SetAccelerometerActive(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI
* Method: registerRangeCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_registerRangeCallback( Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_registerRangeCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterAccelerometerRangeCallback); &HALSIM_RegisterAccelerometerRangeCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI
* Method: cancelRangeCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_cancelRangeCallback( Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_cancelRangeCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelAccelerometerRangeCallback); &HALSIM_CancelAccelerometerRangeCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI
* Method: getRange
* Signature: (I)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_getRange(JNIEnv*, Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_getRange
jclass, (JNIEnv*, jclass, jint index)
jint index) { {
return HALSIM_GetAccelerometerRange(index); return HALSIM_GetAccelerometerRange(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI
* Method: setRange
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_setRange(JNIEnv*, Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_setRange
jclass, (JNIEnv*, jclass, jint index, jint value)
jint index, {
jint value) {
HALSIM_SetAccelerometerRange(index, HALSIM_SetAccelerometerRange(index,
static_cast<HAL_AccelerometerRange>(value)); static_cast<HAL_AccelerometerRange>(value));
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI
* Method: registerXCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_registerXCallback( Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_registerXCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterAccelerometerXCallback); &HALSIM_RegisterAccelerometerXCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI
* Method: cancelXCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_cancelXCallback( Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_cancelXCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelAccelerometerXCallback); &HALSIM_CancelAccelerometerXCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI
* Method: getX
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_getX(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_getX
jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetAccelerometerX(index); return HALSIM_GetAccelerometerX(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI
* Method: setX
* Signature: (ID)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_setX(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_setX
jint index, (JNIEnv*, jclass, jint index, jdouble value)
jdouble value) { {
HALSIM_SetAccelerometerX(index, value); HALSIM_SetAccelerometerX(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI
* Method: registerYCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_registerYCallback( Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_registerYCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterAccelerometerYCallback); &HALSIM_RegisterAccelerometerYCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI
* Method: cancelYCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_cancelYCallback( Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_cancelYCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelAccelerometerYCallback); &HALSIM_CancelAccelerometerYCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI
* Method: getY
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_getY(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_getY
jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetAccelerometerY(index); return HALSIM_GetAccelerometerY(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI
* Method: setY
* Signature: (ID)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_setY(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_setY
jint index, (JNIEnv*, jclass, jint index, jdouble value)
jdouble value) { {
HALSIM_SetAccelerometerY(index, value); HALSIM_SetAccelerometerY(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI
* Method: registerZCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_registerZCallback( Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_registerZCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterAccelerometerZCallback); &HALSIM_RegisterAccelerometerZCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI
* Method: cancelZCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_cancelZCallback( Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_cancelZCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelAccelerometerZCallback); &HALSIM_CancelAccelerometerZCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI
* Method: getZ
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_getZ(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_getZ
jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetAccelerometerZ(index); return HALSIM_GetAccelerometerZ(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI
* Method: setZ
* Signature: (ID)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_setZ(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_setZ
jint index, (JNIEnv*, jclass, jint index, jdouble value)
jdouble value) { {
HALSIM_SetAccelerometerZ(index, value); HALSIM_SetAccelerometerZ(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI
* Method: resetData
* Signature: (I)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_resetData(JNIEnv*, Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_resetData
jclass, (JNIEnv*, jclass, jint index)
jint index) { {
HALSIM_ResetAccelerometerData(index); HALSIM_ResetAccelerometerData(index);
} }

View File

@@ -13,89 +13,165 @@
extern "C" { extern "C" {
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI
* Method: registerAngleCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_registerAngleCallback( Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_registerAngleCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterAnalogGyroAngleCallback); &HALSIM_RegisterAnalogGyroAngleCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI
* Method: cancelAngleCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_cancelAngleCallback( Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_cancelAngleCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelAnalogGyroAngleCallback); &HALSIM_CancelAnalogGyroAngleCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI
* Method: getAngle
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_getAngle(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_getAngle
jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetAnalogGyroAngle(index); return HALSIM_GetAnalogGyroAngle(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI
* Method: setAngle
* Signature: (ID)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_setAngle(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_setAngle
jint index, (JNIEnv*, jclass, jint index, jdouble value)
jdouble value) { {
HALSIM_SetAnalogGyroAngle(index, value); HALSIM_SetAnalogGyroAngle(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI
* Method: registerRateCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_registerRateCallback( Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_registerRateCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterAnalogGyroRateCallback); &HALSIM_RegisterAnalogGyroRateCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI
* Method: cancelRateCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_cancelRateCallback( Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_cancelRateCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelAnalogGyroRateCallback); &HALSIM_CancelAnalogGyroRateCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI
* Method: getRate
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_getRate(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_getRate
jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetAnalogGyroRate(index); return HALSIM_GetAnalogGyroRate(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI
* Method: setRate
* Signature: (ID)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_setRate(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_setRate
jint index, (JNIEnv*, jclass, jint index, jdouble value)
jdouble value) { {
HALSIM_SetAnalogGyroRate(index, value); HALSIM_SetAnalogGyroRate(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI
* Method: registerInitializedCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_registerInitializedCallback( Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_registerInitializedCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterAnalogGyroInitializedCallback); &HALSIM_RegisterAnalogGyroInitializedCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI
* Method: cancelInitializedCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_cancelInitializedCallback( Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_cancelInitializedCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelAnalogGyroInitializedCallback); &HALSIM_CancelAnalogGyroInitializedCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI
* Method: getInitialized
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_getInitialized( Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_getInitialized
JNIEnv*, jclass, jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetAnalogGyroInitialized(index); return HALSIM_GetAnalogGyroInitialized(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI
* Method: setInitialized
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_setInitialized( Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_setInitialized
JNIEnv*, jclass, jint index, jboolean value) { (JNIEnv*, jclass, jint index, jboolean value)
{
HALSIM_SetAnalogGyroInitialized(index, value); HALSIM_SetAnalogGyroInitialized(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI
* Method: resetData
* Signature: (I)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_resetData(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_resetData
jint index) { (JNIEnv*, jclass, jint index)
{
HALSIM_ResetAnalogGyroData(index); HALSIM_ResetAnalogGyroData(index);
} }

View File

@@ -13,253 +13,470 @@
extern "C" { extern "C" {
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI
* Method: registerInitializedCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_registerInitializedCallback( Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_registerInitializedCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterAnalogInInitializedCallback); &HALSIM_RegisterAnalogInInitializedCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI
* Method: cancelInitializedCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_cancelInitializedCallback( Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_cancelInitializedCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelAnalogInInitializedCallback); &HALSIM_CancelAnalogInInitializedCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI
* Method: getInitialized
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_getInitialized(JNIEnv*, Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_getInitialized
jclass, (JNIEnv*, jclass, jint index)
jint index) { {
return HALSIM_GetAnalogInInitialized(index); return HALSIM_GetAnalogInInitialized(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI
* Method: setInitialized
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_setInitialized( Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_setInitialized
JNIEnv*, jclass, jint index, jboolean value) { (JNIEnv*, jclass, jint index, jboolean value)
{
HALSIM_SetAnalogInInitialized(index, value); HALSIM_SetAnalogInInitialized(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI
* Method: registerAverageBitsCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_registerAverageBitsCallback( Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_registerAverageBitsCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterAnalogInAverageBitsCallback); &HALSIM_RegisterAnalogInAverageBitsCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI
* Method: cancelAverageBitsCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_cancelAverageBitsCallback( Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_cancelAverageBitsCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelAnalogInAverageBitsCallback); &HALSIM_CancelAnalogInAverageBitsCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI
* Method: getAverageBits
* Signature: (I)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_getAverageBits(JNIEnv*, Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_getAverageBits
jclass, (JNIEnv*, jclass, jint index)
jint index) { {
return HALSIM_GetAnalogInAverageBits(index); return HALSIM_GetAnalogInAverageBits(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI
* Method: setAverageBits
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_setAverageBits(JNIEnv*, Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_setAverageBits
jclass, (JNIEnv*, jclass, jint index, jint value)
jint index, {
jint value) {
HALSIM_SetAnalogInAverageBits(index, value); HALSIM_SetAnalogInAverageBits(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI
* Method: registerOversampleBitsCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_registerOversampleBitsCallback( Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_registerOversampleBitsCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterAnalogInOversampleBitsCallback); &HALSIM_RegisterAnalogInOversampleBitsCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI
* Method: cancelOversampleBitsCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_cancelOversampleBitsCallback( Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_cancelOversampleBitsCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelAnalogInOversampleBitsCallback); &HALSIM_CancelAnalogInOversampleBitsCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI
* Method: getOversampleBits
* Signature: (I)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_getOversampleBits( Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_getOversampleBits
JNIEnv*, jclass, jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetAnalogInOversampleBits(index); return HALSIM_GetAnalogInOversampleBits(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI
* Method: setOversampleBits
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_setOversampleBits( Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_setOversampleBits
JNIEnv*, jclass, jint index, jint value) { (JNIEnv*, jclass, jint index, jint value)
{
HALSIM_SetAnalogInOversampleBits(index, value); HALSIM_SetAnalogInOversampleBits(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI
* Method: registerVoltageCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_registerVoltageCallback( Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_registerVoltageCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterAnalogInVoltageCallback); &HALSIM_RegisterAnalogInVoltageCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI
* Method: cancelVoltageCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_cancelVoltageCallback( Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_cancelVoltageCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelAnalogInVoltageCallback); &HALSIM_CancelAnalogInVoltageCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI
* Method: getVoltage
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_getVoltage(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_getVoltage
jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetAnalogInVoltage(index); return HALSIM_GetAnalogInVoltage(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI
* Method: setVoltage
* Signature: (ID)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_setVoltage(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_setVoltage
jint index, (JNIEnv*, jclass, jint index, jdouble value)
jdouble value) { {
HALSIM_SetAnalogInVoltage(index, value); HALSIM_SetAnalogInVoltage(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI
* Method: registerAccumulatorInitializedCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_registerAccumulatorInitializedCallback( Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_registerAccumulatorInitializedCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback( return sim::AllocateCallback(
env, index, callback, initialNotify, env, index, callback, initialNotify,
&HALSIM_RegisterAnalogInAccumulatorInitializedCallback); &HALSIM_RegisterAnalogInAccumulatorInitializedCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI
* Method: cancelAccumulatorInitializedCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_cancelAccumulatorInitializedCallback( Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_cancelAccumulatorInitializedCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback( return sim::FreeCallback(
env, handle, index, &HALSIM_CancelAnalogInAccumulatorInitializedCallback); env, handle, index, &HALSIM_CancelAnalogInAccumulatorInitializedCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI
* Method: getAccumulatorInitialized
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_getAccumulatorInitialized( Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_getAccumulatorInitialized
JNIEnv*, jclass, jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetAnalogInAccumulatorInitialized(index); return HALSIM_GetAnalogInAccumulatorInitialized(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI
* Method: setAccumulatorInitialized
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_setAccumulatorInitialized( Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_setAccumulatorInitialized
JNIEnv*, jclass, jint index, jboolean value) { (JNIEnv*, jclass, jint index, jboolean value)
{
HALSIM_SetAnalogInAccumulatorInitialized(index, value); HALSIM_SetAnalogInAccumulatorInitialized(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI
* Method: registerAccumulatorValueCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_registerAccumulatorValueCallback( Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_registerAccumulatorValueCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback( return sim::AllocateCallback(
env, index, callback, initialNotify, env, index, callback, initialNotify,
&HALSIM_RegisterAnalogInAccumulatorValueCallback); &HALSIM_RegisterAnalogInAccumulatorValueCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI
* Method: cancelAccumulatorValueCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_cancelAccumulatorValueCallback( Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_cancelAccumulatorValueCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelAnalogInAccumulatorValueCallback); &HALSIM_CancelAnalogInAccumulatorValueCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI
* Method: getAccumulatorValue
* Signature: (I)J
*/
JNIEXPORT jlong JNICALL JNIEXPORT jlong JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_getAccumulatorValue( Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_getAccumulatorValue
JNIEnv*, jclass, jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetAnalogInAccumulatorValue(index); return HALSIM_GetAnalogInAccumulatorValue(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI
* Method: setAccumulatorValue
* Signature: (IJ)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_setAccumulatorValue( Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_setAccumulatorValue
JNIEnv*, jclass, jint index, jlong value) { (JNIEnv*, jclass, jint index, jlong value)
{
HALSIM_SetAnalogInAccumulatorValue(index, value); HALSIM_SetAnalogInAccumulatorValue(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI
* Method: registerAccumulatorCountCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_registerAccumulatorCountCallback( Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_registerAccumulatorCountCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback( return sim::AllocateCallback(
env, index, callback, initialNotify, env, index, callback, initialNotify,
&HALSIM_RegisterAnalogInAccumulatorCountCallback); &HALSIM_RegisterAnalogInAccumulatorCountCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI
* Method: cancelAccumulatorCountCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_cancelAccumulatorCountCallback( Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_cancelAccumulatorCountCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelAnalogInAccumulatorCountCallback); &HALSIM_CancelAnalogInAccumulatorCountCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI
* Method: getAccumulatorCount
* Signature: (I)J
*/
JNIEXPORT jlong JNICALL JNIEXPORT jlong JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_getAccumulatorCount( Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_getAccumulatorCount
JNIEnv*, jclass, jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetAnalogInAccumulatorCount(index); return HALSIM_GetAnalogInAccumulatorCount(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI
* Method: setAccumulatorCount
* Signature: (IJ)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_setAccumulatorCount( Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_setAccumulatorCount
JNIEnv*, jclass, jint index, jlong value) { (JNIEnv*, jclass, jint index, jlong value)
{
HALSIM_SetAnalogInAccumulatorCount(index, value); HALSIM_SetAnalogInAccumulatorCount(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI
* Method: registerAccumulatorCenterCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_registerAccumulatorCenterCallback( Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_registerAccumulatorCenterCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback( return sim::AllocateCallback(
env, index, callback, initialNotify, env, index, callback, initialNotify,
&HALSIM_RegisterAnalogInAccumulatorCenterCallback); &HALSIM_RegisterAnalogInAccumulatorCenterCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI
* Method: cancelAccumulatorCenterCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_cancelAccumulatorCenterCallback( Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_cancelAccumulatorCenterCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelAnalogInAccumulatorCenterCallback); &HALSIM_CancelAnalogInAccumulatorCenterCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI
* Method: getAccumulatorCenter
* Signature: (I)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_getAccumulatorCenter( Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_getAccumulatorCenter
JNIEnv*, jclass, jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetAnalogInAccumulatorCenter(index); return HALSIM_GetAnalogInAccumulatorCenter(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI
* Method: setAccumulatorCenter
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_setAccumulatorCenter( Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_setAccumulatorCenter
JNIEnv*, jclass, jint index, jint value) { (JNIEnv*, jclass, jint index, jint value)
{
HALSIM_SetAnalogInAccumulatorCenter(index, value); HALSIM_SetAnalogInAccumulatorCenter(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI
* Method: registerAccumulatorDeadbandCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_registerAccumulatorDeadbandCallback( Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_registerAccumulatorDeadbandCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback( return sim::AllocateCallback(
env, index, callback, initialNotify, env, index, callback, initialNotify,
&HALSIM_RegisterAnalogInAccumulatorDeadbandCallback); &HALSIM_RegisterAnalogInAccumulatorDeadbandCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI
* Method: cancelAccumulatorDeadbandCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_cancelAccumulatorDeadbandCallback( Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_cancelAccumulatorDeadbandCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelAnalogInAccumulatorDeadbandCallback); &HALSIM_CancelAnalogInAccumulatorDeadbandCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI
* Method: getAccumulatorDeadband
* Signature: (I)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_getAccumulatorDeadband( Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_getAccumulatorDeadband
JNIEnv*, jclass, jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetAnalogInAccumulatorDeadband(index); return HALSIM_GetAnalogInAccumulatorDeadband(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI
* Method: setAccumulatorDeadband
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_setAccumulatorDeadband( Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_setAccumulatorDeadband
JNIEnv*, jclass, jint index, jint value) { (JNIEnv*, jclass, jint index, jint value)
{
HALSIM_SetAnalogInAccumulatorDeadband(index, value); HALSIM_SetAnalogInAccumulatorDeadband(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI
* Method: resetData
* Signature: (I)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_resetData(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_resetData
jint index) { (JNIEnv*, jclass, jint index)
{
HALSIM_ResetAnalogInData(index); HALSIM_ResetAnalogInData(index);
} }

View File

@@ -13,62 +13,115 @@
extern "C" { extern "C" {
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI
* Method: registerVoltageCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI_registerVoltageCallback( Java_edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI_registerVoltageCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterAnalogOutVoltageCallback); &HALSIM_RegisterAnalogOutVoltageCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI
* Method: cancelVoltageCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI_cancelVoltageCallback( Java_edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI_cancelVoltageCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelAnalogOutVoltageCallback); &HALSIM_CancelAnalogOutVoltageCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI
* Method: getVoltage
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI_getVoltage(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI_getVoltage
jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetAnalogOutVoltage(index); return HALSIM_GetAnalogOutVoltage(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI
* Method: setVoltage
* Signature: (ID)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI_setVoltage(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI_setVoltage
jint index, (JNIEnv*, jclass, jint index, jdouble value)
jdouble value) { {
HALSIM_SetAnalogOutVoltage(index, value); HALSIM_SetAnalogOutVoltage(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI
* Method: registerInitializedCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI_registerInitializedCallback( Java_edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI_registerInitializedCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterAnalogOutInitializedCallback); &HALSIM_RegisterAnalogOutInitializedCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI
* Method: cancelInitializedCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI_cancelInitializedCallback( Java_edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI_cancelInitializedCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelAnalogOutInitializedCallback); &HALSIM_CancelAnalogOutInitializedCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI
* Method: getInitialized
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI_getInitialized( Java_edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI_getInitialized
JNIEnv*, jclass, jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetAnalogOutInitialized(index); return HALSIM_GetAnalogOutInitialized(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI
* Method: setInitialized
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI_setInitialized( Java_edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI_setInitialized
JNIEnv*, jclass, jint index, jboolean value) { (JNIEnv*, jclass, jint index, jboolean value)
{
HALSIM_SetAnalogOutInitialized(index, value); HALSIM_SetAnalogOutInitialized(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI
* Method: resetData
* Signature: (I)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI_resetData(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI_resetData
jint index) { (JNIEnv*, jclass, jint index)
{
HALSIM_ResetAnalogOutData(index); HALSIM_ResetAnalogOutData(index);
} }

View File

@@ -13,91 +13,168 @@
extern "C" { extern "C" {
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI
* Method: registerInitializedCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_registerInitializedCallback( Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_registerInitializedCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback( return sim::AllocateCallback(
env, index, callback, initialNotify, env, index, callback, initialNotify,
&HALSIM_RegisterAnalogTriggerInitializedCallback); &HALSIM_RegisterAnalogTriggerInitializedCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI
* Method: cancelInitializedCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_cancelInitializedCallback( Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_cancelInitializedCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelAnalogTriggerInitializedCallback); &HALSIM_CancelAnalogTriggerInitializedCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI
* Method: getInitialized
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_getInitialized( Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_getInitialized
JNIEnv*, jclass, jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetAnalogTriggerInitialized(index); return HALSIM_GetAnalogTriggerInitialized(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI
* Method: setInitialized
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_setInitialized( Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_setInitialized
JNIEnv*, jclass, jint index, jboolean value) { (JNIEnv*, jclass, jint index, jboolean value)
{
HALSIM_SetAnalogTriggerInitialized(index, value); HALSIM_SetAnalogTriggerInitialized(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI
* Method: registerTriggerLowerBoundCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_registerTriggerLowerBoundCallback( Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_registerTriggerLowerBoundCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback( return sim::AllocateCallback(
env, index, callback, initialNotify, env, index, callback, initialNotify,
&HALSIM_RegisterAnalogTriggerTriggerLowerBoundCallback); &HALSIM_RegisterAnalogTriggerTriggerLowerBoundCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI
* Method: cancelTriggerLowerBoundCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_cancelTriggerLowerBoundCallback( Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_cancelTriggerLowerBoundCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback( return sim::FreeCallback(
env, handle, index, &HALSIM_CancelAnalogTriggerTriggerLowerBoundCallback); env, handle, index, &HALSIM_CancelAnalogTriggerTriggerLowerBoundCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI
* Method: getTriggerLowerBound
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_getTriggerLowerBound( Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_getTriggerLowerBound
JNIEnv*, jclass, jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetAnalogTriggerTriggerLowerBound(index); return HALSIM_GetAnalogTriggerTriggerLowerBound(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI
* Method: setTriggerLowerBound
* Signature: (ID)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_setTriggerLowerBound( Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_setTriggerLowerBound
JNIEnv*, jclass, jint index, jdouble value) { (JNIEnv*, jclass, jint index, jdouble value)
{
HALSIM_SetAnalogTriggerTriggerLowerBound(index, value); HALSIM_SetAnalogTriggerTriggerLowerBound(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI
* Method: registerTriggerUpperBoundCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_registerTriggerUpperBoundCallback( Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_registerTriggerUpperBoundCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback( return sim::AllocateCallback(
env, index, callback, initialNotify, env, index, callback, initialNotify,
&HALSIM_RegisterAnalogTriggerTriggerUpperBoundCallback); &HALSIM_RegisterAnalogTriggerTriggerUpperBoundCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI
* Method: cancelTriggerUpperBoundCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_cancelTriggerUpperBoundCallback( Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_cancelTriggerUpperBoundCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback( return sim::FreeCallback(
env, handle, index, &HALSIM_CancelAnalogTriggerTriggerUpperBoundCallback); env, handle, index, &HALSIM_CancelAnalogTriggerTriggerUpperBoundCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI
* Method: getTriggerUpperBound
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_getTriggerUpperBound( Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_getTriggerUpperBound
JNIEnv*, jclass, jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetAnalogTriggerTriggerUpperBound(index); return HALSIM_GetAnalogTriggerTriggerUpperBound(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI
* Method: setTriggerUpperBound
* Signature: (ID)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_setTriggerUpperBound( Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_setTriggerUpperBound
JNIEnv*, jclass, jint index, jdouble value) { (JNIEnv*, jclass, jint index, jdouble value)
{
HALSIM_SetAnalogTriggerTriggerUpperBound(index, value); HALSIM_SetAnalogTriggerTriggerUpperBound(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI
* Method: resetData
* Signature: (I)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_resetData(JNIEnv*, Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_resetData
jclass, (JNIEnv*, jclass, jint index)
jint index) { {
HALSIM_ResetAnalogTriggerData(index); HALSIM_ResetAnalogTriggerData(index);
} }

View File

@@ -8,6 +8,7 @@
#include "BufferCallbackStore.h" #include "BufferCallbackStore.h"
#include <jni.h> #include <jni.h>
#include <wpi/jni_util.h> #include <wpi/jni_util.h>
#include "HAL/Types.h" #include "HAL/Types.h"

View File

@@ -8,6 +8,7 @@
#pragma once #pragma once
#include <jni.h> #include <jni.h>
#include <wpi/jni_util.h> #include <wpi/jni_util.h>
#include "HAL/Types.h" #include "HAL/Types.h"

View File

@@ -8,6 +8,7 @@
#include "CallbackStore.h" #include "CallbackStore.h"
#include <jni.h> #include <jni.h>
#include <wpi/jni_util.h> #include <wpi/jni_util.h>
#include "HAL/Types.h" #include "HAL/Types.h"

View File

@@ -8,6 +8,7 @@
#pragma once #pragma once
#include <jni.h> #include <jni.h>
#include <wpi/jni_util.h> #include <wpi/jni_util.h>
#include "HAL/Types.h" #include "HAL/Types.h"

View File

@@ -8,6 +8,7 @@
#include "ConstBufferCallbackStore.h" #include "ConstBufferCallbackStore.h"
#include <jni.h> #include <jni.h>
#include <wpi/jni_util.h> #include <wpi/jni_util.h>
#include "HAL/Types.h" #include "HAL/Types.h"

View File

@@ -8,6 +8,7 @@
#pragma once #pragma once
#include <jni.h> #include <jni.h>
#include <wpi/jni_util.h> #include <wpi/jni_util.h>
#include "HAL/Types.h" #include "HAL/Types.h"

View File

@@ -13,140 +13,264 @@
extern "C" { extern "C" {
/*
* Class: edu_wpi_first_hal_sim_mockdata_DIODataJNI
* Method: registerInitializedCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_registerInitializedCallback( Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_registerInitializedCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterDIOInitializedCallback); &HALSIM_RegisterDIOInitializedCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DIODataJNI
* Method: cancelInitializedCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_cancelInitializedCallback( Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_cancelInitializedCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelDIOInitializedCallback); &HALSIM_CancelDIOInitializedCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DIODataJNI
* Method: getInitialized
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_getInitialized(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_getInitialized
jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetDIOInitialized(index); return HALSIM_GetDIOInitialized(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DIODataJNI
* Method: setInitialized
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_setInitialized(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_setInitialized
jint index, (JNIEnv*, jclass, jint index, jboolean value)
jboolean value) { {
HALSIM_SetDIOInitialized(index, value); HALSIM_SetDIOInitialized(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DIODataJNI
* Method: registerValueCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_registerValueCallback( Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_registerValueCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterDIOValueCallback); &HALSIM_RegisterDIOValueCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DIODataJNI
* Method: cancelValueCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_cancelValueCallback( Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_cancelValueCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, &HALSIM_CancelDIOValueCallback); return sim::FreeCallback(env, handle, index, &HALSIM_CancelDIOValueCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DIODataJNI
* Method: getValue
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_getValue(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_getValue
jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetDIOValue(index); return HALSIM_GetDIOValue(index);
} }
JNIEXPORT void JNICALL Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_setValue( /*
JNIEnv*, jclass, jint index, jboolean value) { * Class: edu_wpi_first_hal_sim_mockdata_DIODataJNI
* Method: setValue
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_setValue
(JNIEnv*, jclass, jint index, jboolean value)
{
HALSIM_SetDIOValue(index, value); HALSIM_SetDIOValue(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DIODataJNI
* Method: registerPulseLengthCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_registerPulseLengthCallback( Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_registerPulseLengthCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterDIOPulseLengthCallback); &HALSIM_RegisterDIOPulseLengthCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DIODataJNI
* Method: cancelPulseLengthCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_cancelPulseLengthCallback( Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_cancelPulseLengthCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelDIOPulseLengthCallback); &HALSIM_CancelDIOPulseLengthCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DIODataJNI
* Method: getPulseLength
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_getPulseLength(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_getPulseLength
jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetDIOPulseLength(index); return HALSIM_GetDIOPulseLength(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DIODataJNI
* Method: setPulseLength
* Signature: (ID)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_setPulseLength(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_setPulseLength
jint index, (JNIEnv*, jclass, jint index, jdouble value)
jdouble value) { {
HALSIM_SetDIOPulseLength(index, value); HALSIM_SetDIOPulseLength(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DIODataJNI
* Method: registerIsInputCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_registerIsInputCallback( Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_registerIsInputCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterDIOIsInputCallback); &HALSIM_RegisterDIOIsInputCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DIODataJNI
* Method: cancelIsInputCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_cancelIsInputCallback( Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_cancelIsInputCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelDIOIsInputCallback); &HALSIM_CancelDIOIsInputCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DIODataJNI
* Method: getIsInput
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_getIsInput(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_getIsInput
jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetDIOIsInput(index); return HALSIM_GetDIOIsInput(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DIODataJNI
* Method: setIsInput
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_setIsInput(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_setIsInput
jint index, (JNIEnv*, jclass, jint index, jboolean value)
jboolean value) { {
HALSIM_SetDIOIsInput(index, value); HALSIM_SetDIOIsInput(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DIODataJNI
* Method: registerFilterIndexCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_registerFilterIndexCallback( Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_registerFilterIndexCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterDIOFilterIndexCallback); &HALSIM_RegisterDIOFilterIndexCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DIODataJNI
* Method: cancelFilterIndexCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_cancelFilterIndexCallback( Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_cancelFilterIndexCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelDIOFilterIndexCallback); &HALSIM_CancelDIOFilterIndexCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DIODataJNI
* Method: getFilterIndex
* Signature: (I)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_getFilterIndex(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_getFilterIndex
jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetDIOFilterIndex(index); return HALSIM_GetDIOFilterIndex(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DIODataJNI
* Method: setFilterIndex
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_setFilterIndex(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_setFilterIndex
jint index, (JNIEnv*, jclass, jint index, jint value)
jint value) { {
HALSIM_SetDIOFilterIndex(index, value); HALSIM_SetDIOFilterIndex(index, value);
} }
JNIEXPORT void JNICALL Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_resetData( /*
JNIEnv*, jclass, jint index) { * Class: edu_wpi_first_hal_sim_mockdata_DIODataJNI
* Method: resetData
* Signature: (I)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_resetData
(JNIEnv*, jclass, jint index)
{
HALSIM_ResetDIOData(index); HALSIM_ResetDIOData(index);
} }

View File

@@ -13,89 +13,165 @@
extern "C" { extern "C" {
/*
* Class: edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI
* Method: registerInitializedCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_registerInitializedCallback( Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_registerInitializedCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterDigitalPWMInitializedCallback); &HALSIM_RegisterDigitalPWMInitializedCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI
* Method: cancelInitializedCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_cancelInitializedCallback( Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_cancelInitializedCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelDigitalPWMInitializedCallback); &HALSIM_CancelDigitalPWMInitializedCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI
* Method: getInitialized
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_getInitialized( Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_getInitialized
JNIEnv*, jclass, jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetDigitalPWMInitialized(index); return HALSIM_GetDigitalPWMInitialized(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI
* Method: setInitialized
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_setInitialized( Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_setInitialized
JNIEnv*, jclass, jint index, jboolean value) { (JNIEnv*, jclass, jint index, jboolean value)
{
HALSIM_SetDigitalPWMInitialized(index, value); HALSIM_SetDigitalPWMInitialized(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI
* Method: registerDutyCycleCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_registerDutyCycleCallback( Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_registerDutyCycleCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterDigitalPWMDutyCycleCallback); &HALSIM_RegisterDigitalPWMDutyCycleCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI
* Method: cancelDutyCycleCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_cancelDutyCycleCallback( Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_cancelDutyCycleCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelDigitalPWMDutyCycleCallback); &HALSIM_CancelDigitalPWMDutyCycleCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI
* Method: getDutyCycle
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_getDutyCycle(JNIEnv*, Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_getDutyCycle
jclass, (JNIEnv*, jclass, jint index)
jint index) { {
return HALSIM_GetDigitalPWMDutyCycle(index); return HALSIM_GetDigitalPWMDutyCycle(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI
* Method: setDutyCycle
* Signature: (ID)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_setDutyCycle( Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_setDutyCycle
JNIEnv*, jclass, jint index, jdouble value) { (JNIEnv*, jclass, jint index, jdouble value)
{
HALSIM_SetDigitalPWMDutyCycle(index, value); HALSIM_SetDigitalPWMDutyCycle(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI
* Method: registerPinCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_registerPinCallback( Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_registerPinCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterDigitalPWMPinCallback); &HALSIM_RegisterDigitalPWMPinCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI
* Method: cancelPinCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_cancelPinCallback( Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_cancelPinCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelDigitalPWMPinCallback); &HALSIM_CancelDigitalPWMPinCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI
* Method: getPin
* Signature: (I)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_getPin(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_getPin
jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetDigitalPWMPin(index); return HALSIM_GetDigitalPWMPin(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI
* Method: setPin
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_setPin(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_setPin
jint index, (JNIEnv*, jclass, jint index, jint value)
jint value) { {
HALSIM_SetDigitalPWMPin(index, value); HALSIM_SetDigitalPWMPin(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI
* Method: resetData
* Signature: (I)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_resetData(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_resetData
jint index) { (JNIEnv*, jclass, jint index)
{
HALSIM_ResetDigitalPWMData(index); HALSIM_ResetDigitalPWMData(index);
} }

View File

@@ -13,174 +13,319 @@
extern "C" { extern "C" {
/*
* Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI
* Method: registerEnabledCallback
* Signature: (Ljava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_registerEnabledCallback( Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_registerEnabledCallback
JNIEnv* env, jclass, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallbackNoIndex( return sim::AllocateCallbackNoIndex(
env, callback, initialNotify, env, callback, initialNotify,
&HALSIM_RegisterDriverStationEnabledCallback); &HALSIM_RegisterDriverStationEnabledCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI
* Method: cancelEnabledCallback
* Signature: (I)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_cancelEnabledCallback( Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_cancelEnabledCallback
JNIEnv* env, jclass, jint handle) { (JNIEnv* env, jclass, jint handle)
{
return sim::FreeCallbackNoIndex(env, handle, return sim::FreeCallbackNoIndex(env, handle,
&HALSIM_CancelDriverStationEnabledCallback); &HALSIM_CancelDriverStationEnabledCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI
* Method: getEnabled
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_getEnabled(JNIEnv*, Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_getEnabled
jclass) { (JNIEnv*, jclass)
{
return HALSIM_GetDriverStationEnabled(); return HALSIM_GetDriverStationEnabled();
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI
* Method: setEnabled
* Signature: (Z)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setEnabled( Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setEnabled
JNIEnv*, jclass, jboolean value) { (JNIEnv*, jclass, jboolean value)
{
HALSIM_SetDriverStationEnabled(value); HALSIM_SetDriverStationEnabled(value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI
* Method: registerAutonomousCallback
* Signature: (Ljava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_registerAutonomousCallback( Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_registerAutonomousCallback
JNIEnv* env, jclass, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallbackNoIndex( return sim::AllocateCallbackNoIndex(
env, callback, initialNotify, env, callback, initialNotify,
&HALSIM_RegisterDriverStationAutonomousCallback); &HALSIM_RegisterDriverStationAutonomousCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI
* Method: cancelAutonomousCallback
* Signature: (I)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_cancelAutonomousCallback( Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_cancelAutonomousCallback
JNIEnv* env, jclass, jint handle) { (JNIEnv* env, jclass, jint handle)
{
return sim::FreeCallbackNoIndex( return sim::FreeCallbackNoIndex(
env, handle, &HALSIM_CancelDriverStationAutonomousCallback); env, handle, &HALSIM_CancelDriverStationAutonomousCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI
* Method: getAutonomous
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_getAutonomous(JNIEnv*, Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_getAutonomous
jclass) { (JNIEnv*, jclass)
{
return HALSIM_GetDriverStationAutonomous(); return HALSIM_GetDriverStationAutonomous();
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI
* Method: setAutonomous
* Signature: (Z)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setAutonomous( Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setAutonomous
JNIEnv*, jclass, jboolean value) { (JNIEnv*, jclass, jboolean value)
{
HALSIM_SetDriverStationAutonomous(value); HALSIM_SetDriverStationAutonomous(value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI
* Method: registerTestCallback
* Signature: (Ljava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_registerTestCallback( Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_registerTestCallback
JNIEnv* env, jclass, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallbackNoIndex( return sim::AllocateCallbackNoIndex(
env, callback, initialNotify, &HALSIM_RegisterDriverStationTestCallback); env, callback, initialNotify, &HALSIM_RegisterDriverStationTestCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI
* Method: cancelTestCallback
* Signature: (I)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_cancelTestCallback( Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_cancelTestCallback
JNIEnv* env, jclass, jint handle) { (JNIEnv* env, jclass, jint handle)
{
return sim::FreeCallbackNoIndex(env, handle, return sim::FreeCallbackNoIndex(env, handle,
&HALSIM_CancelDriverStationTestCallback); &HALSIM_CancelDriverStationTestCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI
* Method: getTest
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_getTest(JNIEnv*, Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_getTest
jclass) { (JNIEnv*, jclass)
{
return HALSIM_GetDriverStationTest(); return HALSIM_GetDriverStationTest();
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI
* Method: setTest
* Signature: (Z)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setTest( Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setTest
JNIEnv*, jclass, jboolean value) { (JNIEnv*, jclass, jboolean value)
{
HALSIM_SetDriverStationTest(value); HALSIM_SetDriverStationTest(value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI
* Method: registerEStopCallback
* Signature: (Ljava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_registerEStopCallback( Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_registerEStopCallback
JNIEnv* env, jclass, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallbackNoIndex( return sim::AllocateCallbackNoIndex(
env, callback, initialNotify, &HALSIM_RegisterDriverStationEStopCallback); env, callback, initialNotify, &HALSIM_RegisterDriverStationEStopCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI
* Method: cancelEStopCallback
* Signature: (I)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_cancelEStopCallback( Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_cancelEStopCallback
JNIEnv* env, jclass, jint handle) { (JNIEnv* env, jclass, jint handle)
{
return sim::FreeCallbackNoIndex(env, handle, return sim::FreeCallbackNoIndex(env, handle,
&HALSIM_CancelDriverStationEStopCallback); &HALSIM_CancelDriverStationEStopCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI
* Method: getEStop
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_getEStop(JNIEnv*, Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_getEStop
jclass) { (JNIEnv*, jclass)
{
return HALSIM_GetDriverStationEStop(); return HALSIM_GetDriverStationEStop();
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI
* Method: setEStop
* Signature: (Z)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setEStop( Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setEStop
JNIEnv*, jclass, jboolean value) { (JNIEnv*, jclass, jboolean value)
{
HALSIM_SetDriverStationEStop(value); HALSIM_SetDriverStationEStop(value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI
* Method: registerFmsAttachedCallback
* Signature: (Ljava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_registerFmsAttachedCallback( Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_registerFmsAttachedCallback
JNIEnv* env, jclass, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallbackNoIndex( return sim::AllocateCallbackNoIndex(
env, callback, initialNotify, env, callback, initialNotify,
&HALSIM_RegisterDriverStationFmsAttachedCallback); &HALSIM_RegisterDriverStationFmsAttachedCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI
* Method: cancelFmsAttachedCallback
* Signature: (I)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_cancelFmsAttachedCallback( Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_cancelFmsAttachedCallback
JNIEnv* env, jclass, jint handle) { (JNIEnv* env, jclass, jint handle)
{
return sim::FreeCallbackNoIndex( return sim::FreeCallbackNoIndex(
env, handle, &HALSIM_CancelDriverStationFmsAttachedCallback); env, handle, &HALSIM_CancelDriverStationFmsAttachedCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI
* Method: getFmsAttached
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_getFmsAttached( Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_getFmsAttached
JNIEnv*, jclass) { (JNIEnv*, jclass)
{
return HALSIM_GetDriverStationFmsAttached(); return HALSIM_GetDriverStationFmsAttached();
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI
* Method: setFmsAttached
* Signature: (Z)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setFmsAttached( Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setFmsAttached
JNIEnv*, jclass, jboolean value) { (JNIEnv*, jclass, jboolean value)
{
HALSIM_SetDriverStationFmsAttached(value); HALSIM_SetDriverStationFmsAttached(value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI
* Method: registerDsAttachedCallback
* Signature: (Ljava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_registerDsAttachedCallback( Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_registerDsAttachedCallback
JNIEnv* env, jclass, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallbackNoIndex( return sim::AllocateCallbackNoIndex(
env, callback, initialNotify, env, callback, initialNotify,
&HALSIM_RegisterDriverStationDsAttachedCallback); &HALSIM_RegisterDriverStationDsAttachedCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI
* Method: cancelDsAttachedCallback
* Signature: (I)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_cancelDsAttachedCallback( Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_cancelDsAttachedCallback
JNIEnv* env, jclass, jint handle) { (JNIEnv* env, jclass, jint handle)
{
return sim::FreeCallbackNoIndex( return sim::FreeCallbackNoIndex(
env, handle, &HALSIM_CancelDriverStationDsAttachedCallback); env, handle, &HALSIM_CancelDriverStationDsAttachedCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI
* Method: getDsAttached
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_getDsAttached(JNIEnv*, Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_getDsAttached
jclass) { (JNIEnv*, jclass)
{
return HALSIM_GetDriverStationDsAttached(); return HALSIM_GetDriverStationDsAttached();
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI
* Method: setDsAttached
* Signature: (Z)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setDsAttached( Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setDsAttached
JNIEnv*, jclass, jboolean value) { (JNIEnv*, jclass, jboolean value)
{
HALSIM_SetDriverStationDsAttached(value); HALSIM_SetDriverStationDsAttached(value);
} }
/* /*
* Class: edu_wpi_first_hal_sim_mockdata_DriverStationSim * Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI
* Method: setJoystickAxes * Method: setJoystickAxes
* Signature: (B[F)V * Signature: (B[F)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setJoystickAxes( Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setJoystickAxes
JNIEnv* env, jclass, jbyte joystickNum, jfloatArray axesArray) { (JNIEnv* env, jclass, jbyte joystickNum, jfloatArray axesArray)
{
HAL_JoystickAxes axes; HAL_JoystickAxes axes;
{ {
wpi::java::JFloatArrayRef jArrayRef(env, axesArray); wpi::java::JFloatArrayRef jArrayRef(env, axesArray);
@@ -198,13 +343,14 @@ Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setJoystickAxes(
} }
/* /*
* Class: edu_wpi_first_hal_sim_mockdata_DriverStationSim * Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI
* Method: setJoystickPOVs * Method: setJoystickPOVs
* Signature: (B[S)V * Signature: (B[S)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setJoystickPOVs( Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setJoystickPOVs
JNIEnv* env, jclass, jbyte joystickNum, jshortArray povsArray) { (JNIEnv* env, jclass, jbyte joystickNum, jshortArray povsArray)
{
HAL_JoystickPOVs povs; HAL_JoystickPOVs povs;
{ {
wpi::java::JShortArrayRef jArrayRef(env, povsArray); wpi::java::JShortArrayRef jArrayRef(env, povsArray);
@@ -222,13 +368,14 @@ Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setJoystickPOVs(
} }
/* /*
* Class: edu_wpi_first_hal_sim_mockdata_DriverStationSim * Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI
* Method: setJoystickButtons * Method: setJoystickButtons
* Signature: (BII)V * Signature: (BII)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setJoystickButtons( Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setJoystickButtons
JNIEnv* env, jclass, jbyte joystickNum, jint buttons, jint count) { (JNIEnv* env, jclass, jbyte joystickNum, jint buttons, jint count)
{
if (count > 32) { if (count > 32) {
count = 32; count = 32;
} }
@@ -239,22 +386,24 @@ Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setJoystickButtons(
} }
/* /*
* Class: edu_wpi_first_hal_sim_mockdata_DriverStationSim * Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI
* Method: setMatchInfo * Method: setMatchInfo
* Signature: (Ledu/wpi/first/wpilibj/hal/MatchInfoData;)V * Signature: (Ljava/lang/Object;)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setMatchInfo( Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setMatchInfo
JNIEnv* env, jclass, jobject info) {} (JNIEnv* env, jclass, jobject info)
{}
/* /*
* Class: edu_wpi_first_hal_sim_mockdata_DriverStationSim * Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI
* Method: registerAllCallbacks * Method: registerAllCallbacks
* Signature: (Ledu/wpi/first/hal/sim/NotifyCallback;Z)V * Signature: (Ljava/lang/Object;Z)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_registerAllCallbacks( Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_registerAllCallbacks
JNIEnv* env, jclass, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jobject callback, jboolean initialNotify)
{
sim::AllocateCallbackNoIndex( sim::AllocateCallbackNoIndex(
env, callback, initialNotify, env, callback, initialNotify,
[](HAL_NotifyCallback cb, void* param, HAL_Bool in) { [](HAL_NotifyCallback cb, void* param, HAL_Bool in) {
@@ -264,19 +413,26 @@ Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_registerAllCallbacks(
} }
/* /*
* Class: edu_wpi_first_hal_sim_mockdata_DriverStationSim * Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI
* Method: notifyNewData * Method: notifyNewData
* Signature: ()V * Signature: ()V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_notifyNewData(JNIEnv*, Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_notifyNewData
jclass) { (JNIEnv*, jclass)
{
HALSIM_NotifyDriverStationNewData(); HALSIM_NotifyDriverStationNewData();
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI
* Method: resetData
* Signature: ()V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_resetData(JNIEnv*, Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_resetData
jclass) { (JNIEnv*, jclass)
{
HALSIM_ResetDriverStationData(); HALSIM_ResetDriverStationData();
} }

View File

@@ -13,222 +13,415 @@
extern "C" { extern "C" {
/*
* Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI
* Method: registerInitializedCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_registerInitializedCallback( Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_registerInitializedCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterEncoderInitializedCallback); &HALSIM_RegisterEncoderInitializedCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI
* Method: cancelInitializedCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_cancelInitializedCallback( Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_cancelInitializedCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelEncoderInitializedCallback); &HALSIM_CancelEncoderInitializedCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI
* Method: getInitialized
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_getInitialized(JNIEnv*, Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_getInitialized
jclass, (JNIEnv*, jclass, jint index)
jint index) { {
return HALSIM_GetEncoderInitialized(index); return HALSIM_GetEncoderInitialized(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI
* Method: setInitialized
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_setInitialized( Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_setInitialized
JNIEnv*, jclass, jint index, jboolean value) { (JNIEnv*, jclass, jint index, jboolean value)
{
HALSIM_SetEncoderInitialized(index, value); HALSIM_SetEncoderInitialized(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI
* Method: registerCountCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_registerCountCallback( Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_registerCountCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterEncoderCountCallback); &HALSIM_RegisterEncoderCountCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI
* Method: cancelCountCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_cancelCountCallback( Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_cancelCountCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelEncoderCountCallback); &HALSIM_CancelEncoderCountCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI
* Method: getCount
* Signature: (I)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_getCount(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_getCount
jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetEncoderCount(index); return HALSIM_GetEncoderCount(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI
* Method: setCount
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_setCount(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_setCount
jint index, (JNIEnv*, jclass, jint index, jint value)
jint value) { {
HALSIM_SetEncoderCount(index, value); HALSIM_SetEncoderCount(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI
* Method: registerPeriodCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_registerPeriodCallback( Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_registerPeriodCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterEncoderPeriodCallback); &HALSIM_RegisterEncoderPeriodCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI
* Method: cancelPeriodCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_cancelPeriodCallback( Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_cancelPeriodCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelEncoderPeriodCallback); &HALSIM_CancelEncoderPeriodCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI
* Method: getPeriod
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_getPeriod(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_getPeriod
jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetEncoderPeriod(index); return HALSIM_GetEncoderPeriod(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI
* Method: setPeriod
* Signature: (ID)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_setPeriod(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_setPeriod
jint index, (JNIEnv*, jclass, jint index, jdouble value)
jdouble value) { {
HALSIM_SetEncoderPeriod(index, value); HALSIM_SetEncoderPeriod(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI
* Method: registerResetCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_registerResetCallback( Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_registerResetCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterEncoderResetCallback); &HALSIM_RegisterEncoderResetCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI
* Method: cancelResetCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_cancelResetCallback( Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_cancelResetCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelEncoderResetCallback); &HALSIM_CancelEncoderResetCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI
* Method: getReset
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_getReset(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_getReset
jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetEncoderReset(index); return HALSIM_GetEncoderReset(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI
* Method: setReset
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_setReset(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_setReset
jint index, (JNIEnv*, jclass, jint index, jboolean value)
jboolean value) { {
HALSIM_SetEncoderReset(index, value); HALSIM_SetEncoderReset(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI
* Method: registerMaxPeriodCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_registerMaxPeriodCallback( Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_registerMaxPeriodCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterEncoderMaxPeriodCallback); &HALSIM_RegisterEncoderMaxPeriodCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI
* Method: cancelMaxPeriodCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_cancelMaxPeriodCallback( Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_cancelMaxPeriodCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelEncoderMaxPeriodCallback); &HALSIM_CancelEncoderMaxPeriodCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI
* Method: getMaxPeriod
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_getMaxPeriod(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_getMaxPeriod
jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetEncoderMaxPeriod(index); return HALSIM_GetEncoderMaxPeriod(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI
* Method: setMaxPeriod
* Signature: (ID)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_setMaxPeriod(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_setMaxPeriod
jint index, (JNIEnv*, jclass, jint index, jdouble value)
jdouble value) { {
HALSIM_SetEncoderMaxPeriod(index, value); HALSIM_SetEncoderMaxPeriod(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI
* Method: registerDirectionCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_registerDirectionCallback( Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_registerDirectionCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterEncoderDirectionCallback); &HALSIM_RegisterEncoderDirectionCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI
* Method: cancelDirectionCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_cancelDirectionCallback( Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_cancelDirectionCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelEncoderDirectionCallback); &HALSIM_CancelEncoderDirectionCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI
* Method: getDirection
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_getDirection(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_getDirection
jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetEncoderDirection(index); return HALSIM_GetEncoderDirection(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI
* Method: setDirection
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_setDirection( Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_setDirection
JNIEnv*, jclass, jint index, jboolean value) { (JNIEnv*, jclass, jint index, jboolean value)
{
HALSIM_SetEncoderDirection(index, value); HALSIM_SetEncoderDirection(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI
* Method: registerReverseDirectionCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_registerReverseDirectionCallback( Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_registerReverseDirectionCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterEncoderReverseDirectionCallback); &HALSIM_RegisterEncoderReverseDirectionCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI
* Method: cancelReverseDirectionCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_cancelReverseDirectionCallback( Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_cancelReverseDirectionCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelEncoderReverseDirectionCallback); &HALSIM_CancelEncoderReverseDirectionCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI
* Method: getReverseDirection
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_getReverseDirection( Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_getReverseDirection
JNIEnv*, jclass, jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetEncoderReverseDirection(index); return HALSIM_GetEncoderReverseDirection(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI
* Method: setReverseDirection
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_setReverseDirection( Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_setReverseDirection
JNIEnv*, jclass, jint index, jboolean value) { (JNIEnv*, jclass, jint index, jboolean value)
{
HALSIM_SetEncoderReverseDirection(index, value); HALSIM_SetEncoderReverseDirection(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI
* Method: registerSamplesToAverageCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_registerSamplesToAverageCallback( Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_registerSamplesToAverageCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterEncoderSamplesToAverageCallback); &HALSIM_RegisterEncoderSamplesToAverageCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI
* Method: cancelSamplesToAverageCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_cancelSamplesToAverageCallback( Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_cancelSamplesToAverageCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelEncoderSamplesToAverageCallback); &HALSIM_CancelEncoderSamplesToAverageCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI
* Method: getSamplesToAverage
* Signature: (I)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_getSamplesToAverage( Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_getSamplesToAverage
JNIEnv*, jclass, jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetEncoderSamplesToAverage(index); return HALSIM_GetEncoderSamplesToAverage(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI
* Method: setSamplesToAverage
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_setSamplesToAverage( Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_setSamplesToAverage
JNIEnv*, jclass, jint index, jint value) { (JNIEnv*, jclass, jint index, jint value)
{
HALSIM_SetEncoderSamplesToAverage(index, value); HALSIM_SetEncoderSamplesToAverage(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI
* Method: resetData
* Signature: (I)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_resetData(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_resetData
jint index) { (JNIEnv*, jclass, jint index)
{
HALSIM_ResetEncoderData(index); HALSIM_ResetEncoderData(index);
} }

View File

@@ -16,108 +16,115 @@
extern "C" { extern "C" {
/* /*
* Class: edu_wpi_first_hal_sim_mockdata_I2CSim * Class: edu_wpi_first_hal_sim_mockdata_I2CDataJNI
* Method: registerInitializedCallback * Method: registerInitializedCallback
* Signature: (ILedu/wpi/first/hal/sim/NotifyCallback;Z)I * Signature: (ILjava/lang/Object;Z)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_I2CDataJNI_registerInitializedCallback( Java_edu_wpi_first_hal_sim_mockdata_I2CDataJNI_registerInitializedCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterI2CInitializedCallback); &HALSIM_RegisterI2CInitializedCallback);
} }
/* /*
* Class: edu_wpi_first_hal_sim_mockdata_I2CSim * Class: edu_wpi_first_hal_sim_mockdata_I2CDataJNI
* Method: cancelInitializedCallback * Method: cancelInitializedCallback
* Signature: (II)V * Signature: (II)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_I2CDataJNI_cancelInitializedCallback( Java_edu_wpi_first_hal_sim_mockdata_I2CDataJNI_cancelInitializedCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelI2CInitializedCallback); &HALSIM_CancelI2CInitializedCallback);
} }
/* /*
* Class: edu_wpi_first_hal_sim_mockdata_I2CSim * Class: edu_wpi_first_hal_sim_mockdata_I2CDataJNI
* Method: getInitialized * Method: getInitialized
* Signature: (I)Z * Signature: (I)Z
*/ */
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_sim_mockdata_I2CDataJNI_getInitialized(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_I2CDataJNI_getInitialized
jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetI2CInitialized(index); return HALSIM_GetI2CInitialized(index);
} }
/* /*
* Class: edu_wpi_first_hal_sim_mockdata_I2CSim * Class: edu_wpi_first_hal_sim_mockdata_I2CDataJNI
* Method: setInitialized * Method: setInitialized
* Signature: (IZ)V * Signature: (IZ)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_I2CDataJNI_setInitialized(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_I2CDataJNI_setInitialized
jint index, (JNIEnv*, jclass, jint index, jboolean value)
jboolean value) { {
HALSIM_SetI2CInitialized(index, value); HALSIM_SetI2CInitialized(index, value);
} }
/* /*
* Class: edu_wpi_first_hal_sim_mockdata_I2CSim * Class: edu_wpi_first_hal_sim_mockdata_I2CDataJNI
* Method: registerReadCallback * Method: registerReadCallback
* Signature: (ILedu/wpi/first/hal/sim/BufferCallback;)I * Signature: (ILjava/lang/Object;)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_I2CDataJNI_registerReadCallback( Java_edu_wpi_first_hal_sim_mockdata_I2CDataJNI_registerReadCallback
JNIEnv* env, jclass, jint index, jobject callback) { (JNIEnv* env, jclass, jint index, jobject callback)
{
return sim::AllocateBufferCallback(env, index, callback, return sim::AllocateBufferCallback(env, index, callback,
&HALSIM_RegisterI2CReadCallback); &HALSIM_RegisterI2CReadCallback);
} }
/* /*
* Class: edu_wpi_first_hal_sim_mockdata_I2CSim * Class: edu_wpi_first_hal_sim_mockdata_I2CDataJNI
* Method: cancelReadCallback * Method: cancelReadCallback
* Signature: (II)V * Signature: (II)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_I2CDataJNI_cancelReadCallback(JNIEnv* env, Java_edu_wpi_first_hal_sim_mockdata_I2CDataJNI_cancelReadCallback
jclass, (JNIEnv* env, jclass, jint index, jint handle)
jint index, {
jint handle) {
sim::FreeBufferCallback(env, handle, index, &HALSIM_CancelI2CReadCallback); sim::FreeBufferCallback(env, handle, index, &HALSIM_CancelI2CReadCallback);
} }
/* /*
* Class: edu_wpi_first_hal_sim_mockdata_I2CSim * Class: edu_wpi_first_hal_sim_mockdata_I2CDataJNI
* Method: registerWriteCallback * Method: registerWriteCallback
* Signature: (ILedu/wpi/first/hal/sim/ConstBufferCallback;)I * Signature: (ILjava/lang/Object;)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_I2CDataJNI_registerWriteCallback( Java_edu_wpi_first_hal_sim_mockdata_I2CDataJNI_registerWriteCallback
JNIEnv* env, jclass, jint index, jobject callback) { (JNIEnv* env, jclass, jint index, jobject callback)
{
return sim::AllocateConstBufferCallback(env, index, callback, return sim::AllocateConstBufferCallback(env, index, callback,
&HALSIM_RegisterI2CWriteCallback); &HALSIM_RegisterI2CWriteCallback);
} }
/* /*
* Class: edu_wpi_first_hal_sim_mockdata_I2CSim * Class: edu_wpi_first_hal_sim_mockdata_I2CDataJNI
* Method: cancelWriteCallback * Method: cancelWriteCallback
* Signature: (II)V * Signature: (II)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_I2CDataJNI_cancelWriteCallback( Java_edu_wpi_first_hal_sim_mockdata_I2CDataJNI_cancelWriteCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
sim::FreeConstBufferCallback(env, handle, index, sim::FreeConstBufferCallback(env, handle, index,
&HALSIM_CancelI2CWriteCallback); &HALSIM_CancelI2CWriteCallback);
} }
/* /*
* Class: edu_wpi_first_hal_sim_mockdata_I2CSim * Class: edu_wpi_first_hal_sim_mockdata_I2CDataJNI
* Method: resetData * Method: resetData
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_hal_sim_mockdata_I2CDataJNI_resetData( JNIEXPORT void JNICALL
JNIEnv*, jclass, jint index) { Java_edu_wpi_first_hal_sim_mockdata_I2CDataJNI_resetData
(JNIEnv*, jclass, jint index)
{
HALSIM_ResetI2CData(index); HALSIM_ResetI2CData(index);
} }

View File

@@ -13,205 +13,370 @@
extern "C" { extern "C" {
/*
* Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI
* Method: registerSolenoidInitializedCallback
* Signature: (IILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_registerSolenoidInitializedCallback( Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_registerSolenoidInitializedCallback
JNIEnv* env, jclass, jint index, jint channel, jobject callback, (JNIEnv* env, jclass, jint index, jint channel, jobject callback,
jboolean initialNotify) { jboolean initialNotify)
{
return sim::AllocateChannelCallback( return sim::AllocateChannelCallback(
env, index, channel, callback, initialNotify, env, index, channel, callback, initialNotify,
&HALSIM_RegisterPCMSolenoidInitializedCallback); &HALSIM_RegisterPCMSolenoidInitializedCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI
* Method: cancelSolenoidInitializedCallback
* Signature: (III)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_cancelSolenoidInitializedCallback( Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_cancelSolenoidInitializedCallback
JNIEnv* env, jclass, jint index, jint channel, jint handle) { (JNIEnv* env, jclass, jint index, jint channel, jint handle)
{
return sim::FreeChannelCallback(env, handle, index, channel, return sim::FreeChannelCallback(env, handle, index, channel,
&HALSIM_CancelPCMSolenoidInitializedCallback); &HALSIM_CancelPCMSolenoidInitializedCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI
* Method: getSolenoidInitialized
* Signature: (II)Z
*/
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_getSolenoidInitialized( Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_getSolenoidInitialized
JNIEnv*, jclass, jint index, jint channel) { (JNIEnv*, jclass, jint index, jint channel)
{
return HALSIM_GetPCMSolenoidInitialized(index, channel); return HALSIM_GetPCMSolenoidInitialized(index, channel);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI
* Method: setSolenoidInitialized
* Signature: (IIZ)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_setSolenoidInitialized( Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_setSolenoidInitialized
JNIEnv*, jclass, jint index, jint channel, jboolean value) { (JNIEnv*, jclass, jint index, jint channel, jboolean value)
{
HALSIM_SetPCMSolenoidInitialized(index, channel, value); HALSIM_SetPCMSolenoidInitialized(index, channel, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI
* Method: registerSolenoidOutputCallback
* Signature: (IILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_registerSolenoidOutputCallback( Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_registerSolenoidOutputCallback
JNIEnv* env, jclass, jint index, jint channel, jobject callback, (JNIEnv* env, jclass, jint index, jint channel, jobject callback,
jboolean initialNotify) { jboolean initialNotify)
{
return sim::AllocateChannelCallback( return sim::AllocateChannelCallback(
env, index, channel, callback, initialNotify, env, index, channel, callback, initialNotify,
&HALSIM_RegisterPCMSolenoidOutputCallback); &HALSIM_RegisterPCMSolenoidOutputCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI
* Method: cancelSolenoidOutputCallback
* Signature: (III)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_cancelSolenoidOutputCallback( Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_cancelSolenoidOutputCallback
JNIEnv* env, jclass, jint index, jint channel, jint handle) { (JNIEnv* env, jclass, jint index, jint channel, jint handle)
{
return sim::FreeChannelCallback(env, handle, index, channel, return sim::FreeChannelCallback(env, handle, index, channel,
&HALSIM_CancelPCMSolenoidOutputCallback); &HALSIM_CancelPCMSolenoidOutputCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI
* Method: getSolenoidOutput
* Signature: (II)Z
*/
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_getSolenoidOutput(JNIEnv*, Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_getSolenoidOutput
jclass, (JNIEnv*, jclass, jint index, jint channel)
jint index, {
jint channel) {
return HALSIM_GetPCMSolenoidOutput(index, channel); return HALSIM_GetPCMSolenoidOutput(index, channel);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI
* Method: setSolenoidOutput
* Signature: (IIZ)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_setSolenoidOutput( Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_setSolenoidOutput
JNIEnv*, jclass, jint index, jint channel, jboolean value) { (JNIEnv*, jclass, jint index, jint channel, jboolean value)
{
HALSIM_SetPCMSolenoidOutput(index, channel, value); HALSIM_SetPCMSolenoidOutput(index, channel, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI
* Method: registerCompressorInitializedCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_registerCompressorInitializedCallback( Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_registerCompressorInitializedCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback( return sim::AllocateCallback(
env, index, callback, initialNotify, env, index, callback, initialNotify,
&HALSIM_RegisterPCMCompressorInitializedCallback); &HALSIM_RegisterPCMCompressorInitializedCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI
* Method: cancelCompressorInitializedCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_cancelCompressorInitializedCallback( Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_cancelCompressorInitializedCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelPCMCompressorInitializedCallback); &HALSIM_CancelPCMCompressorInitializedCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI
* Method: getCompressorInitialized
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_getCompressorInitialized( Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_getCompressorInitialized
JNIEnv*, jclass, jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetPCMCompressorInitialized(index); return HALSIM_GetPCMCompressorInitialized(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI
* Method: setCompressorInitialized
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_setCompressorInitialized( Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_setCompressorInitialized
JNIEnv*, jclass, jint index, jboolean value) { (JNIEnv*, jclass, jint index, jboolean value)
{
HALSIM_SetPCMCompressorInitialized(index, value); HALSIM_SetPCMCompressorInitialized(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI
* Method: registerCompressorOnCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_registerCompressorOnCallback( Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_registerCompressorOnCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterPCMCompressorOnCallback); &HALSIM_RegisterPCMCompressorOnCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI
* Method: cancelCompressorOnCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_cancelCompressorOnCallback( Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_cancelCompressorOnCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelPCMCompressorOnCallback); &HALSIM_CancelPCMCompressorOnCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI
* Method: getCompressorOn
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_getCompressorOn(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_getCompressorOn
jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetPCMCompressorOn(index); return HALSIM_GetPCMCompressorOn(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI
* Method: setCompressorOn
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_setCompressorOn(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_setCompressorOn
jint index, (JNIEnv*, jclass, jint index, jboolean value)
jboolean value) { {
HALSIM_SetPCMCompressorOn(index, value); HALSIM_SetPCMCompressorOn(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI
* Method: registerClosedLoopEnabledCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_registerClosedLoopEnabledCallback( Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_registerClosedLoopEnabledCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterPCMClosedLoopEnabledCallback); &HALSIM_RegisterPCMClosedLoopEnabledCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI
* Method: cancelClosedLoopEnabledCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_cancelClosedLoopEnabledCallback( Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_cancelClosedLoopEnabledCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelPCMClosedLoopEnabledCallback); &HALSIM_CancelPCMClosedLoopEnabledCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI
* Method: getClosedLoopEnabled
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_getClosedLoopEnabled( Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_getClosedLoopEnabled
JNIEnv*, jclass, jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetPCMClosedLoopEnabled(index); return HALSIM_GetPCMClosedLoopEnabled(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI
* Method: setClosedLoopEnabled
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_setClosedLoopEnabled( Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_setClosedLoopEnabled
JNIEnv*, jclass, jint index, jboolean value) { (JNIEnv*, jclass, jint index, jboolean value)
{
HALSIM_SetPCMClosedLoopEnabled(index, value); HALSIM_SetPCMClosedLoopEnabled(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI
* Method: registerPressureSwitchCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_registerPressureSwitchCallback( Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_registerPressureSwitchCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterPCMPressureSwitchCallback); &HALSIM_RegisterPCMPressureSwitchCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI
* Method: cancelPressureSwitchCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_cancelPressureSwitchCallback( Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_cancelPressureSwitchCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelPCMPressureSwitchCallback); &HALSIM_CancelPCMPressureSwitchCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI
* Method: getPressureSwitch
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_getPressureSwitch(JNIEnv*, Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_getPressureSwitch
jclass, (JNIEnv*, jclass, jint index)
jint index) { {
return HALSIM_GetPCMPressureSwitch(index); return HALSIM_GetPCMPressureSwitch(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI
* Method: setPressureSwitch
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_setPressureSwitch( Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_setPressureSwitch
JNIEnv*, jclass, jint index, jboolean value) { (JNIEnv*, jclass, jint index, jboolean value)
{
HALSIM_SetPCMPressureSwitch(index, value); HALSIM_SetPCMPressureSwitch(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI
* Method: registerCompressorCurrentCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_registerCompressorCurrentCallback( Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_registerCompressorCurrentCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterPCMCompressorCurrentCallback); &HALSIM_RegisterPCMCompressorCurrentCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI
* Method: cancelCompressorCurrentCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_cancelCompressorCurrentCallback( Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_cancelCompressorCurrentCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelPCMCompressorCurrentCallback); &HALSIM_CancelPCMCompressorCurrentCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI
* Method: getCompressorCurrent
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_getCompressorCurrent( Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_getCompressorCurrent
JNIEnv*, jclass, jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetPCMCompressorCurrent(index); return HALSIM_GetPCMCompressorCurrent(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI
* Method: setCompressorCurrent
* Signature: (ID)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_setCompressorCurrent( Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_setCompressorCurrent
JNIEnv*, jclass, jint index, jdouble value) { (JNIEnv*, jclass, jint index, jdouble value)
{
HALSIM_SetPCMCompressorCurrent(index, value); HALSIM_SetPCMCompressorCurrent(index, value);
} }
/* /*
* Class: edu_wpi_first_hal_sim_mockdata_PCMSim * Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI
* Method: registerAllNonSolenoidCallbacks * Method: registerAllNonSolenoidCallbacks
* Signature: (ILedu/wpi/first/hal/sim/NotifyCallback;Z)V * Signature: (ILjava/lang/Object;Z)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_registerAllNonSolenoidCallbacks( Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_registerAllNonSolenoidCallbacks
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
sim::AllocateCallback( sim::AllocateCallback(
env, index, callback, initialNotify, env, index, callback, initialNotify,
[](int32_t index, HAL_NotifyCallback cb, void* param, HAL_Bool in) { [](int32_t index, HAL_NotifyCallback cb, void* param, HAL_Bool in) {
@@ -221,14 +386,15 @@ Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_registerAllNonSolenoidCallbacks(
} }
/* /*
* Class: edu_wpi_first_hal_sim_mockdata_PCMSim * Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI
* Method: registerAllSolenoidCallbacks * Method: registerAllSolenoidCallbacks
* Signature: (IILedu/wpi/first/hal/sim/NotifyCallback;Z)V * Signature: (IILjava/lang/Object;Z)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_registerAllSolenoidCallbacks( Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_registerAllSolenoidCallbacks
JNIEnv* env, jclass, jint index, jint channel, jobject callback, (JNIEnv* env, jclass, jint index, jint channel, jobject callback,
jboolean initialNotify) { jboolean initialNotify)
{
sim::AllocateChannelCallback( sim::AllocateChannelCallback(
env, index, channel, callback, initialNotify, env, index, channel, callback, initialNotify,
[](int32_t index, int32_t channel, HAL_NotifyCallback cb, void* param, [](int32_t index, int32_t channel, HAL_NotifyCallback cb, void* param,
@@ -238,8 +404,15 @@ Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_registerAllSolenoidCallbacks(
}); });
} }
JNIEXPORT void JNICALL Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_resetData( /*
JNIEnv*, jclass, jint index) { * Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI
* Method: resetData
* Signature: (I)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_resetData
(JNIEnv*, jclass, jint index)
{
HALSIM_ResetPCMData(index); HALSIM_ResetPCMData(index);
} }

View File

@@ -13,120 +13,217 @@
extern "C" { extern "C" {
/*
* Class: edu_wpi_first_hal_sim_mockdata_PDPDataJNI
* Method: registerInitializedCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_registerInitializedCallback( Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_registerInitializedCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterPDPInitializedCallback); &HALSIM_RegisterPDPInitializedCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PDPDataJNI
* Method: cancelInitializedCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_cancelInitializedCallback( Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_cancelInitializedCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelPDPInitializedCallback); &HALSIM_CancelPDPInitializedCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PDPDataJNI
* Method: getInitialized
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_getInitialized(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_getInitialized
jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetPDPInitialized(index); return HALSIM_GetPDPInitialized(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PDPDataJNI
* Method: setInitialized
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_setInitialized(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_setInitialized
jint index, (JNIEnv*, jclass, jint index, jboolean value)
jboolean value) { {
HALSIM_SetPDPInitialized(index, value); HALSIM_SetPDPInitialized(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PDPDataJNI
* Method: registerTemperatureCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_registerTemperatureCallback( Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_registerTemperatureCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterPDPTemperatureCallback); &HALSIM_RegisterPDPTemperatureCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PDPDataJNI
* Method: cancelTemperatureCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_cancelTemperatureCallback( Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_cancelTemperatureCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelPDPTemperatureCallback); &HALSIM_CancelPDPTemperatureCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PDPDataJNI
* Method: getTemperature
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_getTemperature(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_getTemperature
jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetPDPTemperature(index); return HALSIM_GetPDPTemperature(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PDPDataJNI
* Method: setTemperature
* Signature: (ID)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_setTemperature(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_setTemperature
jint index, (JNIEnv*, jclass, jint index, jdouble value)
jdouble value) { {
HALSIM_SetPDPTemperature(index, value); HALSIM_SetPDPTemperature(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PDPDataJNI
* Method: registerVoltageCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_registerVoltageCallback( Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_registerVoltageCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterPDPVoltageCallback); &HALSIM_RegisterPDPVoltageCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PDPDataJNI
* Method: cancelVoltageCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_cancelVoltageCallback( Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_cancelVoltageCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelPDPVoltageCallback); &HALSIM_CancelPDPVoltageCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PDPDataJNI
* Method: getVoltage
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_getVoltage(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_getVoltage
jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetPDPVoltage(index); return HALSIM_GetPDPVoltage(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PDPDataJNI
* Method: setVoltage
* Signature: (ID)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_setVoltage(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_setVoltage
jint index, (JNIEnv*, jclass, jint index, jdouble value)
jdouble value) { {
HALSIM_SetPDPVoltage(index, value); HALSIM_SetPDPVoltage(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PDPDataJNI
* Method: registerCurrentCallback
* Signature: (IILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_registerCurrentCallback( Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_registerCurrentCallback
JNIEnv* env, jclass, jint index, jint channel, jobject callback, (JNIEnv* env, jclass, jint index, jint channel, jobject callback,
jboolean initialNotify) { jboolean initialNotify)
{
return sim::AllocateChannelCallback(env, index, channel, callback, return sim::AllocateChannelCallback(env, index, channel, callback,
initialNotify, initialNotify,
&HALSIM_RegisterPDPCurrentCallback); &HALSIM_RegisterPDPCurrentCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PDPDataJNI
* Method: cancelCurrentCallback
* Signature: (III)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_cancelCurrentCallback( Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_cancelCurrentCallback
JNIEnv* env, jclass, jint index, jint channel, jint handle) { (JNIEnv* env, jclass, jint index, jint channel, jint handle)
{
return sim::FreeChannelCallback(env, handle, index, channel, return sim::FreeChannelCallback(env, handle, index, channel,
&HALSIM_CancelPDPCurrentCallback); &HALSIM_CancelPDPCurrentCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PDPDataJNI
* Method: getCurrent
* Signature: (II)D
*/
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_getCurrent(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_getCurrent
jint index, (JNIEnv*, jclass, jint index, jint channel)
jint channel) { {
return HALSIM_GetPDPCurrent(index, channel); return HALSIM_GetPDPCurrent(index, channel);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PDPDataJNI
* Method: setCurrent
* Signature: (IID)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_setCurrent(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_setCurrent
jint index, (JNIEnv*, jclass, jint index, jint channel, jdouble value)
jint channel, {
jdouble value) {
HALSIM_SetPDPCurrent(index, channel, value); HALSIM_SetPDPCurrent(index, channel, value);
} }
JNIEXPORT void JNICALL Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_resetData( /*
JNIEnv*, jclass, jint index) { * Class: edu_wpi_first_hal_sim_mockdata_PDPDataJNI
* Method: resetData
* Signature: (I)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_resetData
(JNIEnv*, jclass, jint index)
{
HALSIM_ResetPDPData(index); HALSIM_ResetPDPData(index);
} }

View File

@@ -13,167 +13,314 @@
extern "C" { extern "C" {
/*
* Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI
* Method: registerInitializedCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_registerInitializedCallback( Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_registerInitializedCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterPWMInitializedCallback); &HALSIM_RegisterPWMInitializedCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI
* Method: cancelInitializedCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_cancelInitializedCallback( Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_cancelInitializedCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelPWMInitializedCallback); &HALSIM_CancelPWMInitializedCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI
* Method: getInitialized
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_getInitialized(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_getInitialized
jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetPWMInitialized(index); return HALSIM_GetPWMInitialized(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI
* Method: setInitialized
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_setInitialized(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_setInitialized
jint index, (JNIEnv*, jclass, jint index, jboolean value)
jboolean value) { {
HALSIM_SetPWMInitialized(index, value); HALSIM_SetPWMInitialized(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI
* Method: registerRawValueCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_registerRawValueCallback( Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_registerRawValueCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterPWMRawValueCallback); &HALSIM_RegisterPWMRawValueCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI
* Method: cancelRawValueCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_cancelRawValueCallback( Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_cancelRawValueCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelPWMRawValueCallback); &HALSIM_CancelPWMRawValueCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI
* Method: getRawValue
* Signature: (I)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_getRawValue(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_getRawValue
jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetPWMRawValue(index); return HALSIM_GetPWMRawValue(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI
* Method: setRawValue
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_setRawValue(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_setRawValue
jint index, (JNIEnv*, jclass, jint index, jint value)
jint value) { {
HALSIM_SetPWMRawValue(index, value); HALSIM_SetPWMRawValue(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI
* Method: registerSpeedCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_registerSpeedCallback( Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_registerSpeedCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterPWMSpeedCallback); &HALSIM_RegisterPWMSpeedCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI
* Method: cancelSpeedCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_cancelSpeedCallback( Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_cancelSpeedCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, &HALSIM_CancelPWMSpeedCallback); return sim::FreeCallback(env, handle, index, &HALSIM_CancelPWMSpeedCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI
* Method: getSpeed
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_getSpeed(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_getSpeed
jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetPWMSpeed(index); return HALSIM_GetPWMSpeed(index);
} }
JNIEXPORT void JNICALL Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_setSpeed( /*
JNIEnv*, jclass, jint index, jdouble value) { * Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI
* Method: setSpeed
* Signature: (ID)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_setSpeed
(JNIEnv*, jclass, jint index, jdouble value)
{
HALSIM_SetPWMSpeed(index, value); HALSIM_SetPWMSpeed(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI
* Method: registerPositionCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_registerPositionCallback( Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_registerPositionCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterPWMPositionCallback); &HALSIM_RegisterPWMPositionCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI
* Method: cancelPositionCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_cancelPositionCallback( Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_cancelPositionCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelPWMPositionCallback); &HALSIM_CancelPWMPositionCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI
* Method: getPosition
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_getPosition(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_getPosition
jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetPWMPosition(index); return HALSIM_GetPWMPosition(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI
* Method: setPosition
* Signature: (ID)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_setPosition(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_setPosition
jint index, (JNIEnv*, jclass, jint index, jdouble value)
jdouble value) { {
HALSIM_SetPWMPosition(index, value); HALSIM_SetPWMPosition(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI
* Method: registerPeriodScaleCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_registerPeriodScaleCallback( Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_registerPeriodScaleCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterPWMPeriodScaleCallback); &HALSIM_RegisterPWMPeriodScaleCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI
* Method: cancelPeriodScaleCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_cancelPeriodScaleCallback( Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_cancelPeriodScaleCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelPWMPeriodScaleCallback); &HALSIM_CancelPWMPeriodScaleCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI
* Method: getPeriodScale
* Signature: (I)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_getPeriodScale(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_getPeriodScale
jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetPWMPeriodScale(index); return HALSIM_GetPWMPeriodScale(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI
* Method: setPeriodScale
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_setPeriodScale(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_setPeriodScale
jint index, (JNIEnv*, jclass, jint index, jint value)
jint value) { {
HALSIM_SetPWMPeriodScale(index, value); HALSIM_SetPWMPeriodScale(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI
* Method: registerZeroLatchCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_registerZeroLatchCallback( Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_registerZeroLatchCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterPWMZeroLatchCallback); &HALSIM_RegisterPWMZeroLatchCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI
* Method: cancelZeroLatchCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_cancelZeroLatchCallback( Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_cancelZeroLatchCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelPWMZeroLatchCallback); &HALSIM_CancelPWMZeroLatchCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI
* Method: getZeroLatch
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_getZeroLatch(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_getZeroLatch
jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetPWMZeroLatch(index); return HALSIM_GetPWMZeroLatch(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI
* Method: setZeroLatch
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_setZeroLatch(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_setZeroLatch
jint index, (JNIEnv*, jclass, jint index, jboolean value)
jboolean value) { {
HALSIM_SetPWMZeroLatch(index, value); HALSIM_SetPWMZeroLatch(index, value);
} }
JNIEXPORT void JNICALL Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_resetData( /*
JNIEnv*, jclass, jint index) { * Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI
* Method: resetData
* Signature: (I)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_resetData
(JNIEnv*, jclass, jint index)
{
HALSIM_ResetPWMData(index); HALSIM_ResetPWMData(index);
} }

View File

@@ -13,115 +13,215 @@
extern "C" { extern "C" {
/*
* Class: edu_wpi_first_hal_sim_mockdata_RelayDataJNI
* Method: registerInitializedForwardCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_registerInitializedForwardCallback( Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_registerInitializedForwardCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterRelayInitializedForwardCallback); &HALSIM_RegisterRelayInitializedForwardCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RelayDataJNI
* Method: cancelInitializedForwardCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_cancelInitializedForwardCallback( Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_cancelInitializedForwardCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelRelayInitializedForwardCallback); &HALSIM_CancelRelayInitializedForwardCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RelayDataJNI
* Method: getInitializedForward
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_getInitializedForward( Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_getInitializedForward
JNIEnv*, jclass, jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetRelayInitializedForward(index); return HALSIM_GetRelayInitializedForward(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RelayDataJNI
* Method: setInitializedForward
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_setInitializedForward( Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_setInitializedForward
JNIEnv*, jclass, jint index, jboolean value) { (JNIEnv*, jclass, jint index, jboolean value)
{
HALSIM_SetRelayInitializedForward(index, value); HALSIM_SetRelayInitializedForward(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RelayDataJNI
* Method: registerInitializedReverseCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_registerInitializedReverseCallback( Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_registerInitializedReverseCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterRelayInitializedReverseCallback); &HALSIM_RegisterRelayInitializedReverseCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RelayDataJNI
* Method: cancelInitializedReverseCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_cancelInitializedReverseCallback( Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_cancelInitializedReverseCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelRelayInitializedReverseCallback); &HALSIM_CancelRelayInitializedReverseCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RelayDataJNI
* Method: getInitializedReverse
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_getInitializedReverse( Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_getInitializedReverse
JNIEnv*, jclass, jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetRelayInitializedReverse(index); return HALSIM_GetRelayInitializedReverse(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RelayDataJNI
* Method: setInitializedReverse
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_setInitializedReverse( Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_setInitializedReverse
JNIEnv*, jclass, jint index, jboolean value) { (JNIEnv*, jclass, jint index, jboolean value)
{
HALSIM_SetRelayInitializedReverse(index, value); HALSIM_SetRelayInitializedReverse(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RelayDataJNI
* Method: registerForwardCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_registerForwardCallback( Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_registerForwardCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterRelayForwardCallback); &HALSIM_RegisterRelayForwardCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RelayDataJNI
* Method: cancelForwardCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_cancelForwardCallback( Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_cancelForwardCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelRelayForwardCallback); &HALSIM_CancelRelayForwardCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RelayDataJNI
* Method: getForward
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_getForward(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_getForward
jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetRelayForward(index); return HALSIM_GetRelayForward(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RelayDataJNI
* Method: setForward
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_setForward(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_setForward
jint index, (JNIEnv*, jclass, jint index, jboolean value)
jboolean value) { {
HALSIM_SetRelayForward(index, value); HALSIM_SetRelayForward(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RelayDataJNI
* Method: registerReverseCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_registerReverseCallback( Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_registerReverseCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterRelayReverseCallback); &HALSIM_RegisterRelayReverseCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RelayDataJNI
* Method: cancelReverseCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_cancelReverseCallback( Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_cancelReverseCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelRelayReverseCallback); &HALSIM_CancelRelayReverseCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RelayDataJNI
* Method: getReverse
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_getReverse(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_getReverse
jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetRelayReverse(index); return HALSIM_GetRelayReverse(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RelayDataJNI
* Method: setReverse
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_setReverse(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_setReverse
jint index, (JNIEnv*, jclass, jint index, jboolean value)
jboolean value) { {
HALSIM_SetRelayReverse(index, value); HALSIM_SetRelayReverse(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RelayDataJNI
* Method: resetData
* Signature: (I)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_resetData(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_resetData
jint index) { (JNIEnv*, jclass, jint index)
{
HALSIM_ResetRelayData(index); HALSIM_ResetRelayData(index);
} }

View File

@@ -13,410 +13,765 @@
extern "C" { extern "C" {
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: registerFPGAButtonCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerFPGAButtonCallback( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerFPGAButtonCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterRoboRioFPGAButtonCallback); &HALSIM_RegisterRoboRioFPGAButtonCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: cancelFPGAButtonCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelFPGAButtonCallback( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelFPGAButtonCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelRoboRioFPGAButtonCallback); &HALSIM_CancelRoboRioFPGAButtonCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: getFPGAButton
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getFPGAButton(JNIEnv*, Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getFPGAButton
jclass, (JNIEnv*, jclass, jint index)
jint index) { {
return HALSIM_GetRoboRioFPGAButton(index); return HALSIM_GetRoboRioFPGAButton(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: setFPGAButton
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setFPGAButton( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setFPGAButton
JNIEnv*, jclass, jint index, jboolean value) { (JNIEnv*, jclass, jint index, jboolean value)
{
HALSIM_SetRoboRioFPGAButton(index, value); HALSIM_SetRoboRioFPGAButton(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: registerVInVoltageCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerVInVoltageCallback( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerVInVoltageCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterRoboRioVInVoltageCallback); &HALSIM_RegisterRoboRioVInVoltageCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: cancelVInVoltageCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelVInVoltageCallback( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelVInVoltageCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelRoboRioVInVoltageCallback); &HALSIM_CancelRoboRioVInVoltageCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: getVInVoltage
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getVInVoltage(JNIEnv*, Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getVInVoltage
jclass, (JNIEnv*, jclass, jint index)
jint index) { {
return HALSIM_GetRoboRioVInVoltage(index); return HALSIM_GetRoboRioVInVoltage(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: setVInVoltage
* Signature: (ID)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setVInVoltage( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setVInVoltage
JNIEnv*, jclass, jint index, jdouble value) { (JNIEnv*, jclass, jint index, jdouble value)
{
HALSIM_SetRoboRioVInVoltage(index, value); HALSIM_SetRoboRioVInVoltage(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: registerVInCurrentCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerVInCurrentCallback( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerVInCurrentCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterRoboRioVInCurrentCallback); &HALSIM_RegisterRoboRioVInCurrentCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: cancelVInCurrentCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelVInCurrentCallback( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelVInCurrentCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelRoboRioVInCurrentCallback); &HALSIM_CancelRoboRioVInCurrentCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: getVInCurrent
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getVInCurrent(JNIEnv*, Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getVInCurrent
jclass, (JNIEnv*, jclass, jint index)
jint index) { {
return HALSIM_GetRoboRioVInCurrent(index); return HALSIM_GetRoboRioVInCurrent(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: setVInCurrent
* Signature: (ID)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setVInCurrent( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setVInCurrent
JNIEnv*, jclass, jint index, jdouble value) { (JNIEnv*, jclass, jint index, jdouble value)
{
HALSIM_SetRoboRioVInCurrent(index, value); HALSIM_SetRoboRioVInCurrent(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: registerUserVoltage6VCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserVoltage6VCallback( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserVoltage6VCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterRoboRioUserVoltage6VCallback); &HALSIM_RegisterRoboRioUserVoltage6VCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: cancelUserVoltage6VCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserVoltage6VCallback( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserVoltage6VCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelRoboRioUserVoltage6VCallback); &HALSIM_CancelRoboRioUserVoltage6VCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: getUserVoltage6V
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserVoltage6V( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserVoltage6V
JNIEnv*, jclass, jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetRoboRioUserVoltage6V(index); return HALSIM_GetRoboRioUserVoltage6V(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: setUserVoltage6V
* Signature: (ID)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserVoltage6V( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserVoltage6V
JNIEnv*, jclass, jint index, jdouble value) { (JNIEnv*, jclass, jint index, jdouble value)
{
HALSIM_SetRoboRioUserVoltage6V(index, value); HALSIM_SetRoboRioUserVoltage6V(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: registerUserCurrent6VCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserCurrent6VCallback( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserCurrent6VCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterRoboRioUserCurrent6VCallback); &HALSIM_RegisterRoboRioUserCurrent6VCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: cancelUserCurrent6VCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserCurrent6VCallback( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserCurrent6VCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelRoboRioUserCurrent6VCallback); &HALSIM_CancelRoboRioUserCurrent6VCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: getUserCurrent6V
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserCurrent6V( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserCurrent6V
JNIEnv*, jclass, jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetRoboRioUserCurrent6V(index); return HALSIM_GetRoboRioUserCurrent6V(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: setUserCurrent6V
* Signature: (ID)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserCurrent6V( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserCurrent6V
JNIEnv*, jclass, jint index, jdouble value) { (JNIEnv*, jclass, jint index, jdouble value)
{
HALSIM_SetRoboRioUserCurrent6V(index, value); HALSIM_SetRoboRioUserCurrent6V(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: registerUserActive6VCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserActive6VCallback( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserActive6VCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterRoboRioUserActive6VCallback); &HALSIM_RegisterRoboRioUserActive6VCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: cancelUserActive6VCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserActive6VCallback( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserActive6VCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelRoboRioUserActive6VCallback); &HALSIM_CancelRoboRioUserActive6VCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: getUserActive6V
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserActive6V(JNIEnv*, Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserActive6V
jclass, (JNIEnv*, jclass, jint index)
jint index) { {
return HALSIM_GetRoboRioUserActive6V(index); return HALSIM_GetRoboRioUserActive6V(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: setUserActive6V
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserActive6V( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserActive6V
JNIEnv*, jclass, jint index, jboolean value) { (JNIEnv*, jclass, jint index, jboolean value)
{
HALSIM_SetRoboRioUserActive6V(index, value); HALSIM_SetRoboRioUserActive6V(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: registerUserVoltage5VCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserVoltage5VCallback( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserVoltage5VCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterRoboRioUserVoltage5VCallback); &HALSIM_RegisterRoboRioUserVoltage5VCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: cancelUserVoltage5VCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserVoltage5VCallback( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserVoltage5VCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelRoboRioUserVoltage5VCallback); &HALSIM_CancelRoboRioUserVoltage5VCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: getUserVoltage5V
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserVoltage5V( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserVoltage5V
JNIEnv*, jclass, jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetRoboRioUserVoltage5V(index); return HALSIM_GetRoboRioUserVoltage5V(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: setUserVoltage5V
* Signature: (ID)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserVoltage5V( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserVoltage5V
JNIEnv*, jclass, jint index, jdouble value) { (JNIEnv*, jclass, jint index, jdouble value)
{
HALSIM_SetRoboRioUserVoltage5V(index, value); HALSIM_SetRoboRioUserVoltage5V(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: registerUserCurrent5VCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserCurrent5VCallback( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserCurrent5VCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterRoboRioUserCurrent5VCallback); &HALSIM_RegisterRoboRioUserCurrent5VCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: cancelUserCurrent5VCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserCurrent5VCallback( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserCurrent5VCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelRoboRioUserCurrent5VCallback); &HALSIM_CancelRoboRioUserCurrent5VCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: getUserCurrent5V
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserCurrent5V( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserCurrent5V
JNIEnv*, jclass, jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetRoboRioUserCurrent5V(index); return HALSIM_GetRoboRioUserCurrent5V(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: setUserCurrent5V
* Signature: (ID)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserCurrent5V( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserCurrent5V
JNIEnv*, jclass, jint index, jdouble value) { (JNIEnv*, jclass, jint index, jdouble value)
{
HALSIM_SetRoboRioUserCurrent5V(index, value); HALSIM_SetRoboRioUserCurrent5V(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: registerUserActive5VCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserActive5VCallback( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserActive5VCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterRoboRioUserActive5VCallback); &HALSIM_RegisterRoboRioUserActive5VCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: cancelUserActive5VCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserActive5VCallback( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserActive5VCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelRoboRioUserActive5VCallback); &HALSIM_CancelRoboRioUserActive5VCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: getUserActive5V
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserActive5V(JNIEnv*, Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserActive5V
jclass, (JNIEnv*, jclass, jint index)
jint index) { {
return HALSIM_GetRoboRioUserActive5V(index); return HALSIM_GetRoboRioUserActive5V(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: setUserActive5V
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserActive5V( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserActive5V
JNIEnv*, jclass, jint index, jboolean value) { (JNIEnv*, jclass, jint index, jboolean value)
{
HALSIM_SetRoboRioUserActive5V(index, value); HALSIM_SetRoboRioUserActive5V(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: registerUserVoltage3V3Callback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserVoltage3V3Callback( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserVoltage3V3Callback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterRoboRioUserVoltage3V3Callback); &HALSIM_RegisterRoboRioUserVoltage3V3Callback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: cancelUserVoltage3V3Callback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserVoltage3V3Callback( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserVoltage3V3Callback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelRoboRioUserVoltage3V3Callback); &HALSIM_CancelRoboRioUserVoltage3V3Callback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: getUserVoltage3V3
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserVoltage3V3( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserVoltage3V3
JNIEnv*, jclass, jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetRoboRioUserVoltage3V3(index); return HALSIM_GetRoboRioUserVoltage3V3(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: setUserVoltage3V3
* Signature: (ID)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserVoltage3V3( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserVoltage3V3
JNIEnv*, jclass, jint index, jdouble value) { (JNIEnv*, jclass, jint index, jdouble value)
{
HALSIM_SetRoboRioUserVoltage3V3(index, value); HALSIM_SetRoboRioUserVoltage3V3(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: registerUserCurrent3V3Callback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserCurrent3V3Callback( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserCurrent3V3Callback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterRoboRioUserCurrent3V3Callback); &HALSIM_RegisterRoboRioUserCurrent3V3Callback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: cancelUserCurrent3V3Callback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserCurrent3V3Callback( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserCurrent3V3Callback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelRoboRioUserCurrent3V3Callback); &HALSIM_CancelRoboRioUserCurrent3V3Callback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: getUserCurrent3V3
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserCurrent3V3( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserCurrent3V3
JNIEnv*, jclass, jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetRoboRioUserCurrent3V3(index); return HALSIM_GetRoboRioUserCurrent3V3(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: setUserCurrent3V3
* Signature: (ID)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserCurrent3V3( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserCurrent3V3
JNIEnv*, jclass, jint index, jdouble value) { (JNIEnv*, jclass, jint index, jdouble value)
{
HALSIM_SetRoboRioUserCurrent3V3(index, value); HALSIM_SetRoboRioUserCurrent3V3(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: registerUserActive3V3Callback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserActive3V3Callback( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserActive3V3Callback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterRoboRioUserActive3V3Callback); &HALSIM_RegisterRoboRioUserActive3V3Callback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: cancelUserActive3V3Callback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserActive3V3Callback( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserActive3V3Callback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelRoboRioUserActive3V3Callback); &HALSIM_CancelRoboRioUserActive3V3Callback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: getUserActive3V3
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserActive3V3( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserActive3V3
JNIEnv*, jclass, jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetRoboRioUserActive3V3(index); return HALSIM_GetRoboRioUserActive3V3(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: setUserActive3V3
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserActive3V3( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserActive3V3
JNIEnv*, jclass, jint index, jboolean value) { (JNIEnv*, jclass, jint index, jboolean value)
{
HALSIM_SetRoboRioUserActive3V3(index, value); HALSIM_SetRoboRioUserActive3V3(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: registerUserFaults6VCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserFaults6VCallback( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserFaults6VCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterRoboRioUserFaults6VCallback); &HALSIM_RegisterRoboRioUserFaults6VCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: cancelUserFaults6VCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserFaults6VCallback( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserFaults6VCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelRoboRioUserFaults6VCallback); &HALSIM_CancelRoboRioUserFaults6VCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: getUserFaults6V
* Signature: (I)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserFaults6V(JNIEnv*, Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserFaults6V
jclass, (JNIEnv*, jclass, jint index)
jint index) { {
return HALSIM_GetRoboRioUserFaults6V(index); return HALSIM_GetRoboRioUserFaults6V(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: setUserFaults6V
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserFaults6V(JNIEnv*, Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserFaults6V
jclass, (JNIEnv*, jclass, jint index, jint value)
jint index, {
jint value) {
HALSIM_SetRoboRioUserFaults6V(index, value); HALSIM_SetRoboRioUserFaults6V(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: registerUserFaults5VCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserFaults5VCallback( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserFaults5VCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterRoboRioUserFaults5VCallback); &HALSIM_RegisterRoboRioUserFaults5VCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: cancelUserFaults5VCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserFaults5VCallback( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserFaults5VCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelRoboRioUserFaults5VCallback); &HALSIM_CancelRoboRioUserFaults5VCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: getUserFaults5V
* Signature: (I)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserFaults5V(JNIEnv*, Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserFaults5V
jclass, (JNIEnv*, jclass, jint index)
jint index) { {
return HALSIM_GetRoboRioUserFaults5V(index); return HALSIM_GetRoboRioUserFaults5V(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: setUserFaults5V
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserFaults5V(JNIEnv*, Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserFaults5V
jclass, (JNIEnv*, jclass, jint index, jint value)
jint index, {
jint value) {
HALSIM_SetRoboRioUserFaults5V(index, value); HALSIM_SetRoboRioUserFaults5V(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: registerUserFaults3V3Callback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserFaults3V3Callback( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserFaults3V3Callback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterRoboRioUserFaults3V3Callback); &HALSIM_RegisterRoboRioUserFaults3V3Callback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: cancelUserFaults3V3Callback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserFaults3V3Callback( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserFaults3V3Callback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelRoboRioUserFaults3V3Callback); &HALSIM_CancelRoboRioUserFaults3V3Callback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: getUserFaults3V3
* Signature: (I)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserFaults3V3( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserFaults3V3
JNIEnv*, jclass, jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetRoboRioUserFaults3V3(index); return HALSIM_GetRoboRioUserFaults3V3(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: setUserFaults3V3
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserFaults3V3( Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserFaults3V3
JNIEnv*, jclass, jint index, jint value) { (JNIEnv*, jclass, jint index, jint value)
{
HALSIM_SetRoboRioUserFaults3V3(index, value); HALSIM_SetRoboRioUserFaults3V3(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI
* Method: resetData
* Signature: (I)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_resetData(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_resetData
jint index) { (JNIEnv*, jclass, jint index)
{
HALSIM_ResetRoboRioData(index); HALSIM_ResetRoboRioData(index);
} }

View File

@@ -13,142 +13,265 @@
extern "C" { extern "C" {
/*
* Class: edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI
* Method: registerActiveCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_registerActiveCallback( Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_registerActiveCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterSPIAccelerometerActiveCallback); &HALSIM_RegisterSPIAccelerometerActiveCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI
* Method: cancelActiveCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_cancelActiveCallback( Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_cancelActiveCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelSPIAccelerometerActiveCallback); &HALSIM_CancelSPIAccelerometerActiveCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI
* Method: getActive
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_getActive( Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_getActive
JNIEnv*, jclass, jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetSPIAccelerometerActive(index); return HALSIM_GetSPIAccelerometerActive(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI
* Method: setActive
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_setActive( Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_setActive
JNIEnv*, jclass, jint index, jboolean value) { (JNIEnv*, jclass, jint index, jboolean value)
{
HALSIM_SetSPIAccelerometerActive(index, value); HALSIM_SetSPIAccelerometerActive(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI
* Method: registerRangeCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_registerRangeCallback( Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_registerRangeCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterSPIAccelerometerRangeCallback); &HALSIM_RegisterSPIAccelerometerRangeCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI
* Method: cancelRangeCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_cancelRangeCallback( Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_cancelRangeCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelSPIAccelerometerRangeCallback); &HALSIM_CancelSPIAccelerometerRangeCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI
* Method: getRange
* Signature: (I)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_getRange( Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_getRange
JNIEnv*, jclass, jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetSPIAccelerometerRange(index); return HALSIM_GetSPIAccelerometerRange(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI
* Method: setRange
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_setRange( Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_setRange
JNIEnv*, jclass, jint index, jint value) { (JNIEnv*, jclass, jint index, jint value)
{
HALSIM_SetSPIAccelerometerRange(index, value); HALSIM_SetSPIAccelerometerRange(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI
* Method: registerXCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_registerXCallback( Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_registerXCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterSPIAccelerometerXCallback); &HALSIM_RegisterSPIAccelerometerXCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI
* Method: cancelXCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_cancelXCallback( Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_cancelXCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelSPIAccelerometerXCallback); &HALSIM_CancelSPIAccelerometerXCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI
* Method: getX
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_getX(JNIEnv*, Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_getX
jclass, (JNIEnv*, jclass, jint index)
jint index) { {
return HALSIM_GetSPIAccelerometerX(index); return HALSIM_GetSPIAccelerometerX(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI
* Method: setX
* Signature: (ID)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_setX( Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_setX
JNIEnv*, jclass, jint index, jdouble value) { (JNIEnv*, jclass, jint index, jdouble value)
{
HALSIM_SetSPIAccelerometerX(index, value); HALSIM_SetSPIAccelerometerX(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI
* Method: registerYCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_registerYCallback( Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_registerYCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterSPIAccelerometerYCallback); &HALSIM_RegisterSPIAccelerometerYCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI
* Method: cancelYCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_cancelYCallback( Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_cancelYCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelSPIAccelerometerYCallback); &HALSIM_CancelSPIAccelerometerYCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI
* Method: getY
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_getY(JNIEnv*, Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_getY
jclass, (JNIEnv*, jclass, jint index)
jint index) { {
return HALSIM_GetSPIAccelerometerY(index); return HALSIM_GetSPIAccelerometerY(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI
* Method: setY
* Signature: (ID)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_setY( Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_setY
JNIEnv*, jclass, jint index, jdouble value) { (JNIEnv*, jclass, jint index, jdouble value)
{
HALSIM_SetSPIAccelerometerY(index, value); HALSIM_SetSPIAccelerometerY(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI
* Method: registerZCallback
* Signature: (ILjava/lang/Object;Z)I
*/
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_registerZCallback( Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_registerZCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterSPIAccelerometerZCallback); &HALSIM_RegisterSPIAccelerometerZCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI
* Method: cancelZCallback
* Signature: (II)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_cancelZCallback( Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_cancelZCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelSPIAccelerometerZCallback); &HALSIM_CancelSPIAccelerometerZCallback);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI
* Method: getZ
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_getZ(JNIEnv*, Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_getZ
jclass, (JNIEnv*, jclass, jint index)
jint index) { {
return HALSIM_GetSPIAccelerometerZ(index); return HALSIM_GetSPIAccelerometerZ(index);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI
* Method: setZ
* Signature: (ID)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_setZ( Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_setZ
JNIEnv*, jclass, jint index, jdouble value) { (JNIEnv*, jclass, jint index, jdouble value)
{
HALSIM_SetSPIAccelerometerZ(index, value); HALSIM_SetSPIAccelerometerZ(index, value);
} }
/*
* Class: edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI
* Method: resetData
* Signature: (I)V
*/
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_resetData( Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_resetData
JNIEnv*, jclass, jint index) { (JNIEnv*, jclass, jint index)
{
HALSIM_ResetSPIAccelerometerData(index); HALSIM_ResetSPIAccelerometerData(index);
} }

View File

@@ -17,132 +17,141 @@
extern "C" { extern "C" {
/* /*
* Class: edu_wpi_first_hal_sim_mockdata_SPISim * Class: edu_wpi_first_hal_sim_mockdata_SPIDataJNI
* Method: registerInitializedCallback * Method: registerInitializedCallback
* Signature: (ILedu/wpi/first/hal/sim/NotifyCallback;Z)I * Signature: (ILjava/lang/Object;Z)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_SPIDataJNI_registerInitializedCallback( Java_edu_wpi_first_hal_sim_mockdata_SPIDataJNI_registerInitializedCallback
JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify)
{
return sim::AllocateCallback(env, index, callback, initialNotify, return sim::AllocateCallback(env, index, callback, initialNotify,
&HALSIM_RegisterSPIInitializedCallback); &HALSIM_RegisterSPIInitializedCallback);
} }
/* /*
* Class: edu_wpi_first_hal_sim_mockdata_SPISim * Class: edu_wpi_first_hal_sim_mockdata_SPIDataJNI
* Method: cancelInitializedCallback * Method: cancelInitializedCallback
* Signature: (II)V * Signature: (II)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_SPIDataJNI_cancelInitializedCallback( Java_edu_wpi_first_hal_sim_mockdata_SPIDataJNI_cancelInitializedCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
return sim::FreeCallback(env, handle, index, return sim::FreeCallback(env, handle, index,
&HALSIM_CancelSPIInitializedCallback); &HALSIM_CancelSPIInitializedCallback);
} }
/* /*
* Class: edu_wpi_first_hal_sim_mockdata_SPISim * Class: edu_wpi_first_hal_sim_mockdata_SPIDataJNI
* Method: getInitialized * Method: getInitialized
* Signature: (I)Z * Signature: (I)Z
*/ */
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_sim_mockdata_SPIDataJNI_getInitialized(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_SPIDataJNI_getInitialized
jint index) { (JNIEnv*, jclass, jint index)
{
return HALSIM_GetSPIInitialized(index); return HALSIM_GetSPIInitialized(index);
} }
/* /*
* Class: edu_wpi_first_hal_sim_mockdata_SPISim * Class: edu_wpi_first_hal_sim_mockdata_SPIDataJNI
* Method: setInitialized * Method: setInitialized
* Signature: (IZ)V * Signature: (IZ)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_SPIDataJNI_setInitialized(JNIEnv*, jclass, Java_edu_wpi_first_hal_sim_mockdata_SPIDataJNI_setInitialized
jint index, (JNIEnv*, jclass, jint index, jboolean value)
jboolean value) { {
HALSIM_SetSPIInitialized(index, value); HALSIM_SetSPIInitialized(index, value);
} }
/* /*
* Class: edu_wpi_first_hal_sim_mockdata_SPISim * Class: edu_wpi_first_hal_sim_mockdata_SPIDataJNI
* Method: registerReadCallback * Method: registerReadCallback
* Signature: (ILedu/wpi/first/hal/sim/BufferCallback;)I * Signature: (ILjava/lang/Object;)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_SPIDataJNI_registerReadCallback( Java_edu_wpi_first_hal_sim_mockdata_SPIDataJNI_registerReadCallback
JNIEnv* env, jclass, jint index, jobject callback) { (JNIEnv* env, jclass, jint index, jobject callback)
{
return sim::AllocateBufferCallback(env, index, callback, return sim::AllocateBufferCallback(env, index, callback,
&HALSIM_RegisterSPIReadCallback); &HALSIM_RegisterSPIReadCallback);
} }
/* /*
* Class: edu_wpi_first_hal_sim_mockdata_SPISim * Class: edu_wpi_first_hal_sim_mockdata_SPIDataJNI
* Method: cancelReadCallback * Method: cancelReadCallback
* Signature: (II)V * Signature: (II)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_SPIDataJNI_cancelReadCallback(JNIEnv* env, Java_edu_wpi_first_hal_sim_mockdata_SPIDataJNI_cancelReadCallback
jclass, (JNIEnv* env, jclass, jint index, jint handle)
jint index, {
jint handle) {
sim::FreeBufferCallback(env, handle, index, &HALSIM_CancelSPIReadCallback); sim::FreeBufferCallback(env, handle, index, &HALSIM_CancelSPIReadCallback);
} }
/* /*
* Class: edu_wpi_first_hal_sim_mockdata_SPISim * Class: edu_wpi_first_hal_sim_mockdata_SPIDataJNI
* Method: registerWriteCallback * Method: registerWriteCallback
* Signature: (ILedu/wpi/first/hal/sim/ConstBufferCallback;)I * Signature: (ILjava/lang/Object;)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_SPIDataJNI_registerWriteCallback( Java_edu_wpi_first_hal_sim_mockdata_SPIDataJNI_registerWriteCallback
JNIEnv* env, jclass, jint index, jobject callback) { (JNIEnv* env, jclass, jint index, jobject callback)
{
return sim::AllocateConstBufferCallback(env, index, callback, return sim::AllocateConstBufferCallback(env, index, callback,
&HALSIM_RegisterSPIWriteCallback); &HALSIM_RegisterSPIWriteCallback);
} }
/* /*
* Class: edu_wpi_first_hal_sim_mockdata_SPISim * Class: edu_wpi_first_hal_sim_mockdata_SPIDataJNI
* Method: cancelWriteCallback * Method: cancelWriteCallback
* Signature: (II)V * Signature: (II)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_SPIDataJNI_cancelWriteCallback( Java_edu_wpi_first_hal_sim_mockdata_SPIDataJNI_cancelWriteCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
sim::FreeConstBufferCallback(env, handle, index, sim::FreeConstBufferCallback(env, handle, index,
&HALSIM_CancelSPIWriteCallback); &HALSIM_CancelSPIWriteCallback);
} }
/* /*
* Class: edu_wpi_first_hal_sim_mockdata_SPISim * Class: edu_wpi_first_hal_sim_mockdata_SPIDataJNI
* Method: registerReadAutoReceiveBufferCallback * Method: registerReadAutoReceiveBufferCallback
* Signature: (ILedu/wpi/first/hal/sim/SpiReadAutoReceiveBufferCallback;)I * Signature: (ILjava/lang/Object;)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_sim_mockdata_SPIDataJNI_registerReadAutoReceiveBufferCallback( Java_edu_wpi_first_hal_sim_mockdata_SPIDataJNI_registerReadAutoReceiveBufferCallback
JNIEnv* env, jclass, jint index, jobject callback) { (JNIEnv* env, jclass, jint index, jobject callback)
{
return sim::AllocateSpiBufferCallback( return sim::AllocateSpiBufferCallback(
env, index, callback, &HALSIM_RegisterSPIReadAutoReceivedDataCallback); env, index, callback, &HALSIM_RegisterSPIReadAutoReceivedDataCallback);
} }
/* /*
* Class: edu_wpi_first_hal_sim_mockdata_SPISim * Class: edu_wpi_first_hal_sim_mockdata_SPIDataJNI
* Method: cancelReadAutoReceiveBufferCallback * Method: cancelReadAutoReceiveBufferCallback
* Signature: (II)V * Signature: (II)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_SPIDataJNI_cancelReadAutoReceiveBufferCallback( Java_edu_wpi_first_hal_sim_mockdata_SPIDataJNI_cancelReadAutoReceiveBufferCallback
JNIEnv* env, jclass, jint index, jint handle) { (JNIEnv* env, jclass, jint index, jint handle)
{
sim::FreeSpiBufferCallback(env, handle, index, sim::FreeSpiBufferCallback(env, handle, index,
&HALSIM_CancelSPIReadAutoReceivedDataCallback); &HALSIM_CancelSPIReadAutoReceivedDataCallback);
} }
/* /*
* Class: edu_wpi_first_hal_sim_mockdata_SPISim * Class: edu_wpi_first_hal_sim_mockdata_SPIDataJNI
* Method: resetData * Method: resetData
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL Java_edu_wpi_first_hal_sim_mockdata_SPIDataJNI_resetData( JNIEXPORT void JNICALL
JNIEnv*, jclass, jint index) { Java_edu_wpi_first_hal_sim_mockdata_SPIDataJNI_resetData
(JNIEnv*, jclass, jint index)
{
HALSIM_ResetSPIData(index); HALSIM_ResetSPIData(index);
} }

View File

@@ -5,6 +5,8 @@
/* the project. */ /* the project. */
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
#include "SimulatorJNI.h"
#include "BufferCallbackStore.h" #include "BufferCallbackStore.h"
#include "CallbackStore.h" #include "CallbackStore.h"
#include "ConstBufferCallbackStore.h" #include "ConstBufferCallbackStore.h"
@@ -12,7 +14,6 @@
#include "HAL/cpp/Log.h" #include "HAL/cpp/Log.h"
#include "HAL/handles/HandlesInternal.h" #include "HAL/handles/HandlesInternal.h"
#include "MockData/MockHooks.h" #include "MockData/MockHooks.h"
#include "SimulatorJNI.h"
#include "SpiReadAutoReceiveBufferCallbackStore.h" #include "SpiReadAutoReceiveBufferCallbackStore.h"
#include "edu_wpi_first_hal_sim_mockdata_SimulatorJNI.h" #include "edu_wpi_first_hal_sim_mockdata_SimulatorJNI.h"
@@ -112,8 +113,9 @@ extern "C" {
* Signature: ()V * Signature: ()V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_SimulatorJNI_waitForProgramStart(JNIEnv*, Java_edu_wpi_first_hal_sim_mockdata_SimulatorJNI_waitForProgramStart
jclass) { (JNIEnv*, jclass)
{
HALSIM_WaitForProgramStart(); HALSIM_WaitForProgramStart();
} }
@@ -123,8 +125,9 @@ Java_edu_wpi_first_hal_sim_mockdata_SimulatorJNI_waitForProgramStart(JNIEnv*,
* Signature: ()V * Signature: ()V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_SimulatorJNI_setProgramStarted(JNIEnv*, Java_edu_wpi_first_hal_sim_mockdata_SimulatorJNI_setProgramStarted
jclass) { (JNIEnv*, jclass)
{
HALSIM_SetProgramStarted(); HALSIM_SetProgramStarted();
} }
@@ -134,8 +137,9 @@ Java_edu_wpi_first_hal_sim_mockdata_SimulatorJNI_setProgramStarted(JNIEnv*,
* Signature: ()V * Signature: ()V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_SimulatorJNI_restartTiming(JNIEnv*, Java_edu_wpi_first_hal_sim_mockdata_SimulatorJNI_restartTiming
jclass) { (JNIEnv*, jclass)
{
HALSIM_RestartTiming(); HALSIM_RestartTiming();
} }
@@ -145,7 +149,9 @@ Java_edu_wpi_first_hal_sim_mockdata_SimulatorJNI_restartTiming(JNIEnv*,
* Signature: ()V * Signature: ()V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_sim_mockdata_SimulatorJNI_resetHandles(JNIEnv*, jclass) { Java_edu_wpi_first_hal_sim_mockdata_SimulatorJNI_resetHandles
(JNIEnv*, jclass)
{
hal::HandleBase::ResetGlobalHandles(); hal::HandleBase::ResetGlobalHandles();
} }
} // extern "C" } // extern "C"

View File

@@ -8,6 +8,7 @@
#include "SpiReadAutoReceiveBufferCallbackStore.h" #include "SpiReadAutoReceiveBufferCallbackStore.h"
#include <jni.h> #include <jni.h>
#include <wpi/jni_util.h> #include <wpi/jni_util.h>
#include "HAL/Types.h" #include "HAL/Types.h"

View File

@@ -8,6 +8,7 @@
#pragma once #pragma once
#include <jni.h> #include <jni.h>
#include <wpi/jni_util.h> #include <wpi/jni_util.h>
#include "HAL/Types.h" #include "HAL/Types.h"

31
ntcore/.styleguide Normal file
View File

@@ -0,0 +1,31 @@
cHeaderFileInclude {
_c\.h$
}
cppHeaderFileInclude {
(?<!_c)\.h$
\.inc$
}
cppSrcFileInclude {
\.cpp$
}
generatedFileExclude {
ntcore/doc/
}
repoRootNameOverride {
ntcore
}
includeGuardRoots {
ntcore/src/main/native/cpp/
ntcore/src/main/native/include/
ntcore/src/test/native/cpp/
}
includeOtherLibs {
^support/
^wpi/
}

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ /* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ /* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ /* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ /* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ /* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ /* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ /* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ /* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ /* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ /* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ /* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ /* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ /* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ /* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ /* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ /* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ /* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ /* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ /* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ /* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */ /* 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 */ /* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */ /* the project. */

Some files were not shown because too many files have changed in this diff Show More