Class SRCPMessage

  • All Implemented Interfaces:
    Message

    public class SRCPMessage
    extends AbstractMRMessage
    Encodes a message to an SRCP server. The SRCPReply class handles the response from the command station. The SRCPReply class handles the response from the command station.
    • Method Detail

      • isKillMain

        public boolean isKillMain()
        Detrmine if the message turns off track power
        Returns:
        true if the messages is a track power off message,false otherwise
      • isEnableMain

        public boolean isEnableMain()
        Detrmine if the message turns on track power
        Returns:
        true if the messages is a track power on message,false otherwise
      • getProgMode

        public static SRCPMessage getProgMode​(int bus)
        Parameters:
        bus - a bus number
        Returns:
        an SRCPMessage to initialize programming on the given bus.
      • getExitProgMode

        public static SRCPMessage getExitProgMode​(int bus)
        Parameters:
        bus - a bus number
        Returns:
        an SRCPMessage to terminate programming on the given bus.
      • getReadDirectCV

        public static SRCPMessage getReadDirectCV​(int bus,
                                                  int cv)
        Parameters:
        bus - a bus number
        cv - the CV to read.
        Returns:
        an SRCPMessage to read the given CV in direct mode the given bus.
      • getConfirmDirectCV

        public static SRCPMessage getConfirmDirectCV​(int bus,
                                                     int cv,
                                                     int val)
        Parameters:
        bus - a bus number
        cv - the CV to read.
        val - a value for the CV.
        Returns:
        an SRCPMessage to check the given cv has the given val using the given bus.
      • getWriteDirectCV

        public static SRCPMessage getWriteDirectCV​(int bus,
                                                   int cv,
                                                   int val)
        Parameters:
        bus - a bus number
        cv - the CV to write.
        val - a value for the CV.
        Returns:
        an SRCPMessage to write the given value to the provided cv using the given bus.
      • getReadDirectBitCV

        public static SRCPMessage getReadDirectBitCV​(int bus,
                                                     int cv,
                                                     int bit)
        Parameters:
        bus - a bus number
        cv - the CV to read.
        bit - the bit to read.
        Returns:
        an SRCPMessage to read the given bit of the given CV uisng the provided bus.
      • getConfirmDirectBitCV

        public static SRCPMessage getConfirmDirectBitCV​(int bus,
                                                        int cv,
                                                        int bit,
                                                        int val)
        Parameters:
        bus - a bus number
        cv - the CV to read.
        bit - the bit to read.
        val - the value to check
        Returns:
        an SRCPMessage to verify the given bit of the given CV has the given val uisng the provided bus.
      • getWriteDirectBitCV

        public static SRCPMessage getWriteDirectBitCV​(int bus,
                                                      int cv,
                                                      int bit,
                                                      int val)
        Parameters:
        bus - a bus number
        cv - the CV to write.
        bit - the bit to write
        val - the value to write
        Returns:
        an SRCPMessage to write the given value to the given bit of the given CV uisng the provided bus.
      • getReadRegister

        public static SRCPMessage getReadRegister​(int bus,
                                                  int reg)
        Parameters:
        bus - a bus number
        reg - a register to read. Restricted to valuse less than 8.
        Returns:
        an SRCPMessage to read the provided register using the given bus.
        Throws:
        java.lang.IllegalArgumentException - if the register value is out of range.
      • getConfirmRegister

        public static SRCPMessage getConfirmRegister​(int bus,
                                                     int reg,
                                                     int val)
        Parameters:
        bus - a bus number
        reg - a register to read. Restricted to valuse less than 8.
        val - a value for the register
        Returns:
        an SRCPMessage to verify the provided register has the expected val using the given bus.
        Throws:
        java.lang.IllegalArgumentException - if the register value is out of range.
      • getWriteRegister

        public static SRCPMessage getWriteRegister​(int bus,
                                                   int reg,
                                                   int val)
        Parameters:
        bus - a bus number
        reg - a register to write. Restricted to valuse less than 8.
        val - a value for the register
        Returns:
        an SRCPMessage to write the given value to the provided register using the given bus.
        Throws:
        java.lang.IllegalArgumentException - if the register value is out of range.