Package jmri.jmrix.dccpp
Class DCCppReply
- java.lang.Object
-
- jmri.jmrix.AbstractMessage
-
- jmri.jmrix.AbstractMRReply
-
- jmri.jmrix.dccpp.DCCppReply
-
- All Implemented Interfaces:
Message
public class DCCppReply extends AbstractMRReply
Represents a single response from the DCC++ system.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
myRegex
protected java.lang.StringBuilder
myReply
-
Fields inherited from class jmri.jmrix.AbstractMRReply
DEFAULTMAXSIZE
-
Fields inherited from class jmri.jmrix.AbstractMessage
_dataChars, _nDataChars
-
-
Constructor Summary
Constructors Constructor Description DCCppReply()
DCCppReply(java.lang.String reply)
DCCppReply(DCCppReply reply)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getBuildString()
int
getCallbackNumInt()
java.lang.String
getCallbackNumString()
int
getCallbackSubInt()
java.lang.String
getCallbackSubString()
int
getClockMinutesInt()
java.lang.String
getClockMinutesString()
int
getClockRateInt()
java.lang.String
getClockRateString()
int
getCommTypeInt()
java.lang.String
getCommTypeValueString()
int
getCurrentInt()
java.lang.String
getCurrentString()
int
getCVInt()
java.lang.String
getCVString()
boolean
getDirectionBool()
int
getDirectionInt()
java.lang.String
getDirectionString()
int
getElement(int n)
Get a particular element in a Message.int
getFunctionsInt()
java.lang.String
getFunctionsString()
boolean
getIsForward()
int
getLCDDisplayNumInt()
java.lang.String
getLCDDisplayNumString()
int
getLCDLineNumInt()
java.lang.String
getLCDLineNumString()
java.lang.String
getLCDTextString()
int
getLength()
int
getLocoIdInt()
double
getMeterMaxValue()
double
getMeterMinValue()
java.lang.String
getMeterName()
double
getMeterResolution()
java.lang.String
getMeterType()
Meter.Unit
getMeterUnit()
double
getMeterValue()
double
getMeterWarnValue()
int
getOpCode()
Not really used inside of DCC++.char
getOpCodeChar()
Get the opcode as a one character string.boolean
getOutputCmdStateBool()
int
getOutputCmdStateInt()
java.lang.String
getOutputCmdStateString()
boolean
getOutputIsHigh()
boolean
getOutputIsLow()
int
getOutputListIFlagInt()
java.lang.String
getOutputListIFlagString()
int
getOutputListPinInt()
java.lang.String
getOutputListPinString()
int
getOutputListStateInt()
java.lang.String
getOutputListStateString()
int
getOutputNumInt()
java.lang.String
getOutputNumString()
boolean
getPowerBool()
java.lang.String
getPowerDistrictName()
java.lang.String
getPowerDistrictStatus()
int
getProgramBitInt()
java.lang.String
getProgramBitString()
java.util.LinkedHashMap<java.lang.String,java.lang.Object>
getProperties()
build a propertylist from reply values.java.lang.String
getPropertiesAsString()
Generate properties list for certain repliesint
getReadValueInt()
java.lang.String
getReadValueString()
int
getRegisterInt()
java.lang.String
getRegisterString()
int
getSensorDefNumInt()
java.lang.String
getSensorDefNumString()
int
getSensorDefPinInt()
java.lang.String
getSensorDefPinString()
boolean
getSensorDefPullupBool()
int
getSensorDefPullupInt()
java.lang.String
getSensorDefPullupString()
boolean
getSensorIsActive()
boolean
getSensorIsInactive()
int
getSensorNumInt()
java.lang.String
getSensorNumString()
int
getSensorStateInt()
java.lang.String
getSensorStateString()
int
getSpeedByteInt()
int
getSpeedInt()
java.lang.String
getSpeedString()
java.lang.String
getStationType()
int
getTOAddressIndexInt()
java.lang.String
getTOAddressIndexString()
int
getTOAddressInt()
java.lang.String
getTOAddressString()
int
getTOClosedPositionInt()
int
getTOIDInt()
java.lang.String
getTOIDString()
boolean
getTOIsClosed()
boolean
getTOIsThrown()
int
getTOPinInt()
int
getTOProfileInt()
int
getTOStateInt()
java.lang.String
getTOStateString()
int
getTOThrownPositionInt()
int
getTurnoutDefAddrInt()
java.lang.String
getTurnoutDefAddrString()
int
getTurnoutDefNumInt()
java.lang.String
getTurnoutDefNumString()
int
getTurnoutDefSubAddrInt()
java.lang.String
getTurnoutDefSubAddrString()
java.lang.String
getTurnoutDescString()
java.util.ArrayList<java.lang.Integer>
getTurnoutIDList()
java.lang.String
getTurnoutStateString()
boolean
getValueBool(int idx)
double
getValueDouble(int idx)
int
getValueInt(int idx)
java.lang.String
getValueString(int idx)
java.lang.String
getVersion()
boolean
isClockReply()
boolean
isCommTypeReply()
boolean
isCurrentReply()
boolean
isDiagReply()
boolean
isEStop()
boolean
isLCDTextReply()
boolean
isLocoStateReply()
boolean
isMADCFailReply()
boolean
isMADCSuccessReply()
boolean
isMaxNumSlotsReply()
boolean
isMeterReply()
boolean
isMeterTypeCurrent()
boolean
isMeterTypeVolt()
boolean
isNamedCurrentReply()
boolean
isNamedPowerReply()
boolean
isOutputCmdReply()
boolean
isOutputDefReply()
boolean
isOutputReply()
boolean
isPowerReply()
boolean
isProgramBitReply()
boolean
isProgramBitReplyV4()
boolean
isProgramLocoIdReply()
boolean
isProgramReply()
boolean
isProgramReplyV4()
boolean
isSensorDefReply()
boolean
isSensorReply()
boolean
isStatusReply()
boolean
isThrottleReply()
boolean
isTrackManagerReply()
boolean
isTurnoutCmdReply()
boolean
isTurnoutDefDCCReply()
boolean
isTurnoutDefLCNReply()
boolean
isTurnoutDefReply()
boolean
isTurnoutDefServoReply()
boolean
isTurnoutDefVpinReply()
boolean
isTurnoutIDReply()
boolean
isTurnoutIDsReply()
boolean
isTurnoutReply()
boolean
isValidReplyFormat()
boolean
isVerifyReply()
boolean
isWriteEepromReply()
protected static java.util.regex.Matcher
match(java.lang.String s, java.lang.String pat, java.lang.String name)
protected boolean
matches(java.lang.String pat)
int
maxSize()
static DCCppReply
parseDCCppReply(java.lang.String s)
Parses a string and generates a DCCppReply from the string contentsvoid
parseReply(java.lang.String s)
void
setElement(int n, int v)
Set a single Data Element at a particular index.protected int
skipPrefix(int index)
java.lang.String
toMonitorString()
Generate text translations of replies for use in the DCCpp monitor.java.lang.String
toString()
Override default toString.boolean
valueExists(int idx)
-
Methods inherited from class jmri.jmrix.AbstractMRReply
flush, isBinary, isRetransmittableErrorMsg, isUnsolicited, match, pollValue, setBinary, setOpCode, setUnsolicited, skipWhiteSpace, value
-
Methods inherited from class jmri.jmrix.AbstractMessage
equals, getNumDataElements, hashCode
-
-
-
-
Constructor Detail
-
DCCppReply
public DCCppReply()
-
DCCppReply
public DCCppReply(DCCppReply reply)
-
DCCppReply
public DCCppReply(java.lang.String reply)
-
-
Method Detail
-
toString
public java.lang.String toString()
Override default toString.- Specified by:
toString
in interfaceMessage
- Overrides:
toString
in classAbstractMRReply
- Returns:
- myReply StringBuilder toString.
-
toMonitorString
public java.lang.String toMonitorString()
Generate text translations of replies for use in the DCCpp monitor.- Returns:
- representation of the DCCppReply as a string.
-
getPropertiesAsString
public java.lang.String getPropertiesAsString()
Generate properties list for certain replies- Returns:
- list of all properties as a string
-
getProperties
public java.util.LinkedHashMap<java.lang.String,java.lang.Object> getProperties()
build a propertylist from reply values.- Returns:
- properties hashmap
-
parseReply
public void parseReply(java.lang.String s)
-
parseDCCppReply
@Nonnull public static DCCppReply parseDCCppReply(java.lang.String s)
Parses a string and generates a DCCppReply from the string contents- Parameters:
s
- String to be parsed- Returns:
- DCCppReply or empty string if not a valid formatted string
-
getOpCode
public int getOpCode()
Not really used inside of DCC++. Just here to play nicely with the inheritance. TODO: If this is unused, can we just not override it and (not) "use" the superclass version? ANSWER: No, we can't because the superclass looks in the _datachars element, which we don't use, and which will contain garbage data. Better to return something meaningful.- Overrides:
getOpCode
in classAbstractMRReply
- Returns:
- first char of myReply as integer
-
getOpCodeChar
public char getOpCodeChar()
Get the opcode as a one character string.- Returns:
- first char of myReply
-
getElement
public int getElement(int n)
Description copied from class:AbstractMessage
Get a particular element in a Message.- Specified by:
getElement
in interfaceMessage
- Overrides:
getElement
in classAbstractMessage
- Parameters:
n
- Element Index.- Returns:
- single element of message.
-
setElement
public void setElement(int n, int v)
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.
-
getValueBool
public boolean getValueBool(int idx)
-
getValueString
public java.lang.String getValueString(int idx)
-
valueExists
public boolean valueExists(int idx)
-
getValueInt
public int getValueInt(int idx)
-
getValueDouble
public double getValueDouble(int idx)
-
skipPrefix
protected int skipPrefix(int index)
- Specified by:
skipPrefix
in classAbstractMRReply
-
maxSize
public int maxSize()
- Overrides:
maxSize
in classAbstractMRReply
-
getLength
public int getLength()
-
matches
protected boolean matches(java.lang.String pat)
-
match
protected static java.util.regex.Matcher match(java.lang.String s, java.lang.String pat, java.lang.String name)
-
getStationType
public java.lang.String getStationType()
-
getBuildString
public java.lang.String getBuildString()
-
getVersion
public java.lang.String getVersion()
-
getLocoIdInt
public int getLocoIdInt()
-
getSpeedByteInt
public int getSpeedByteInt()
-
getFunctionsInt
public int getFunctionsInt()
-
getFunctionsString
public java.lang.String getFunctionsString()
-
getRegisterString
public java.lang.String getRegisterString()
-
getRegisterInt
public int getRegisterInt()
-
getSpeedString
public java.lang.String getSpeedString()
-
getSpeedInt
public int getSpeedInt()
-
isEStop
public boolean isEStop()
-
getDirectionString
public java.lang.String getDirectionString()
-
getDirectionInt
public int getDirectionInt()
-
getDirectionBool
public boolean getDirectionBool()
-
getIsForward
public boolean getIsForward()
-
getTOIDString
public java.lang.String getTOIDString()
-
getTOIDInt
public int getTOIDInt()
-
getTOAddressString
public java.lang.String getTOAddressString()
-
getTOAddressInt
public int getTOAddressInt()
-
getTOAddressIndexString
public java.lang.String getTOAddressIndexString()
-
getTOAddressIndexInt
public int getTOAddressIndexInt()
-
getTOPinInt
public int getTOPinInt()
-
getTOThrownPositionInt
public int getTOThrownPositionInt()
-
getTOClosedPositionInt
public int getTOClosedPositionInt()
-
getTOProfileInt
public int getTOProfileInt()
-
getTOStateString
public java.lang.String getTOStateString()
-
getTOStateInt
public int getTOStateInt()
-
getTOIsThrown
public boolean getTOIsThrown()
-
getTOIsClosed
public boolean getTOIsClosed()
-
getCallbackNumString
public java.lang.String getCallbackNumString()
-
getCallbackNumInt
public int getCallbackNumInt()
-
getCallbackSubString
public java.lang.String getCallbackSubString()
-
getCallbackSubInt
public int getCallbackSubInt()
-
getCVString
public java.lang.String getCVString()
-
getCVInt
public int getCVInt()
-
getProgramBitString
public java.lang.String getProgramBitString()
-
getProgramBitInt
public int getProgramBitInt()
-
getReadValueString
public java.lang.String getReadValueString()
-
getReadValueInt
public int getReadValueInt()
-
getPowerDistrictName
public java.lang.String getPowerDistrictName()
-
getPowerDistrictStatus
public java.lang.String getPowerDistrictStatus()
-
getCurrentString
public java.lang.String getCurrentString()
-
getCurrentInt
public int getCurrentInt()
-
getMeterName
public java.lang.String getMeterName()
-
getMeterValue
public double getMeterValue()
-
getMeterType
public java.lang.String getMeterType()
-
getMeterUnit
public Meter.Unit getMeterUnit()
-
getMeterMinValue
public double getMeterMinValue()
-
getMeterMaxValue
public double getMeterMaxValue()
-
getMeterResolution
public double getMeterResolution()
-
getMeterWarnValue
public double getMeterWarnValue()
-
isMeterTypeVolt
public boolean isMeterTypeVolt()
-
isMeterTypeCurrent
public boolean isMeterTypeCurrent()
-
getPowerBool
public boolean getPowerBool()
-
getTurnoutDefNumString
public java.lang.String getTurnoutDefNumString()
-
getTurnoutDefNumInt
public int getTurnoutDefNumInt()
-
getTurnoutDefAddrString
public java.lang.String getTurnoutDefAddrString()
-
getTurnoutDefAddrInt
public int getTurnoutDefAddrInt()
-
getTurnoutDefSubAddrString
public java.lang.String getTurnoutDefSubAddrString()
-
getTurnoutDefSubAddrInt
public int getTurnoutDefSubAddrInt()
-
getOutputNumString
public java.lang.String getOutputNumString()
-
getOutputNumInt
public int getOutputNumInt()
-
getOutputListPinString
public java.lang.String getOutputListPinString()
-
getOutputListPinInt
public int getOutputListPinInt()
-
getOutputListIFlagString
public java.lang.String getOutputListIFlagString()
-
getOutputListIFlagInt
public int getOutputListIFlagInt()
-
getOutputListStateString
public java.lang.String getOutputListStateString()
-
getOutputListStateInt
public int getOutputListStateInt()
-
getOutputCmdStateBool
public boolean getOutputCmdStateBool()
-
getOutputCmdStateString
public java.lang.String getOutputCmdStateString()
-
getOutputCmdStateInt
public int getOutputCmdStateInt()
-
getOutputIsHigh
public boolean getOutputIsHigh()
-
getOutputIsLow
public boolean getOutputIsLow()
-
getSensorDefNumString
public java.lang.String getSensorDefNumString()
-
getSensorDefNumInt
public int getSensorDefNumInt()
-
getSensorDefPinString
public java.lang.String getSensorDefPinString()
-
getSensorDefPinInt
public int getSensorDefPinInt()
-
getSensorDefPullupString
public java.lang.String getSensorDefPullupString()
-
getSensorDefPullupInt
public int getSensorDefPullupInt()
-
getSensorDefPullupBool
public boolean getSensorDefPullupBool()
-
getSensorNumString
public java.lang.String getSensorNumString()
-
getSensorNumInt
public int getSensorNumInt()
-
getSensorStateString
public java.lang.String getSensorStateString()
-
getSensorStateInt
public int getSensorStateInt()
-
getSensorIsActive
public boolean getSensorIsActive()
-
getSensorIsInactive
public boolean getSensorIsInactive()
-
getCommTypeInt
public int getCommTypeInt()
-
getCommTypeValueString
public java.lang.String getCommTypeValueString()
-
getTurnoutIDList
public java.util.ArrayList<java.lang.Integer> getTurnoutIDList()
-
getTurnoutStateString
public java.lang.String getTurnoutStateString()
-
getTurnoutDescString
public java.lang.String getTurnoutDescString()
-
getClockMinutesString
public java.lang.String getClockMinutesString()
-
getClockMinutesInt
public int getClockMinutesInt()
-
getClockRateString
public java.lang.String getClockRateString()
-
getClockRateInt
public int getClockRateInt()
-
isLCDTextReply
public boolean isLCDTextReply()
-
getLCDTextString
public java.lang.String getLCDTextString()
-
getLCDDisplayNumString
public java.lang.String getLCDDisplayNumString()
-
getLCDDisplayNumInt
public int getLCDDisplayNumInt()
-
getLCDLineNumString
public java.lang.String getLCDLineNumString()
-
getLCDLineNumInt
public int getLCDLineNumInt()
-
isThrottleReply
public boolean isThrottleReply()
-
isTurnoutReply
public boolean isTurnoutReply()
-
isTurnoutCmdReply
public boolean isTurnoutCmdReply()
-
isProgramReply
public boolean isProgramReply()
-
isProgramReplyV4
public boolean isProgramReplyV4()
-
isProgramLocoIdReply
public boolean isProgramLocoIdReply()
-
isVerifyReply
public boolean isVerifyReply()
-
isProgramBitReply
public boolean isProgramBitReply()
-
isProgramBitReplyV4
public boolean isProgramBitReplyV4()
-
isPowerReply
public boolean isPowerReply()
-
isNamedPowerReply
public boolean isNamedPowerReply()
-
isMaxNumSlotsReply
public boolean isMaxNumSlotsReply()
-
isDiagReply
public boolean isDiagReply()
-
isCurrentReply
public boolean isCurrentReply()
-
isNamedCurrentReply
public boolean isNamedCurrentReply()
-
isMeterReply
public boolean isMeterReply()
-
isSensorReply
public boolean isSensorReply()
-
isSensorDefReply
public boolean isSensorDefReply()
-
isTurnoutDefReply
public boolean isTurnoutDefReply()
-
isTurnoutDefDCCReply
public boolean isTurnoutDefDCCReply()
-
isTurnoutDefServoReply
public boolean isTurnoutDefServoReply()
-
isTurnoutDefVpinReply
public boolean isTurnoutDefVpinReply()
-
isTurnoutDefLCNReply
public boolean isTurnoutDefLCNReply()
-
isMADCFailReply
public boolean isMADCFailReply()
-
isMADCSuccessReply
public boolean isMADCSuccessReply()
-
isStatusReply
public boolean isStatusReply()
-
isOutputReply
public boolean isOutputReply()
-
isOutputDefReply
public boolean isOutputDefReply()
-
isOutputCmdReply
public boolean isOutputCmdReply()
-
isCommTypeReply
public boolean isCommTypeReply()
-
isWriteEepromReply
public boolean isWriteEepromReply()
-
isLocoStateReply
public boolean isLocoStateReply()
-
isTurnoutIDsReply
public boolean isTurnoutIDsReply()
-
isTurnoutIDReply
public boolean isTurnoutIDReply()
-
isClockReply
public boolean isClockReply()
-
isTrackManagerReply
public boolean isTrackManagerReply()
-
isValidReplyFormat
public boolean isValidReplyFormat()
-
-