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 org.wpilib.hardware.hal.can;
006
007/** Structure for holding the result of a CAN Status request. */
008public class CANStatus {
009  /** The utilization of the CAN Bus. */
010  public double percentBusUtilization;
011
012  /** The CAN Bus off count. */
013  public int busOffCount;
014
015  /** The CAN Bus TX full count. */
016  public int txFullCount;
017
018  /** The CAN Bus receive error count. */
019  public int receiveErrorCount;
020
021  /** The CAN Bus transmit error count. */
022  public int transmitErrorCount;
023
024  /** Default constructor. */
025  public CANStatus() {}
026
027  /**
028   * Set CAN bus status.
029   *
030   * @param percentBusUtilization CAN bus utilization as a percent.
031   * @param busOffCount Bus off event count.
032   * @param txFullCount TX buffer full event count.
033   * @param receiveErrorCount Receive error event count.
034   * @param transmitErrorCount Transmit error event count.
035   */
036  public void setStatus(
037      double percentBusUtilization,
038      int busOffCount,
039      int txFullCount,
040      int receiveErrorCount,
041      int transmitErrorCount) {
042    this.percentBusUtilization = percentBusUtilization;
043    this.busOffCount = busOffCount;
044    this.txFullCount = txFullCount;
045    this.receiveErrorCount = receiveErrorCount;
046    this.transmitErrorCount = transmitErrorCount;
047  }
048}