Class CanMessage

All Implemented Interfaces:
CanFrame, CanMutableFrame, Message

public class CanMessage extends AbstractMRMessage implements CanMutableFrame
Base class for messages in a CANbus based message/reply protocol.

It is expected that any CAN based system will be based upon basic CANbus concepts such as ID (standard or extended), Normal and RTR frames and a data field.

The _dataChars[] and _nDataChars members refer to the data field, not the entire message.

"header" refers to the full 11 or 29 bit header; which mode is separately set via the "extended" parameter

CBUS uses a 2-bit "Pri" field and 7-bit "ID" ("CAN ID") field, with separate accessors. CBUS ID is set as a layout connection preference and registered by the traffic controller.

  • Field Details

  • Constructor Details

    • CanMessage

      public CanMessage(int header)
      Create a new CanMessage with 8 data bytes
      Parameters:
      header - The CAN Frame header value
    • CanMessage

      public CanMessage(int numDataBytes, int header)
      Create a new CanMessage of given length
      Parameters:
      numDataBytes - number of CAN Frame data bytes, max 8
      header - The CAN Frame header value
    • CanMessage

      public CanMessage(int[] d, int header)
      Create a new CanMessage from an int array
      Parameters:
      d - array of CAN Frame data bytes, max 8
      header - The CAN Frame header value
    • CanMessage

      public CanMessage(byte[] d, int header)
      Create a new CanMessage from a byte array
      Parameters:
      d - array of CAN Frame data bytes, max 8
      header - The CAN Frame header value
    • CanMessage

      Create a new CanMessage from an existing CanMessage
      Parameters:
      m - The existing CanMessage
    • CanMessage

      Create a new CanMessage from an existing CanReply
      Parameters:
      m - The existing CanReply
  • Method Details