Class 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 Detail

      • mInServiceMode

        boolean mInServiceMode
        Remember whether or not in service mode.
    • Method Detail

      • 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.
      • 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
      • 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
      • 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:
        sendPacket in interface CommandStation
        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:
        true if the operation succeeds, false otherwise.