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 int
MAX_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 boolean
equals(java.lang.Object m)
(package private) static XpaMessage
getDecSpeedMsg(int address, int steps)
Get a message for a "Decrease Speed" command to a specific locomotive on the layout.(package private) static XpaMessage
getDefaultInitMsg()
static XpaMessage
getDeviceSettingMsg(int setting)
(package private) static XpaMessage
getDirForwardMsg(int address)
(package private) static XpaMessage
getDirReverseMsg(int address)
int
getElement(int n)
Get a particular element in a Message.(package private) static XpaMessage
getEStopMsg()
(package private) static XpaMessage
getFunctionMsg(int address, int function)
(package private) static XpaMessage
getIdleMsg(int address)
(package private) static XpaMessage
getIncSpeedMsg(int address, int steps)
Get a message for an "Increase Speed" command to a specific locomotive on the layout.int
getNumDataElements()
Get the number of data elements in a Message.(package private) static XpaMessage
getSwitchNormalMsg(int address)
(package private) static XpaMessage
getSwitchReverseMsg(int address)
int
hashCode()
void
setElement(int n, int v)
Set a single Data Element at a particular index.java.lang.String
toString()
-
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:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
getNumDataElements
public int getNumDataElements()
Description copied from interface:Message
Get the number of data elements in a Message.- Specified by:
getNumDataElements
in interfaceMessage
- Returns:
- number elements.
-
getElement
public int getElement(int n)
Description copied from interface:Message
Get a particular element in a Message.- Specified by:
getElement
in interfaceMessage
- 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 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)
-
-