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  /**
026   * Set CAN bus status.
027   *
028   * @param percentBusUtilization CAN bus utilization as a percent.
029   * @param busOffCount Bus off event count.
030   * @param txFullCount TX buffer full event count.
031   * @param receiveErrorCount Receive error event count.
032   * @param transmitErrorCount Transmit error event count.
033   */
034  public void setStatus(
035      double percentBusUtilization,
036      int busOffCount,
037      int txFullCount,
038      int receiveErrorCount,
039      int transmitErrorCount) {
040    this.percentBusUtilization = percentBusUtilization;
041    this.busOffCount = busOffCount;
042    this.txFullCount = txFullCount;
043    this.receiveErrorCount = receiveErrorCount;
044    this.transmitErrorCount = transmitErrorCount;
045  }
046}