Package jmri.jmrix.srcp
Class SRCPMessage
- java.lang.Object
-
- jmri.jmrix.AbstractMessage
-
- jmri.jmrix.AbstractMRMessage
-
- jmri.jmrix.srcp.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. TheSRCPReply
class handles the response from the command station.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static int
LONG_TIMEOUT
-
Fields inherited from class jmri.jmrix.AbstractMRMessage
SHORT_TIMEOUT
-
Fields inherited from class jmri.jmrix.AbstractMessage
_dataChars, _nDataChars
-
-
Constructor Summary
Constructors Constructor Description SRCPMessage()
SRCPMessage(int i)
SRCPMessage(java.lang.String m)
SRCPMessage(SRCPMessage m)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SRCPMessage
getConfirmDirectBitCV(int bus, int cv, int bit, int val)
static SRCPMessage
getConfirmDirectCV(int bus, int cv, int val)
static SRCPMessage
getConfirmRegister(int bus, int reg, int val)
static SRCPMessage
getEnableMain()
static SRCPMessage
getExitProgMode(int bus)
static SRCPMessage
getKillMain()
static SRCPMessage
getProgMode(int bus)
static SRCPMessage
getReadDirectBitCV(int bus, int cv, int bit)
static SRCPMessage
getReadDirectCV(int bus, int cv)
static SRCPMessage
getReadRegister(int bus, int reg)
static SRCPMessage
getWriteDirectBitCV(int bus, int cv, int bit, int val)
static SRCPMessage
getWriteDirectCV(int bus, int cv, int val)
static SRCPMessage
getWriteRegister(int bus, int reg, int val)
boolean
isEnableMain()
Detrmine if the message turns on track powerboolean
isKillMain()
Detrmine if the message turns off track power-
Methods inherited from class jmri.jmrix.AbstractMRMessage
addIntAsFourHex, addIntAsThree, addIntAsThreeHex, addIntAsTwoHex, getNeededMode, getOpCode, getOpCodeHex, getRetries, getTimeout, isBinary, replyExpected, setBinary, setNeededMode, setOpCode, setRetries, setTimeout, toString
-
Methods inherited from class jmri.jmrix.AbstractMessage
equals, getElement, getNumDataElements, hashCode, setElement
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jmri.jmrix.Message
toMonitorString
-
-
-
-
Field Detail
-
LONG_TIMEOUT
static final int LONG_TIMEOUT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SRCPMessage
public SRCPMessage()
-
SRCPMessage
public SRCPMessage(int i)
-
SRCPMessage
public SRCPMessage(SRCPMessage m)
-
SRCPMessage
public SRCPMessage(java.lang.String m)
-
-
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
-
getEnableMain
public static SRCPMessage getEnableMain()
- Returns:
- an SRCPMessage to turn the track power on
-
getKillMain
public static SRCPMessage getKillMain()
- Returns:
- an SRCPMessage to turn the track power off
-
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 numbercv
- 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 numbercv
- 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 numbercv
- 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 numbercv
- 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 numbercv
- 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 numbercv
- the CV to write.bit
- the bit to writeval
- 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 numberreg
- 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 numberreg
- 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 numberreg
- 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.
-
-