Package jmri.jmrix

Class AbstractMRMessage

    • Field Detail

      • SHORT_TIMEOUT

        protected static final int SHORT_TIMEOUT
        Minimum timeout that's acceptable.

        Also used as default for normal operations. Don't shorten this "to make recovery faster", as sometimes internal delays can slow processing down.

        Units are milliseconds.

        See Also:
        Constant Field Values
    • Constructor Detail

      • AbstractMRMessage

        public AbstractMRMessage()
        Create a new AbstractMRMessage instance.
      • AbstractMRMessage

        public AbstractMRMessage​(int i)
        Create a new AbstractMRMessage instance of a given byte size.
        Parameters:
        i - number of elements in message
      • AbstractMRMessage

        public AbstractMRMessage​(java.lang.String s)
        Create a new Message instance from a string.
        Parameters:
        s - String to use as message content
    • Method Detail

      • setOpCode

        public void setOpCode​(int i)
      • setNeededMode

        public final void setNeededMode​(int pMode)
        Set a needed mode. Final so that it can be called in constructors.
        Parameters:
        pMode - required mode value.
      • getNeededMode

        public final int getNeededMode()
        Get needed mode. Final so that it can be called in constructors.
        Returns:
        mNeededMode required mode value.
      • replyExpected

        public boolean replyExpected()
        Is a reply expected to this message?

        By default, a reply is expected to every message; either a reply or a timeout is needed before the next message can be sent.

        If this returns false, the transmit queue will immediately go on to transmit the next message (if any).

        Returns:
        true by default in Abstract MR message.
      • isBinary

        public final boolean isBinary()
        Get if is binary. Final so that it can be called in constructors.
        Returns:
        true if binary, else false.
      • setBinary

        public final void setBinary​(boolean b)
        Set if Binary. final so that it can be called in constructors.
        Parameters:
        b - true if binary, else false.
      • setTimeout

        public final void setTimeout​(int t)
        Set Timeout. Final so that it can be called in constructors.
        Parameters:
        t - timeout value.
      • getTimeout

        public final int getTimeout()
        Get Timeout. Final so that it can be called in constructors.
        Returns:
        timeout value.
      • setRetries

        public final void setRetries​(int i)
        Set number of retries. Final so that it can be called in constructors
        Parameters:
        i - number of retries, actual value to set, not an increment.
      • getRetries

        public final int getRetries()
        Get number of retries. final so that it can be called in constructors
        Returns:
        number of retries count.
      • addIntAsThree

        public void addIntAsThree​(int val,
                                  int offset)
      • addIntAsTwoHex

        public void addIntAsTwoHex​(int val,
                                   int offset)
        Put an int value into the message as two ASCII upper-case hex characters.
        Parameters:
        val - value to convert.
        offset - offset in message.
      • addIntAsThreeHex

        public void addIntAsThreeHex​(int val,
                                     int offset)
        Put an int value into the message as three ASCII upper-case hex characters.
        Parameters:
        val - value to convert.
        offset - offset in message.
      • addIntAsFourHex

        public void addIntAsFourHex​(int val,
                                    int offset)
        Put an int value into the message as four ASCII upper-case hex characters.
        Parameters:
        val - value to convert.
        offset - offset in message.
      • toString

        public java.lang.String toString()
        Description copied from interface: Message
        Specified by:
        toString in interface Message
        Overrides:
        toString in class java.lang.Object