Package peak.can.basic
Class TPCANMsg
java.lang.Object
peak.can.basic.TPCANMsg
- All Implemented Interfaces:
Cloneable
Defines a CAN message.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final byte
Deprecated.Use enum TPCANMessageType insteadstatic final byte
Deprecated.Use enum TPCANMessageType insteadstatic final byte
Deprecated.Use enum TPCANMessageType instead -
Constructor Summary
ConstructorsConstructorDescriptionTPCANMsg()
Default constructorTPCANMsg
(int id, byte type, byte length, byte[] data) Constructs a new message object.TPCANMsg
(int id, EnumSet<TPCANMessageType> type, byte length, byte[] data) Constructs a new message object. -
Method Summary
Modifier and TypeMethodDescriptionclone()
Clones this message object.byte[]
getData()
Gets the data of this message.int
getID()
Gets the id of this message.byte
Gets the length of this message.byte
getType()
Gets the type of this message.void
setData
(byte[] data, byte length) Sets the data and length of this message.void
setID
(int id) Sets the id of this message.void
setLength
(byte length) Sets the length of this message.void
setType
(byte type) Sets the type of this message.void
setType
(EnumSet<TPCANMessageType> type) Sets the type of this message.void
setType
(TPCANMessageType type) Sets the type of this message.
-
Field Details
-
MSGTYPE_STANDARD
Deprecated.Use enum TPCANMessageType instead11bit message type (standard) -
MSGTYPE_RTR
Deprecated.Use enum TPCANMessageType insteadRemote request -
MSGTYPE_EXTENDED
Deprecated.Use enum TPCANMessageType instead29bit message type (extended)
-
-
Constructor Details
-
TPCANMsg
public TPCANMsg()Default constructor -
TPCANMsg
public TPCANMsg(int id, byte type, byte length, byte[] data) Constructs a new message object.- Parameters:
id
- the message idtype
- the message typelength
- the message lengthdata
- the message data
-
TPCANMsg
Constructs a new message object.- Parameters:
id
- the message idtype
- the message type as an enumeration setlength
- the message lengthdata
- 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 length) Sets the data and length of this message.- Parameters:
data
- the message datalength
- the message length
-
setLength
public void setLength(byte length) Sets the length of this message.- Parameters:
length
- the length of the message
-
setType
public void setType(byte type) Sets the type of this message.- Parameters:
type
- the message type
-
setType
Sets the type of this message.- Parameters:
type
- the message type
-
setType
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
-
getLength
public byte getLength()Gets the length of this message.- Returns:
- the message length
-
getType
public byte getType()Gets the type of this message.- Returns:
- the message type
-
clone
Clones this message object.
-