Adds JNI call to get CANStatus (#677)

Call already existed in the HAL.
This commit is contained in:
Thad House
2017-10-21 15:32:05 -07:00
committed by Peter Johnson
parent 9dc1de1d09
commit a1ea448406
7 changed files with 144 additions and 0 deletions

View File

@@ -29,4 +29,8 @@ public class CANJNI extends JNIWrapper {
@SuppressWarnings("MethodName")
public static native byte[] FRCNetCommCANSessionMuxReceiveMessage(
IntBuffer messageID, int messageIDMask, ByteBuffer timeStamp);
@SuppressWarnings("MethodName")
public static native void GetCANStatus(CANStatus status);
}

View File

@@ -0,0 +1,54 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2017 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpilibj.can;
/**
* Structure for holding the result of a CAN Status request.
*/
public class CANStatus {
/**
* The utilization of the CAN Bus.
*/
@SuppressWarnings("MemberName")
public double percentBusUtilization;
/**
* The CAN Bus off count.
*/
@SuppressWarnings("MemberName")
public int busOffCount;
/**
* The CAN Bus TX full count.
*/
@SuppressWarnings("MemberName")
public int txFullCount;
/**
* The CAN Bus receive error count.
*/
@SuppressWarnings("MemberName")
public int receiveErrorCount;
/**
* The CAN Bus transmit error count.
*/
@SuppressWarnings("MemberName")
public int transmitErrorCount;
@SuppressWarnings("JavadocMethod")
public void setStatus(double percentBusUtilization, int busOffCount, int txFullCount,
int receiveErrorCount, int transmitErrorCount) {
this.percentBusUtilization = percentBusUtilization;
this.busOffCount = busOffCount;
this.txFullCount = txFullCount;
this.receiveErrorCount = receiveErrorCount;
this.transmitErrorCount = transmitErrorCount;
}
}