Package jmri.jmrix.dccpp
Class DCCppCommandStation
- java.lang.Object
-
- jmri.jmrix.dccpp.DCCppCommandStation
-
- All Implemented Interfaces:
CommandStation
public class DCCppCommandStation extends java.lang.Object implements CommandStation
Defines the standard/common routines used in multiple classes related to the DCC++ Command Station, on a DCC++ network.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) booleanmInServiceModeRemember whether or not in service mode.
-
Constructor Summary
Constructors Constructor Description DCCppCommandStation()DCCppCommandStation(DCCppSystemConnectionMemo memo)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetBuild()Get the Build of the connected Command Station it is populated by response from the CS, initially "Unknown"protected intgetCommandStationMaxNumSlots()static intgetDCCAddressHigh(int address)Get the Upper byte of a locomotive address from the decimal locomotive address.static intgetDCCAddressLow(int address)Get the Lower byte of a locomotive address from the decimal locomotive address.intgetRegisterAddress(int num)intgetRegisterNum(int addr)java.lang.StringgetStationType()Get the Station Type of the connected Command Station it is populated by response from the CS, initially "Unknown"DCCppSystemConnectionMemogetSystemConnectionMemo()java.lang.StringgetSystemPrefix()java.lang.StringgetTrackMode(int i)java.util.List<java.lang.String>getTrackModes()java.lang.StringgetUserName()java.lang.StringgetVersion()Get the canonical version of the connected Command Station it is populated by response from the CS, so initially '0.0.0'java.lang.StringgetVersionString()Provide the version string returned during the initial check.booleanisCurrentListSupported()Does this command station support the latest Current commands <JG>, <JI>, etc.?booleanisFunctionRefreshRequired()Does this command station require JMRI to send periodic function refresh packets?booleanisFunctionV4Supported()Can this command station handle the newer (V4) function message format?booleanisMaxNumSlotsMsgSupported()Can this command station handle the <#> request to get supported number of cabs(locos)?booleanisOpsModePossible()DCC++ command station does provide Ops Mode.booleanisProgramV4Supported()Can this command station handle the newer (V4) program message formats?booleanisReadStartValSupported()Can this command station handle the Read with a starting value ('V'erify)booleanisServoTurnoutCreationSupported()Can this command station handle the Servo and Vpin Turnout creation message formats?booleanisThrottleRegisterRequired()Does this command station need the throttle register to be sent?booleanisTurnoutIDsMessageRequired()Does this command station require the new "J" commands for turnout definitions?voidreleaseRegister(int addr)intrequestNewRegister(int addr)booleansendPacket(byte[] packet, int repeats)Send a specific packet to the rails.voidsetBuild(java.lang.String s)protected voidsetCommandStationInfo(DCCppReply l)Parse the DCC++ CS status response to pull out the base station version and software version.protected voidsetCommandStationMaxNumSlots(int newNumSlots)protected voidsetCommandStationMaxNumSlots(DCCppReply l)voidsetStationType(java.lang.String s)voidsetSystemConnectionMemo(DCCppSystemConnectionMemo memo)voidsetTrackMode(int i, java.lang.String mode)voidsetTrafficController(DCCppTrafficController tc)voidsetVersion(java.lang.String s)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jmri.CommandStation
sendAccSignalDecoderPkt, sendAltAccSignalDecoderPkt
-
-
-
-
Field Detail
-
mInServiceMode
boolean mInServiceMode
Remember whether or not in service mode.
-
-
Constructor Detail
-
DCCppCommandStation
public DCCppCommandStation()
-
DCCppCommandStation
public DCCppCommandStation(DCCppSystemConnectionMemo memo)
-
-
Method Detail
-
setStationType
public void setStationType(java.lang.String s)
-
getStationType
@Nonnull public java.lang.String getStationType()
Get the Station Type of the connected Command Station it is populated by response from the CS, initially "Unknown"- Returns:
- StationType
-
setBuild
public void setBuild(java.lang.String s)
-
getBuild
@Nonnull public java.lang.String getBuild()
Get the Build of the connected Command Station it is populated by response from the CS, initially "Unknown"- Returns:
- Build
-
setVersion
public void setVersion(java.lang.String s)
-
getVersion
@Nonnull public java.lang.String getVersion()
Get the canonical version of the connected Command Station it is populated by response from the CS, so initially '0.0.0'- Returns:
- Version
-
setCommandStationInfo
protected void setCommandStationInfo(DCCppReply l)
Parse the DCC++ CS status response to pull out the base station version and software version.- Parameters:
l- status response to query.
-
setCommandStationMaxNumSlots
protected void setCommandStationMaxNumSlots(DCCppReply l)
-
setCommandStationMaxNumSlots
protected void setCommandStationMaxNumSlots(int newNumSlots)
-
getCommandStationMaxNumSlots
protected int getCommandStationMaxNumSlots()
-
getVersionString
public java.lang.String getVersionString()
Provide the version string returned during the initial check.- Returns:
- version string.
-
isOpsModePossible
public boolean isOpsModePossible()
DCC++ command station does provide Ops Mode.- Returns:
- always true.
-
isFunctionRefreshRequired
public boolean isFunctionRefreshRequired()
Does this command station require JMRI to send periodic function refresh packets?- Returns:
- true if required, false if not
-
isCurrentListSupported
public boolean isCurrentListSupported()
Does this command station support the latest Current commands <JG>, <JI>, etc.?- Returns:
- true if supported, false if not
-
isReadStartValSupported
public boolean isReadStartValSupported()
Can this command station handle the Read with a starting value ('V'erify)- Returns:
- true if yes or false if no
-
isServoTurnoutCreationSupported
public boolean isServoTurnoutCreationSupported()
Can this command station handle the Servo and Vpin Turnout creation message formats?- Returns:
- true if yes or false if no
-
isTurnoutIDsMessageRequired
public boolean isTurnoutIDsMessageRequired()
Does this command station require the new "J" commands for turnout definitions?- Returns:
- true if yes or false if no
-
isThrottleRegisterRequired
public boolean isThrottleRegisterRequired()
Does this command station need the throttle register to be sent?- Returns:
- true if yes or false if no
-
isFunctionV4Supported
public boolean isFunctionV4Supported()
Can this command station handle the newer (V4) function message format?- Returns:
- true if yes or false if no
-
isProgramV4Supported
public boolean isProgramV4Supported()
Can this command station handle the newer (V4) program message formats?- Returns:
- true if yes or false if no
-
isMaxNumSlotsMsgSupported
public boolean isMaxNumSlotsMsgSupported()
Can this command station handle the <#> request to get supported number of cabs(locos)?- Returns:
- true if yes or false if no
-
getDCCAddressLow
public static int getDCCAddressLow(int address)
Get the Lower byte of a locomotive address from the decimal locomotive address.- Parameters:
address- loco address.- Returns:
- loco address byte lo.
-
getDCCAddressHigh
public static int getDCCAddressHigh(int address)
Get the Upper byte of a locomotive address from the decimal locomotive address.- Parameters:
address- loco address.- Returns:
- high byte of address.
-
sendPacket
public boolean sendPacket(@Nonnull byte[] packet, int repeats)
Send a specific packet to the rails.- Specified by:
sendPacketin interfaceCommandStation- Parameters:
packet- Byte array representing the packet, including the error-correction byte. Must not be null.repeats- Number of times to repeat the transmission.- Returns:
trueif the operation succeeds,falseotherwise.
-
setTrafficController
public void setTrafficController(DCCppTrafficController tc)
-
setSystemConnectionMemo
public void setSystemConnectionMemo(DCCppSystemConnectionMemo memo)
-
getSystemConnectionMemo
public DCCppSystemConnectionMemo getSystemConnectionMemo()
-
getUserName
public java.lang.String getUserName()
- Specified by:
getUserNamein interfaceCommandStation
-
getSystemPrefix
@Nonnull public java.lang.String getSystemPrefix()
- Specified by:
getSystemPrefixin interfaceCommandStation
-
requestNewRegister
public int requestNewRegister(int addr)
-
releaseRegister
public void releaseRegister(int addr)
-
getRegisterNum
public int getRegisterNum(int addr)
-
getRegisterAddress
public int getRegisterAddress(int num)
-
setTrackMode
public void setTrackMode(int i, java.lang.String mode)
-
getTrackModes
public java.util.List<java.lang.String> getTrackModes()
-
getTrackMode
public java.lang.String getTrackMode(int i)
-
-