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;
006
007@SuppressWarnings("MemberName")
008public class CANData {
009  /** Contents of the CAN frame. */
010  public final byte[] data = new byte[8];
011
012  /** Length of the frame in bytes. */
013  public int length;
014
015  /** CAN frame timestamp in milliseconds. */
016  public long timestamp;
017
018  /** Default constructor. */
019  public CANData() {}
020
021  /**
022   * API used from JNI to set the data.
023   *
024   * @param length Length of packet in bytes.
025   * @param timestamp CAN frame timestamp in milliseconds.
026   * @return Buffer to place CAN frame data in.
027   */
028  @SuppressWarnings("PMD.MethodReturnsInternalArray")
029  public byte[] setData(int length, long timestamp) {
030    this.length = length;
031    this.timestamp = timestamp;
032    return data;
033  }
034}