Class GridConnectReply

  • All Implemented Interfaces:
    Message
    Direct Known Subclasses:
    MergReply

    public class GridConnectReply
    extends AbstractMRReply
    Class for replies in a GridConnect based message/reply protocol.

    The GridConnect protocol encodes messages as an ASCII string of up to 24 characters of the form: :ShhhhNd0d1d2d3d4d5d6d7;

    hhhh is the two byte (11 useful bits) header The S indicates a standard CAN frame :XhhhhhhhhNd0d1d2d3d4d5d6d7; The X indicates an extended CAN frame N or R indicates a normal or remote frame, in position 6 or 10 d0 - d7 are the (up to) 8 data bytes

    • Constructor Detail

      • GridConnectReply

        public GridConnectReply()
        Creates a new instance of GridConnectReply.
      • GridConnectReply

        public GridConnectReply​(java.lang.String s)
        Creates a new GridConnectReply from String.
        Parameters:
        s - String to use as basis for the GCReply.
    • Method Detail

      • createReply

        public CanReply createReply()
        Create a CanReply from a GridConnectReply.
        Returns:
        new CanReply Outgoing message.
      • basicFormatCheck

        protected boolean basicFormatCheck()
        Check if this GCReply contains an Extended or Standard flag.
        Returns:
        true if contains a flag, else false.
      • setNumDataElements

        public void setNumDataElements​(int n)
        Set Number of Data Elements. Max. length set by the MAXLEN constant.
        Parameters:
        n - Number Elements.
      • isExtended

        public boolean isExtended()
        Get if the GridConnectReply is Extended.
        Returns:
        true if extended, else false.
      • isRtr

        public boolean isRtr()
        Get if the GridConnectReply is RtR.
        Returns:
        true if RtR, else false.
      • setData

        public void setData​(int[] d)
        Set the GridConnectReply data by Array.
        Parameters:
        d - data array.
      • getHeader

        public int getHeader()
        Get the CAN header by using chars from 2 to up to 9.

        Right justify standard headers that had 4 digits.

        Returns:
        the CAN header as an int
      • getNumBytes

        public int getNumBytes()
        Get the number of data bytes.
        Returns:
        number of bytes in reply.
      • getByte

        public int getByte​(int b)
        Get a hex data byte from the message.

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

        Parameters:
        b - The byte offset (0 - 7)
        Returns:
        The value