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  /**
019   * API used from JNI to set the data.
020   *
021   * @param length Length of packet in bytes.
022   * @param timestamp CAN frame timestamp in milliseconds.
023   * @return Buffer to place CAN frame data in.
024   */
025  @SuppressWarnings("PMD.MethodReturnsInternalArray")
026  public byte[] setData(int length, long timestamp) {
027    this.length = length;
028    this.timestamp = timestamp;
029    return data;
030  }
031}