Class XpaMessage

  • All Implemented Interfaces:
    Message

    public class XpaMessage
    extends java.lang.Object
    implements Message
    Encodes a message to an XpressNet command station via an XPA and a modem.
    • Method Detail

      • equals

        public boolean equals​(java.lang.Object m)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • getElement

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

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

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

        static XpaMessage getIncSpeedMsg​(int address,
                                         int steps)
        Get a message for an "Increase Speed" command to a specific locomotive on the layout. To make calculations easy, this uses a single speed step increase.
        Parameters:
        address - throttle loco address for message
        steps - amount of speed steps to change to increase
        Returns:
        message for the requested change
      • getDecSpeedMsg

        static XpaMessage getDecSpeedMsg​(int address,
                                         int steps)
        Get a message for a "Decrease Speed" command to a specific locomotive on the layout. To make calculations easy, this uses a single speed step decrease.
        Parameters:
        address - throttle loco address for message
        steps - amount of speed steps to change to decrease
        Returns:
        message for the requested change