001// Copyright (c) FIRST and other WPILib contributors.
002// Open Source Software; you can modify and/or share it under the terms of
003// the WPILib BSD license file in the root directory of this project.
004
005package edu.wpi.first.hal.can;
006
007/** Structure for holding the result of a CAN Status request. */
008@SuppressWarnings("MemberName")
009public class CANStatus {
010  /** The utilization of the CAN Bus. */
011  public double percentBusUtilization;
012
013  /** The CAN Bus off count. */
014  public int busOffCount;
015
016  /** The CAN Bus TX full count. */
017  public int txFullCount;
018
019  /** The CAN Bus receive error count. */
020  public int receiveErrorCount;
021
022  /** The CAN Bus transmit error count. */
023  public int transmitErrorCount;
024
025  /** Default constructor. */
026  public CANStatus() {}
027
028  /**
029   * Set CAN bus status.
030   *
031   * @param percentBusUtilization CAN bus utilization as a percent.
032   * @param busOffCount Bus off event count.
033   * @param txFullCount TX buffer full event count.
034   * @param receiveErrorCount Receive error event count.
035   * @param transmitErrorCount Transmit error event count.
036   */
037  public void setStatus(
038      double percentBusUtilization,
039      int busOffCount,
040      int txFullCount,
041      int receiveErrorCount,
042      int transmitErrorCount) {
043    this.percentBusUtilization = percentBusUtilization;
044    this.busOffCount = busOffCount;
045    this.txFullCount = txFullCount;
046    this.receiveErrorCount = receiveErrorCount;
047    this.transmitErrorCount = transmitErrorCount;
048  }
049}