Package peak.can.basic
Class TPCANMsgFD
java.lang.Object
peak.can.basic.TPCANMsgFD
- All Implemented Interfaces:
Cloneable
Defines a CAN FD message.
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructorTPCANMsgFD
(int id, EnumSet<TPCANMessageType> type, byte dlc, byte[] data) Constructs a new message object. -
Method Summary
Modifier and TypeMethodDescriptionclone()
Clones this message object.byte[]
getData()
Gets the data of this message.byte
getDlc()
Gets the data length code of this message.int
getID()
Gets the id of this message.byte
Gets the length of this message based on its DLC.static byte
getLengthFromDLC
(byte dlc) Gets the length of a message based on a DLC.byte
getType()
Gets the type of this message.Gets the type of this message.void
setData
(byte[] data, byte dlc) Sets the data and length of this message.void
setDlc
(byte dlc) Sets the data length code of this message.void
setID
(int id) Sets the id of this message.void
setType
(byte type) Sets the type of this message.void
setType
(EnumSet<TPCANMessageType> type) Sets the type of this message.
-
Constructor Details
-
TPCANMsgFD
public TPCANMsgFD()Default constructor -
TPCANMsgFD
Constructs a new message object.- Parameters:
id
- the message idtype
- the message typedlc
- the message data length codedata
- 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 datadlc
- 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
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
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
Clones this message object.
-