Class Message

All Implemented Interfaces:
Message

public class Message extends AbstractMRMessage
Class for messages for a LAWICELL CAN hardware adapter.

The Lawicell adapter protocol encodes messages as an ASCII string of up to 24 characters of the form: tiiildd...[CR] Tiiiiiiiildd...[CR] The t or T indicates a standard or extended CAN frame iiiiiiii is the header as hex digits l is the number of bytes of data dd are the (up to) 8 data bytes

RTR Extended frames start with an R, RTR standard frames with r.

  • Field Details

  • Constructor Details

  • Method Details

    • getNumDataElements

      public int getNumDataElements()
      Description copied from class: AbstractMessage
      Get the number of data elements in a Message.
      Specified by:
      getNumDataElements in interface Message
      Overrides:
      getNumDataElements in class AbstractMessage
      Returns:
      number elements.
    • setNumDataElements

      public void setNumDataElements(int n)
    • getElement

      public int getElement(int n)
      Description copied from class: AbstractMessage
      Get a particular element in a Message.
      Specified by:
      getElement in interface Message
      Overrides:
      getElement in class AbstractMessage
      Parameters:
      n - Element Index.
      Returns:
      single element of message.
    • setElement

      public void setElement(int n, int v)
      Description copied from class: AbstractMessage
      Set a single Data Element at a particular index.
      Specified by:
      setElement in interface Message
      Overrides:
      setElement in class AbstractMessage
      Parameters:
      n - index of element.
      v - value of element.
    • setData

      public void setData(int[] d)
    • setExtended

      public void setExtended(boolean extended)
    • isExtended

      public boolean isExtended()
    • setRtr

      public void setRtr(boolean isrtr)
    • isRtrSet

      public boolean isRtrSet()
    • setHeader

      public int setHeader(int header, int index)
      Set the CAN header as ASCII hex digits. Handles extended/standard internally.
      Parameters:
      header - A valid CAN header value
      index - start index.
      Returns:
      index to next bytes, after this
    • setByte

      public void setByte(int val, int n)
      Set a byte as two ASCII hex digits

      Data bytes are encoded as two ASCII hex digits starting at byte 7 of the message.

      Parameters:
      val - the value to set
      n - the index of the byte to be set
    • setHexDigit

      void setHexDigit(int val, int n)