Package jmri.jmrix.xpa
Class XpaMessage
- java.lang.Object
-
- jmri.jmrix.xpa.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.
-
-
Field Summary
Fields Modifier and Type Field Description static intMAX_SIZE
-
Constructor Summary
Constructors Constructor Description XpaMessage()XpaMessage(int i)XpaMessage(java.lang.String s)XpaMessage(XpaMessage m)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object m)(package private) static XpaMessagegetDecSpeedMsg(int address, int steps)Get a message for a "Decrease Speed" command to a specific locomotive on the layout.(package private) static XpaMessagegetDefaultInitMsg()static XpaMessagegetDeviceSettingMsg(int setting)(package private) static XpaMessagegetDirForwardMsg(int address)(package private) static XpaMessagegetDirReverseMsg(int address)intgetElement(int n)Get a particular element in a Message.(package private) static XpaMessagegetEStopMsg()(package private) static XpaMessagegetFunctionMsg(int address, int function)(package private) static XpaMessagegetIdleMsg(int address)(package private) static XpaMessagegetIncSpeedMsg(int address, int steps)Get a message for an "Increase Speed" command to a specific locomotive on the layout.intgetNumDataElements()Get the number of data elements in a Message.(package private) static XpaMessagegetSwitchNormalMsg(int address)(package private) static XpaMessagegetSwitchReverseMsg(int address)inthashCode()voidsetElement(int n, int v)Set a single Data Element at a particular index.java.lang.StringtoString()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jmri.jmrix.Message
toMonitorString
-
-
-
-
Field Detail
-
MAX_SIZE
public static final int MAX_SIZE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
XpaMessage
public XpaMessage(int i)
-
XpaMessage
public XpaMessage(java.lang.String s)
-
XpaMessage
public XpaMessage()
-
XpaMessage
public XpaMessage(XpaMessage m)
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object m)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
getNumDataElements
public int getNumDataElements()
Description copied from interface:MessageGet the number of data elements in a Message.- Specified by:
getNumDataElementsin interfaceMessage- Returns:
- number elements.
-
getElement
public int getElement(int n)
Description copied from interface:MessageGet a particular element in a Message.- Specified by:
getElementin interfaceMessage- Parameters:
n- Element Index.- Returns:
- single element of message.
-
setElement
public void setElement(int n, int v)
Description copied from interface:MessageSet a single Data Element at a particular index.- Specified by:
setElementin interfaceMessage- Parameters:
n- index of element.v- value of element.
-
getDefaultInitMsg
static XpaMessage getDefaultInitMsg()
-
getEStopMsg
static XpaMessage getEStopMsg()
-
getIdleMsg
static XpaMessage getIdleMsg(int address)
-
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 messagesteps- 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 messagesteps- amount of speed steps to change to decrease- Returns:
- message for the requested change
-
getDirForwardMsg
static XpaMessage getDirForwardMsg(int address)
-
getDirReverseMsg
static XpaMessage getDirReverseMsg(int address)
-
getFunctionMsg
static XpaMessage getFunctionMsg(int address, int function)
-
getSwitchNormalMsg
static XpaMessage getSwitchNormalMsg(int address)
-
getSwitchReverseMsg
static XpaMessage getSwitchReverseMsg(int address)
-
getDeviceSettingMsg
public static XpaMessage getDeviceSettingMsg(int setting)
-
-