Package jmri.jmrix.roco.z21
Class Z21Reply
- java.lang.Object
-
- jmri.jmrix.AbstractMessage
-
- jmri.jmrix.AbstractMRReply
-
- jmri.jmrix.roco.z21.Z21Reply
-
- All Implemented Interfaces:
Message
public class Z21Reply extends AbstractMRReply
Class for replies in the z21/Z21 protocol.Replies are of the format: 2 bytes length 2 bytes opcode n bytes data
numeric data is sent in little endian format.
-
-
Field Summary
-
Fields inherited from class jmri.jmrix.AbstractMRReply
DEFAULTMAXSIZE
-
Fields inherited from class jmri.jmrix.AbstractMessage
_dataChars, _nDataChars
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcanDetectorMessageType()java.lang.IntegergetElementBCD(int n)Get an integer representation of a BCD value.intgetLength()LocoNetMessagegetLocoNetMessage()intgetNumRailComDataEntries()intgetOpCode()Get the OpCode.intgetRailComErrCount(int n)Get the error counter from an entry in a railcom message.DccLocoAddressgetRailComLocoAddress(int n)Get a locomotive address from an entry in a railcom message.intgetRailComOptions(int n)Get the options value from an entry in a railcom message.intgetRailComQos(int n)Get the Quality of Service value from an entry in a railcom message.intgetRailComRcvCount(int n)Get the receive counter from an entry in a railcom message.intgetRailComSpeed(int n)Get the speed value from an entry in a railcom message.intgetSystemDataFilteredMainCurrent()Get the Filtered Main Track Current from the SystemStateDataChanged message.intgetSystemDataMainCurrent()Get the Main Track Current from the SystemStateDataChanged message.intgetSystemDataProgCurrent()Get the Programming Track Current from the SystemStateDataChanged message.intgetSystemDataSupplyVoltage()Get the Supply Voltage from the SystemStateDataChanged message.intgetSystemDataTemperature()Get the Temperature from the SystemStateDataChanged message.intgetSystemDataVCCVoltage()Get the VCC (and track) Voltage from the SystemStateDataChanged message.Z21XNetReplygetXNetReply()(package private) booleanisCanDetectorMessage()booleanisCanReporterMessage()booleanisCanSensorMessage()(package private) booleanisLocoNetDetectorMessage()(package private) booleanisLocoNetDispatchMessage()(package private) booleanisLocoNetTunnelMessage()(package private) booleanisRailComDataChangedMessage()(package private) booleanisRMBusDataChangedReply()(package private) booleanisSystemDataChangedReply()(package private) booleanisXPressNetTunnelMessage()voidsetElement(int n, int v)Set a single Data Element at a particular index.voidsetLength(int i)voidsetOpCode(int i)Set the OpCode.protected intskipPrefix(int index)java.lang.StringtoMonitorString()-
Methods inherited from class jmri.jmrix.AbstractMRReply
flush, isBinary, isRetransmittableErrorMsg, isUnsolicited, match, maxSize, pollValue, setBinary, setUnsolicited, skipWhiteSpace, toString, value
-
Methods inherited from class jmri.jmrix.AbstractMessage
equals, getElement, getNumDataElements, hashCode
-
-
-
-
Method Detail
-
setElement
public void setElement(int n, int v)
Description copied from class:AbstractMessageSet a single Data Element at a particular index.- Specified by:
setElementin interfaceMessage- Overrides:
setElementin classAbstractMRReply- Parameters:
n- index of element.v- value of element.
-
getElementBCD
public java.lang.Integer getElementBCD(int n)
Get an integer representation of a BCD value.- Parameters:
n- byte in message to convert- Returns:
- Integer value of BCD byte.
-
setOpCode
public void setOpCode(int i)
Description copied from class:AbstractMRReplySet the OpCode. Sets Element 0 to character value of integer.- Overrides:
setOpCodein classAbstractMRReply- Parameters:
i- Opcode value.
-
getOpCode
public int getOpCode()
Description copied from class:AbstractMRReplyGet the OpCode.- Overrides:
getOpCodein classAbstractMRReply- Returns:
- value of Element 0.
-
setLength
public void setLength(int i)
-
getLength
public int getLength()
-
skipPrefix
protected int skipPrefix(int index)
- Specified by:
skipPrefixin classAbstractMRReply
-
toMonitorString
public java.lang.String toMonitorString()
- Returns:
- a human-readable representation of the message.
-
isXPressNetTunnelMessage
boolean isXPressNetTunnelMessage()
-
getXNetReply
public Z21XNetReply getXNetReply()
-
isRailComDataChangedMessage
boolean isRailComDataChangedMessage()
-
getNumRailComDataEntries
public int getNumRailComDataEntries()
- Returns:
- the number of RailCom entries in this message. the returned value is in the 0 to 19 range.
-
getRailComLocoAddress
public DccLocoAddress getRailComLocoAddress(int n)
Get a locomotive address from an entry in a railcom message.- Parameters:
n- the entry to get the address from.- Returns:
- the locomotive address for the specified entry.
-
getRailComRcvCount
public int getRailComRcvCount(int n)
Get the receive counter from an entry in a railcom message.- Parameters:
n- the entry to get the address from.- Returns:
- the receive counter for the specified entry.
-
getRailComErrCount
public int getRailComErrCount(int n)
Get the error counter from an entry in a railcom message.- Parameters:
n- the entry to get the address from.- Returns:
- the error counter for the specified entry.
-
getRailComSpeed
public int getRailComSpeed(int n)
Get the speed value from an entry in a railcom message.- Parameters:
n- the entry to get the address from.- Returns:
- the error counter for the specified entry.
-
getRailComOptions
public int getRailComOptions(int n)
Get the options value from an entry in a railcom message.- Parameters:
n- the entry to get the address from.- Returns:
- the options for the specified entry.
-
getRailComQos
public int getRailComQos(int n)
Get the Quality of Service value from an entry in a railcom message.- Parameters:
n- the entry to get the address from.- Returns:
- the Quality of Service value for the specified entry.
-
isSystemDataChangedReply
boolean isSystemDataChangedReply()
-
getSystemDataMainCurrent
public int getSystemDataMainCurrent()
Get the Main Track Current from the SystemStateDataChanged message.- Returns:
- the current in mA.
-
getSystemDataProgCurrent
public int getSystemDataProgCurrent()
Get the Programming Track Current from the SystemStateDataChanged message.- Returns:
- the current in mA.
-
getSystemDataFilteredMainCurrent
public int getSystemDataFilteredMainCurrent()
Get the Filtered Main Track Current from the SystemStateDataChanged message.- Returns:
- the current in mA.
-
getSystemDataTemperature
public int getSystemDataTemperature()
Get the Temperature from the SystemStateDataChanged message.- Returns:
- the current in degrees C.
-
getSystemDataSupplyVoltage
public int getSystemDataSupplyVoltage()
Get the Supply Voltage from the SystemStateDataChanged message.- Returns:
- the current in mV.
-
getSystemDataVCCVoltage
public int getSystemDataVCCVoltage()
Get the VCC (and track) Voltage from the SystemStateDataChanged message.- Returns:
- the current in mV.
-
isLocoNetTunnelMessage
boolean isLocoNetTunnelMessage()
-
isLocoNetDispatchMessage
boolean isLocoNetDispatchMessage()
-
isLocoNetDetectorMessage
boolean isLocoNetDetectorMessage()
-
getLocoNetMessage
public LocoNetMessage getLocoNetMessage()
-
isRMBusDataChangedReply
boolean isRMBusDataChangedReply()
-
isCanDetectorMessage
boolean isCanDetectorMessage()
-
canDetectorMessageType
public int canDetectorMessageType()
- Returns:
- the can Detector Message type or -1 if not a can detector message.
-
isCanSensorMessage
public boolean isCanSensorMessage()
- Returns:
- true if the reply is for a CAN detector and the type is 0x01
-
isCanReporterMessage
public boolean isCanReporterMessage()
- Returns:
- true if the reply is for a CAN detector and the type is 0x01
-
-