Package jmri.jmrix.roco.z21
Class Z21XNetMessage
java.lang.Object
jmri.jmrix.AbstractMessage
jmri.jmrix.AbstractMRMessage
jmri.jmrix.lenz.XNetMessage
jmri.jmrix.roco.z21.Z21XNetMessage
- All Implemented Interfaces:
Serializable,Message
Represents a single command or response on the XpressNet.
Content is represented with ints to avoid the problems with sign-extension that bytes have, and because a Java char is actually a variable number of bytes in Unicode.
- See Also:
-
Field Summary
Fields inherited from class jmri.jmrix.lenz.XNetMessage
XNetProgrammingTimeoutFields inherited from class jmri.jmrix.AbstractMRMessage
LONG_TIMEOUT, SHORT_TIMEOUTFields inherited from class jmri.jmrix.AbstractMessage
_dataChars, _nDataChars -
Constructor Summary
ConstructorsConstructorDescriptionZ21XNetMessage(int len) Constructor, just pass on to the superclass.Create an XNetMessage from a String containing bytes.Constructor from a Z21Message.Z21XNetMessage(Z21XNetMessage message) Create a new object, that is a copy of an existing message.Z21XNetMessage(Z21XNetReply message) Create an Z21XNetMessage from an Z21XNetReply. -
Method Summary
Modifier and TypeMethodDescriptionstatic XNetMessagegetZ21LanXSetLocoDriveMsg(int address, SpeedStepMode speedMode, float speed, boolean isForward) Generate a Z21 message to change the speed/direction of a locomotive.static Z21XNetMessagegetZ21LocomotiveFunctionOperationMsg(int address, int functionno, boolean state) Given a locomotive address, a function number, and its value, generate a message to change the state.static Z21XNetMessagegetZ21LocomotiveInfoRequestMsg(int address) Given a locomotive address, request its status.static Z21XNetMessagegetZ21ReadDirectCVMsg(int cv) Create messages of a particular form.static Z21XNetMessagegetZ21SetTurnoutRequestMessage(int address, boolean thrown, boolean active, boolean queue) Given a turnout address and whether or not it is thrown, generate a message to operate the turnout.static Z21XNetMessagegetZ21TurnoutInfoRequestMessage(int address) Given a turnout address, generate a message to request the state.static Z21XNetMessagegetZ21WriteDirectCVMsg(int cv, int val) Generate text translations of messages for use in the XpressNet monitor.Methods inherited from class jmri.jmrix.lenz.XNetMessage
checkParity, getAddLocoToConsistMsg, getAddressedEmergencyStop, getBitVerifyOpsModeCVMsg, getBitWriteOpsModeCVMsg, getBuildDoubleHeaderMsg, getCSAutoStartMessage, getCSStatusRequestMessage, getCSVersionRequestMessage, getDBSearchMsgConsistAddress, getDBSearchMsgNextMULoco, getDeleteAddressOnStackMsg, getDisolveDoubleHeaderMsg, getElementBCD, getEmergencyOffMsg, getEmergencyStopMsg, getExitProgModeMsg, getFeedbackRequestMsg, getFunctionGroup10OpsMsg, getFunctionGroup10SetMomMsg, getFunctionGroup1OpsMsg, getFunctionGroup1SetMomMsg, getFunctionGroup2OpsMsg, getFunctionGroup2SetMomMsg, getFunctionGroup3OpsMsg, getFunctionGroup3SetMomMsg, getFunctionGroup4OpsMsg, getFunctionGroup4SetMomMsg, getFunctionGroup5OpsMsg, getFunctionGroup5SetMomMsg, getFunctionGroup6OpsMsg, getFunctionGroup6SetMomMsg, getFunctionGroup7OpsMsg, getFunctionGroup7SetMomMsg, getFunctionGroup8OpsMsg, getFunctionGroup8SetMomMsg, getFunctionGroup9OpsMsg, getFunctionGroup9SetMomMsg, getLIAddressRequestMsg, getLISpeedRequestMsg, getLIVersionRequestMessage, getLocomotiveFunctionHighMomStatusMsg, getLocomotiveFunctionHighOnStatusMsg, getLocomotiveFunctionStatusMsg, getLocomotiveInfoRequestMsg, getNextAddressOnStackMsg, getNMRAXNetMsg, getOpCode, getOpCodeHex, getOpsModeResultsMsg, getReadDirectCVMsg, getReadPagedCVMsg, getReadRegisterMsg, getRemoveLocoFromConsistMsg, getResumeOperationsMsg, getServiceModeResultsMsg, getSpeedAndDirectionMsg, getTurnoutCommandMsg, getVerifyOpsModeCVMsg, getWriteDirectCVMsg, getWriteOpsModeCVMsg, getWritePagedCVMsg, getWriteRegisterMsg, length, replyExpected, setBroadcastReply, setOpCode, setParity, setXNetMessageRetries, setXNetMessageTimeoutMethods inherited from class jmri.jmrix.AbstractMRMessage
addIntAsFourHex, addIntAsThree, addIntAsThreeHex, addIntAsTwoHex, getNeededMode, getRetries, getTimeout, isBinary, setBinary, setNeededMode, setRetries, setTimeout, toStringMethods inherited from class jmri.jmrix.AbstractMessage
equals, getElement, getNumDataElements, hashCode, setElement
-
Constructor Details
-
Z21XNetMessage
Constructor, just pass on to the superclass.- Parameters:
len- message length.
-
Z21XNetMessage
Constructor from a Z21Message.- Parameters:
m- the Z21Message.
-
Z21XNetMessage
Create a new object, that is a copy of an existing message.- Parameters:
message- an existing Z21XpressNet message
-
Z21XNetMessage
Create an Z21XNetMessage from an Z21XNetReply.- Parameters:
message- the existing Z21XNetReply.
-
Z21XNetMessage
Create an XNetMessage from a String containing bytes.- Parameters:
s- byte string.
-
-
Method Details
-
toMonitorString
Description copied from class:XNetMessageGenerate text translations of messages for use in the XpressNet monitor.- Specified by:
toMonitorStringin interfaceMessage- Overrides:
toMonitorStringin classXNetMessage- Returns:
- representation of the XNetMessage as a string.
-
getZ21ReadDirectCVMsg
Create messages of a particular form.- Parameters:
cv- CV index- Returns:
- message to send.
-
getZ21WriteDirectCVMsg
-
getZ21LocomotiveInfoRequestMsg
Given a locomotive address, request its status.- Parameters:
address- is the locomotive address- Returns:
- message to send.
-
getZ21LocomotiveFunctionOperationMsg
public static Z21XNetMessage getZ21LocomotiveFunctionOperationMsg(int address, int functionno, boolean state) Given a locomotive address, a function number, and its value, generate a message to change the state.- Parameters:
address- is the locomotive addressfunctionno- is the function to changestate- is boolean representing whether the function is to be on or off- Returns:
- message to send.
-
getZ21LanXSetLocoDriveMsg
public static XNetMessage getZ21LanXSetLocoDriveMsg(int address, SpeedStepMode speedMode, float speed, boolean isForward) Generate a Z21 message to change the speed/direction of a locomotive.- Parameters:
address- the locomotive addressspeedMode- the speedstep mode see @jmri.DccThrottle for possible values.speed- a normalized speed value (a floating point number between 0 and 1). A negative value indicates emergency stop.isForward- true for forward, false for reverse.- Returns:
- message to send.
-
getZ21TurnoutInfoRequestMessage
Given a turnout address, generate a message to request the state.- Parameters:
address- the turnout address- Returns:
- message to send.
-
getZ21SetTurnoutRequestMessage
public static Z21XNetMessage getZ21SetTurnoutRequestMessage(int address, boolean thrown, boolean active, boolean queue) Given a turnout address and whether or not it is thrown, generate a message to operate the turnout.- Parameters:
address- is the turnout addressthrown- boolean value representing whether the turnout is thrown.active- boolean value representing whether the output is being set to active.queue- boolean value representing whehter or not the message is added to the queue.- Returns:
- message to send.
-