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
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description int
canDetectorMessageType()
(package private) DccLocoAddress
getCanDetectorLocoAddress(int addressValue)
(package private) String
getCanDetectorLocoAddressString(int addressValue)
Integer
getElementBCD(int n)
Get an integer representation of a BCD value.int
getLength()
(package private) LocoNetMessage
getLocoNetMessage()
(package private) int
getNumRailComDataEntries()
int
getOpCode()
Get the OpCode.(package private) int
getRailComErrCount(int n)
Get the error counter from an entry in a railcom message.(package private) DccLocoAddress
getRailComLocoAddress(int n)
Get a locomotive address from an entry in a railcom message.(package private) int
getRailComOptions(int n)
Get the options value from an entry in a railcom message.(package private) int
getRailComQos(int n)
Get the Quality of Service value from an entry in a railcom message.(package private) int
getRailComRcvCount(int n)
Get the receive counter from an entry in a railcom message.(package private) int
getRailComSpeed(int n)
Get the speed value from an entry in a railcom message.(package private) int
getSystemDataFilteredMainCurrent()
Get the Filtered Main Track Current from the SystemStateDataChanged message.(package private) int
getSystemDataMainCurrent()
Get the Main Track Current from the SystemStateDataChanged message.(package private) int
getSystemDataProgCurrent()
Get the Programming Track Current from the SystemStateDataChanged message.(package private) int
getSystemDataSupplyVoltage()
Get the Supply Voltage from the SystemStateDataChanged message.(package private) int
getSystemDataTemperature()
Get the Temperature from the SystemStateDataChanged message.(package private) int
getSystemDataVCCVoltage()
Get the VCC (and track) Voltage from the SystemStateDataChanged message.(package private) Z21XNetReply
getXNetReply()
(package private) boolean
isCanDetectorMessage()
boolean
isCanReporterMessage()
boolean
isCanSensorMessage()
(package private) boolean
isLocoNetDetectorMessage()
(package private) boolean
isLocoNetDispatchMessage()
(package private) boolean
isLocoNetTunnelMessage()
(package private) boolean
isRailComDataChangedMessage()
(package private) boolean
isRMBusDataChangedReply()
(package private) boolean
isSystemDataChangedReply()
(package private) boolean
isXPressNetTunnelMessage()
void
setElement(int n, int v)
Set a single Data Element at a particular index.void
setLength(int i)
void
setOpCode(int i)
Set the OpCode.protected int
skipPrefix(int index)
String
toMonitorString()
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
-
Constructor Details
-
Method Details
-
setElement
Description copied from class:AbstractMessage
Set a single Data Element at a particular index.- Specified by:
setElement
in interfaceMessage
- Overrides:
setElement
in classAbstractMRReply
- Parameters:
n
- index of element.v
- value of element.
-
getElementBCD
Get an integer representation of a BCD value.- Parameters:
n
- byte in message to convert- Returns:
- Integer value of BCD byte.
-
setOpCode
Description copied from class:AbstractMRReply
Set the OpCode. Sets Element 0 to character value of integer.- Overrides:
setOpCode
in classAbstractMRReply
- Parameters:
i
- Opcode value.
-
getOpCode
Description copied from class:AbstractMRReply
Get the OpCode.- Overrides:
getOpCode
in classAbstractMRReply
- Returns:
- value of Element 0.
-
setLength
-
getLength
-
skipPrefix
- Specified by:
skipPrefix
in classAbstractMRReply
-
toMonitorString
-
isXPressNetTunnelMessage
boolean isXPressNetTunnelMessage() -
getXNetReply
-
isRailComDataChangedMessage
boolean isRailComDataChangedMessage() -
getNumRailComDataEntries
int getNumRailComDataEntries()- Returns:
- the number of RailCom entries in this message. the returned value is in the 0 to 19 range.
-
getRailComLocoAddress
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
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
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
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
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
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
int getSystemDataMainCurrent()Get the Main Track Current from the SystemStateDataChanged message.- Returns:
- the current in mA.
-
getSystemDataProgCurrent
int getSystemDataProgCurrent()Get the Programming Track Current from the SystemStateDataChanged message.- Returns:
- the current in mA.
-
getSystemDataFilteredMainCurrent
Get the Filtered Main Track Current from the SystemStateDataChanged message.- Returns:
- the current in mA.
-
getSystemDataTemperature
int getSystemDataTemperature()Get the Temperature from the SystemStateDataChanged message.- Returns:
- the current in degrees C.
-
getSystemDataSupplyVoltage
Get the Supply Voltage from the SystemStateDataChanged message.- Returns:
- the current in mV.
-
getSystemDataVCCVoltage
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
-
isRMBusDataChangedReply
boolean isRMBusDataChangedReply() -
isCanDetectorMessage
boolean isCanDetectorMessage() -
getCanDetectorLocoAddressString
-
getCanDetectorLocoAddress
-
canDetectorMessageType
- Returns:
- the can Detector Message type or -1 if not a can detector message.
-
isCanSensorMessage
- Returns:
- true if the reply is for a CAN detector and the type is 0x01
-
isCanReporterMessage
- Returns:
- true if the reply is for a CAN detector and the type is 0x01
-