Class TPCANMsgFD

java.lang.Object
peak.can.basic.TPCANMsgFD
All Implemented Interfaces:
Cloneable

public class TPCANMsgFD extends Object implements Cloneable
Defines a CAN FD message.
  • Constructor Details

    • TPCANMsgFD

      public TPCANMsgFD()
      Default constructor
    • TPCANMsgFD

      public TPCANMsgFD(int id, EnumSet<TPCANMessageType> type, byte dlc, byte[] data)
      Constructs a new message object.
      Parameters:
      id - the message id
      type - the message type
      dlc - the message data length code
      data - the message data
  • Method Details

    • setID

      public void setID(int id)
      Sets the id of this message.
      Parameters:
      id - the message id
    • setData

      public void setData(byte[] data, byte dlc)
      Sets the data and length of this message.
      Parameters:
      data - the message data
      dlc - the message length
    • setDlc

      public void setDlc(byte dlc)
      Sets the data length code of this message.
      Parameters:
      dlc - the data length code of the message
    • setType

      public void setType(EnumSet<TPCANMessageType> type)
      Sets the type of this message.
      Parameters:
      type - the message type
    • setType

      public void setType(byte type)
      Sets the type of this message.
      Parameters:
      type - the message type
    • getID

      public int getID()
      Gets the id of this message.
      Returns:
      the message id
    • getData

      public byte[] getData()
      Gets the data of this message.
      Returns:
      the message data
    • getDlc

      public byte getDlc()
      Gets the data length code of this message.
      Returns:
      the message length
    • getLengthFromDLC

      public byte getLengthFromDLC()
      Gets the length of this message based on its DLC.
      Returns:
      the message length
    • getLengthFromDLC

      public static byte getLengthFromDLC(byte dlc)
      Gets the length of a message based on a DLC.
      Parameters:
      dlc - data length code
      Returns:
      the message length
    • getTypeEnum

      public EnumSet<TPCANMessageType> getTypeEnum()
      Gets the type of this message.
      Returns:
      the message type
    • getType

      public byte getType()
      Gets the type of this message.
      Returns:
      the message type
    • clone

      public Object clone()
      Clones this message object.
      Overrides:
      clone in class Object
      Returns:
      The cloned message object.