mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Replace FRC_NetworkCommunication CAN in wpilibj with HAL CAN (#650)
This commit is contained in:
committed by
Peter Johnson
parent
db4981f166
commit
abb66d3e4b
@@ -15,9 +15,7 @@
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
|
||||
#ifdef CONFIG_ATHENA
|
||||
#include "FRC_NetworkCommunication/CANSessionMux.h"
|
||||
#endif
|
||||
#include "HAL/CAN.h"
|
||||
#include "HAL/HAL.h"
|
||||
#include "HAL/DriverStation.h"
|
||||
#include "HAL/Errors.h"
|
||||
@@ -122,9 +120,7 @@ void ReportCANError(JNIEnv *env, int32_t status, int message_id) {
|
||||
case kRioStatusSuccess:
|
||||
// Everything is ok... don't throw.
|
||||
break;
|
||||
#ifdef CONFIG_ATHENA
|
||||
case ERR_CANSessionMux_InvalidBuffer:
|
||||
#endif
|
||||
case HAL_ERR_CANSessionMux_InvalidBuffer:
|
||||
case kRIOStatusBufferInvalidSize: {
|
||||
static jmethodID invalidBufConstruct = nullptr;
|
||||
if (!invalidBufConstruct)
|
||||
@@ -135,9 +131,7 @@ void ReportCANError(JNIEnv *env, int32_t status, int message_id) {
|
||||
env->Throw(static_cast<jthrowable>(exception));
|
||||
break;
|
||||
}
|
||||
#ifdef CONFIG_ATHENA
|
||||
case ERR_CANSessionMux_MessageNotFound:
|
||||
#endif
|
||||
case HAL_ERR_CANSessionMux_MessageNotFound:
|
||||
case kRIOStatusOperationTimedOut: {
|
||||
static jmethodID messageNotFoundConstruct = nullptr;
|
||||
if (!messageNotFoundConstruct)
|
||||
@@ -148,9 +142,7 @@ void ReportCANError(JNIEnv *env, int32_t status, int message_id) {
|
||||
env->Throw(static_cast<jthrowable>(exception));
|
||||
break;
|
||||
}
|
||||
#ifdef CONFIG_ATHENA
|
||||
case ERR_CANSessionMux_NotAllowed:
|
||||
#endif
|
||||
case HAL_ERR_CANSessionMux_NotAllowed:
|
||||
case kRIOStatusFeatureNotSupported: {
|
||||
llvm::SmallString<100> buf;
|
||||
llvm::raw_svector_ostream oss(buf);
|
||||
@@ -158,9 +150,7 @@ void ReportCANError(JNIEnv *env, int32_t status, int message_id) {
|
||||
canMessageNotAllowedExCls.Throw(env, buf.c_str());
|
||||
break;
|
||||
}
|
||||
#ifdef CONFIG_ATHENA
|
||||
case ERR_CANSessionMux_NotInitialized:
|
||||
#endif
|
||||
case HAL_ERR_CANSessionMux_NotInitialized:
|
||||
case kRIOStatusResourceNotInitialized: {
|
||||
static jmethodID notInitConstruct = nullptr;
|
||||
if (!notInitConstruct)
|
||||
|
||||
Reference in New Issue
Block a user