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