[hal] Add missing HAL CAN javadocs (NFC) (#6882)

This commit is contained in:
Ryan Blue
2024-07-28 17:27:55 -04:00
committed by GitHub
parent f142cec97b
commit 143876dfa3
6 changed files with 41 additions and 3 deletions

View File

@@ -218,7 +218,6 @@ task generateJavaDocs(type: Javadoc) {
options.addBooleanOption("Xdoclint/package:" +
// TODO: v Document these, then remove them from the list
"-edu.wpi.first.hal," +
"-edu.wpi.first.hal.can," +
"-edu.wpi.first.hal.simulation," +
// TODO: ^ Document these, then remove them from the list
"-edu.wpi.first.math.proto," +

View File

@@ -11,10 +11,16 @@ package edu.wpi.first.hal.can;
public class CANInvalidBufferException extends RuntimeException {
private static final long serialVersionUID = -7993785672956997939L;
/** Constructs a new CANInvalidBufferException with no message. */
public CANInvalidBufferException() {
super();
}
/**
* Constructs a new CANInvalidBufferException with {@code msg} as its detail message.
*
* @param msg the message
*/
public CANInvalidBufferException(String msg) {
super(msg);
}

View File

@@ -11,6 +11,11 @@ package edu.wpi.first.hal.can;
public class CANMessageNotAllowedException extends RuntimeException {
private static final long serialVersionUID = -638450112427013494L;
/**
* Constructs a new CANMessageNotAllowedException with {@code msg} as its detail message.
*
* @param msg the message
*/
public CANMessageNotAllowedException(String msg) {
super(msg);
}

View File

@@ -11,10 +11,16 @@ package edu.wpi.first.hal.can;
public class CANMessageNotFoundException extends RuntimeException {
private static final long serialVersionUID = 8249780881928189975L;
/** Constructs a new CANMessageNotFoundException with no message. */
public CANMessageNotFoundException() {
super();
}
/**
* Constructs a new CANMessageNotFoundException with {@code msg} as its detail message.
*
* @param msg the message
*/
public CANMessageNotFoundException(String msg) {
super(msg);
}

View File

@@ -11,10 +11,16 @@ package edu.wpi.first.hal.can;
public class CANNotInitializedException extends RuntimeException {
private static final long serialVersionUID = -5982895147092686594L;
/** Constructs a new CANNotInitializedException with no message. */
public CANNotInitializedException() {
super();
}
/**
* Constructs a new CANNotInitializedException with {@code msg} as its detail message.
*
* @param msg the message
*/
public CANNotInitializedException(String msg) {
super(msg);
}

View File

@@ -7,6 +7,11 @@ package edu.wpi.first.hal.can;
import edu.wpi.first.hal.CANStreamMessage;
import java.io.IOException;
/**
* Exception indicating that a CAN stream overflowed at some point between reads, therefore some
* messages were lost. This exception contains any messages that were successfully read during the
* operation that threw the exception.
*/
public class CANStreamOverflowException extends IOException {
/** The messages. */
private final CANStreamMessage[] m_messages;
@@ -17,8 +22,8 @@ public class CANStreamOverflowException extends IOException {
/**
* Constructs a new CANStreamOverflowException.
*
* @param messages The messages
* @param messagesRead The length of messages read
* @param messages The messages that were read successfully.
* @param messagesRead The length of messages read successfully.
*/
@SuppressWarnings("PMD.ArrayIsStoredDirectly")
public CANStreamOverflowException(CANStreamMessage[] messages, int messagesRead) {
@@ -27,11 +32,22 @@ public class CANStreamOverflowException extends IOException {
this.m_messagesRead = messagesRead;
}
/**
* Gets the messages that were successfully read. Use {@link #getMessagesRead()} to determine how
* many messages in the returned array are valid.
*
* @return the messages
*/
@SuppressWarnings("PMD.MethodReturnsInternalArray")
public CANStreamMessage[] getMessages() {
return m_messages;
}
/**
* Gets the count of messages that were successfully read.
*
* @return count of messages
*/
public int getMessagesRead() {
return m_messagesRead;
}