Class DCCppMessage
- All Implemented Interfaces:
Comparable<Delayed>,Delayed,Message
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.
-
Field Summary
FieldsFields inherited from class jmri.jmrix.AbstractMRMessage
LONG_TIMEOUT, SHORT_TIMEOUTFields inherited from class jmri.jmrix.AbstractMessage
_dataChars, _nDataChars -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDCCppMessage(char c) protectedDCCppMessage(char c, String regex) DCCppMessage(int len) Create a new object, representing a specific-length message.Create a DCCppMessage from a String containing bytes.DCCppMessage(DCCppMessage message) Create a new object, that is a copy of an existing message.DCCppMessage(DCCppReply message) Create an DCCppMessage from an DCCppReply. -
Method Summary
Modifier and TypeMethodDescriptionintComparing two queued message for refreshing the function calls, based on their expected execution time.voiddelayFor(long millis) Before adding the message to the delay queue call this method to set when the message should be repeated.booleanThis implementation of equals is targeted to the background function refreshing in SerialDCCppPacketizer.intintintintintintintintintintintgetCVInt()longFrom theDelayedinterface, how long this message still has until it should be executed.intintgetElement(int n) Get a particular element in a Message.intintintintGet the number of data elements in a Message.intcharintintintintintintintbooleanintintintintintintbooleanintintintintintintintintintintbooleangetValueBool(int idx) intgetValueInt(int idx) getValueString(int idx) inthashCode()Hash code from base data.booleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanReturns true if this DCCppMessage is properly formatted (or will generate a properly formatted command when converted to String).booleanintlength()static DCCppMessagemakeAccessoryDecoderMsg(int address, boolean activate) static DCCppMessagemakeAccessoryDecoderMsg(int address, int subaddress, boolean activate) Stationary Decoder Message.static DCCppMessagemakeAddressedEmergencyStop(int address) Generate an emergency stop for the specified address.static DCCppMessagemakeAddressedEmergencyStop(int register, int address) Generate an emergency stop for the specified address.static DCCppMessagemakeAutomationIDMsg(int id) static DCCppMessagestatic DCCppMessagemakeBitWriteDirectCVMsg(int cv, int bit, int val) Write Direct CV Bit to Programming Track.static DCCppMessagemakeBitWriteDirectCVMsg(int cv, int bit, int val, int callbacknum, int callbacksub) static DCCppMessagemakeBitWriteDirectCVMsgV4(int cv, int bit, int val) static DCCppMessagemakeBitWriteOpsModeCVMsg(int address, int cv, int bit, int val) Write Direct CV Bit to Main Track.static DCCppMessagestatic DCCppMessagemakeClockSetMsg(int minutes) static DCCppMessagemakeClockSetMsg(int minutes, int rate) static DCCppMessageGet number of supported slots for this DCC++ Base Station Statusstatic DCCppMessageRead DCC++ Base Station Statusstatic DCCppMessagestatic DCCppMessagestatic DCCppMessageGenerate an emergency stop for all locos in reminder table.static DCCppMessagemakeForgetCabMessage(int cab) Generate a "Forget Cab" message '-'static DCCppMessagemakeFunctionGroup1OpsMsg(int address, boolean f0, boolean f1, boolean f2, boolean f3, boolean f4) Generate a Function Group One Operation Request message.static DCCppMessagemakeFunctionGroup1SetMomMsg(int address, boolean f0, boolean f1, boolean f2, boolean f3, boolean f4) Generate a Function Group One Set Momentary Functions message.static DCCppMessagemakeFunctionGroup2OpsMsg(int address, boolean f5, boolean f6, boolean f7, boolean f8) Generate a Function Group Two Operation Request message.static DCCppMessagemakeFunctionGroup2SetMomMsg(int address, boolean f5, boolean f6, boolean f7, boolean f8) Generate a Function Group Two Set Momentary Functions message.static DCCppMessagemakeFunctionGroup3OpsMsg(int address, boolean f9, boolean f10, boolean f11, boolean f12) Generate a Function Group Three Operation Request message.static DCCppMessagemakeFunctionGroup3SetMomMsg(int address, boolean f9, boolean f10, boolean f11, boolean f12) Generate a Function Group Three Set Momentary Functions message.static DCCppMessagemakeFunctionGroup4OpsMsg(int address, boolean f13, boolean f14, boolean f15, boolean f16, boolean f17, boolean f18, boolean f19, boolean f20) Generate a Function Group Four Operation Request message.static DCCppMessagemakeFunctionGroup4SetMomMsg(int address, boolean f13, boolean f14, boolean f15, boolean f16, boolean f17, boolean f18, boolean f19, boolean f20) Generate a Function Group Four Set Momentary Function message.static DCCppMessagemakeFunctionGroup5OpsMsg(int address, boolean f21, boolean f22, boolean f23, boolean f24, boolean f25, boolean f26, boolean f27, boolean f28) Generate a Function Group Five Operation Request message.static DCCppMessagemakeFunctionGroup5SetMomMsg(int address, boolean f21, boolean f22, boolean f23, boolean f24, boolean f25, boolean f26, boolean f27, boolean f28) Generate a Function Group Five Set Momentary Function message.static DCCppMessagemakeFunctionV4Message(int cab, int func, boolean state) Generate a function message using the V4 'F' syntax supported by DCC-EXstatic DCCppMessageRequest LCD Messages used for Virtual LCD Displaystatic DCCppMessagestatic DCCppMessagemakeMessage(String msg) static DCCppMessagemakeOutputAddMsg(int id, int pin, int iflag) static DCCppMessagemakeOutputCmdMsg(int id, boolean state) static DCCppMessagemakeOutputDeleteMsg(int id) static DCCppMessagestatic DCCppMessageQuery All Sensors States.static DCCppMessagemakeReadDirectCVMsg(int cv) Read Direct CV Byte from Programming Track.static DCCppMessagemakeReadDirectCVMsg(int cv, int callbacknum, int callbacksub) static DCCppMessageRead main operations track currentstatic DCCppMessagemakeRosterIDMsg(int id) static DCCppMessagestatic DCCppMessagemakeSensorAddMsg(int id, int pin, int pullup) Create/Delete/Query Sensor.static DCCppMessagemakeSensorDeleteMsg(int id) static DCCppMessagestatic DCCppMessagemakeSetTrackPowerMsg(boolean on) Set Track Power ON or OFF.static DCCppMessagemakeSpeedAndDirectionMsg(int address, float speed, boolean isForward) Generate a Speed and Direction Request messagestatic DCCppMessagemakeSpeedAndDirectionMsg(int register, int address, float speed, boolean isForward) Generate a Speed and Direction Request messagestatic DCCppMessagestatic DCCppMessagestatic DCCppMessagestatic DCCppMessagemakeTurnoutAddMsg(int id, int addr, int subaddr) static DCCppMessagemakeTurnoutCommandMsg(int id, boolean thrown) Predefined Turnout Control Message.static DCCppMessagemakeTurnoutDeleteMsg(int id) static DCCppMessagemakeTurnoutIDMsg(int id) static DCCppMessagestatic DCCppMessagemakeTurnoutImplMsg(int id) static DCCppMessagestatic DCCppMessagemakeVerifyCVMsg(int cv, int startVal) Verify Direct CV Byte from Programming Track.static DCCppMessagemakeWriteDCCPacketMainMsg(int register, int numBytes, byte[] bytes) Write DCC Packet to a specified Register on the Main.static DCCppMessagemakeWriteDCCPacketProgMsg(int register, int numBytes, byte[] bytes) Write DCC Packet to a specified Register on the Programming Track.static DCCppMessagemakeWriteDirectCVMsg(int cv, int val) Write Direct CV Byte to Programming Trackstatic DCCppMessagemakeWriteDirectCVMsg(int cv, int val, int callbacknum, int callbacksub) static DCCppMessagemakeWriteDirectCVMsgV4(int cv, int val) static DCCppMessagemakeWriteOpsModeCVMsg(int address, int cv, int val) Write Direct CV Byte to Main TrackbooleanIs a reply expected to this message?static voidsetDCCppMessageRetries(int t) Change the default number of retries for an DCC++ message.static voidsetDCCppMessageTimeout(int t) Change the default timeout for a DCC++ message.voidsetElement(int n, int v) Set a single Data Element at a particular index.voidsetOpCode(int i) Generate text translations of messages for use in the DCCpp monitor.toString()Converts DCCppMessage to String format (without the<>brackets)Methods inherited from class jmri.jmrix.AbstractMRMessage
addIntAsFourHex, addIntAsThree, addIntAsThreeHex, addIntAsTwoHex, getNeededMode, getOpCodeHex, getRetries, getTimeout, isBinary, setBinary, setNeededMode, setRetries, setTimeout
-
Field Details
-
DCCppProgrammingTimeout
- See Also:
-
-
Constructor Details
-
DCCppMessage
Create a new object, representing a specific-length message.- Parameters:
len- Total bytes in message, including opcode and error-detection byte.
-
DCCppMessage
Create a new object, that is a copy of an existing message.- Parameters:
message- existing message.
-
DCCppMessage
Create an DCCppMessage from an DCCppReply. Not used. Really, not even possible. Consider removing.- Parameters:
message- existing reply to replicate.
-
DCCppMessage
Create a DCCppMessage from a String containing bytes.Since DCCppMessages are text, there is no Hex-to-byte conversion.
NOTE 15-Feb-17: un-Deprecating this function so that it can be used in the DCCppOverTCP server/client interface. Messages shouldn't be parsed, they are already in DCC++ format, so we need the string constructor to generate a DCCppMessage from the incoming byte stream.
- Parameters:
s- message in string form.
-
DCCppMessage
-
DCCppMessage
-
-
Method Details
-
toString
Converts DCCppMessage to String format (without the<>brackets)- Specified by:
toStringin interfaceMessage- Overrides:
toStringin classAbstractMRMessage- Returns:
- String form of message.
-
toMonitorString
Generate text translations of messages for use in the DCCpp monitor.- Specified by:
toMonitorStringin interfaceMessage- Returns:
- representation of the DCCpp as a string.
-
getNumDataElements
Description copied from class:AbstractMessageGet the number of data elements in a Message.- Specified by:
getNumDataElementsin interfaceMessage- Overrides:
getNumDataElementsin classAbstractMessage- Returns:
- number elements.
-
getElement
Description copied from class:AbstractMessageGet a particular element in a Message.- Specified by:
getElementin interfaceMessage- Overrides:
getElementin classAbstractMessage- Parameters:
n- Element Index.- Returns:
- single element of message.
-
setElement
Description copied from class:AbstractMessageSet a single Data Element at a particular index.- Specified by:
setElementin interfaceMessage- Overrides:
setElementin classAbstractMessage- Parameters:
n- index of element.v- value of element.
-
setOpCode
- Overrides:
setOpCodein classAbstractMRMessage
-
getOpCode
- Overrides:
getOpCodein classAbstractMRMessage
-
getOpCodeChar
-
getValueString
-
getValueInt
-
getValueBool
-
length
- Returns:
- the message length
-
setDCCppMessageRetries
Change the default number of retries for an DCC++ message.- Parameters:
t- number of retries to attempt
-
setDCCppMessageTimeout
Change the default timeout for a DCC++ message.- Parameters:
t- Timeout in milliseconds
-
isValidMessageFormat
Returns true if this DCCppMessage is properly formatted (or will generate a properly formatted command when converted to String).- Returns:
- boolean true/false
-
isThrottleMessage
-
isThrottleV3Message
-
isAccessoryMessage
-
isFunctionMessage
-
isFunctionV4Message
-
isForgetCabMessage
-
isTurnoutMessage
-
isSensorMessage
-
isEEPROMWriteMessage
-
isEEPROMClearMessage
-
isOpsWriteByteMessage
-
isOpsWriteBitMessage
-
isProgWriteByteMessage
-
isProgWriteByteMessageV4
-
isProgWriteBitMessage
-
isProgWriteBitMessageV4
-
isProgReadCVMessage
-
isProgReadCVMessageV4
-
isProgReadLocoIdMessage
-
isProgVerifyMessage
-
isTurnoutCmdMessage
-
isTurnoutAddMessage
-
isTurnoutAddDCCMessage
-
isTurnoutAddServoMessage
-
isTurnoutAddVpinMessage
-
isTurnoutDeleteMessage
-
isListTurnoutsMessage
-
isSensorAddMessage
-
isSensorDeleteMessage
-
isListSensorsMessage
-
isOutputCmdMessage
-
isOutputAddMessage
-
isOutputDeleteMessage
-
isListOutputsMessage
-
isQuerySensorStatesMessage
-
isWriteDccPacketMessage
-
isTurnoutIDsMessage
-
isTurnoutIDMessage
-
isRosterIDsMessage
-
isRosterIDMessage
-
isAutomationIDsMessage
-
isAutomationIDMessage
-
isCurrentMaxesMessage
-
isCurrentValuesMessage
-
isClockRequestTimeMessage
-
isClockSetTimeMessage
-
isTrackManagerRequestMessage
-
isTurnoutImplementationMessage
-
getOutputIDString
-
getOutputIDInt
-
getOutputPinString
-
getOutputPinInt
-
getOutputIFlagString
-
getOutputIFlagInt
-
getOutputStateString
-
getOutputStateInt
-
getOutputStateBool
-
getSensorIDString
-
getSensorIDInt
-
getSensorPinString
-
getSensorPinInt
-
getSensorPullupString
-
getSensorPullupInt
-
getSensorPullupBool
-
getAccessoryAddrString
-
getAccessoryAddrInt
-
getAccessorySubString
-
getAccessorySubInt
-
getAccessoryStateString
-
getAccessoryStateInt
-
getRegisterString
-
getRegisterInt
-
getAddressString
-
getAddressInt
-
getSpeedString
-
getSpeedInt
-
getDirectionString
-
getDirectionInt
-
getFuncAddressString
-
getFuncAddressInt
-
getFuncByte1String
-
getFuncByte1Int
-
getFuncByte2String
-
getFuncByte2Int
-
getFuncV4CabString
-
getFuncV4FuncString
-
getFuncV4StateString
-
getForgetCabString
-
getTOIDString
-
getTOIDInt
-
getTOStateString
-
getTOStateInt
-
getTOAddressString
-
getTOAddressInt
-
getTOSubAddressString
-
getTOSubAddressInt
-
getTOThrownPositionInt
-
getTOClosedPositionInt
-
getTOProfileInt
-
getTOPinInt
-
getRosterIDString
-
getRosterIDInt
-
getAutomationIDString
-
getAutomationIDInt
-
getClockMinutesString
-
getClockMinutesInt
-
getClockRateString
-
getClockRateInt
-
getOpsWriteAddrString
-
getOpsWriteAddrInt
-
getOpsWriteCVString
-
getOpsWriteCVInt
-
getOpsWriteBitString
-
getOpsWriteBitInt
-
getOpsWriteValueString
-
getOpsWriteValueInt
-
getCVString
-
getCVInt
-
getCallbackNumString
-
getCallbackNumInt
-
getCallbackSubString
-
getCallbackSubInt
-
getProgValueString
-
getProgValueInt
-
getBitString
-
getBitInt
-
getPacketString
-
replyExpected
Description copied from class:AbstractMRMessageIs a reply expected to this message?By default, a reply is expected to every message; either a reply or a timeout is needed before the next message can be sent.
If this returns false, the transmit queue will immediately go on to transmit the next message (if any).
- Overrides:
replyExpectedin classAbstractMRMessage- Returns:
- true by default in Abstract MR message.
-
makeAccessoryDecoderMsg
Stationary Decoder Message.Note that many decoders and controllers combine the ADDRESS and SUBADDRESS into a single number, N, from 1 through a max of 2044, where
N = (ADDRESS - 1) * 4 + SUBADDRESS + 1, for all ADDRESS>0OR
ADDRESS = INT((N - 1) / 4) + 1SUBADDRESS = (N - 1) % 4- Parameters:
address- the primary address of the decoder (0-511).subaddress- the subaddress of the decoder (0-3).activate- true on, false off.- Returns:
- accessory decoder message.
-
makeAccessoryDecoderMsg
-
makeTurnoutCommandMsg
Predefined Turnout Control Message.- Parameters:
id- the numeric ID (0-32767) of the turnout to control.thrown- true thrown, false closed.- Returns:
- message to set turnout.
-
makeOutputCmdMsg
-
makeOutputAddMsg
-
makeOutputDeleteMsg
-
makeOutputListMsg
-
makeTurnoutAddMsg
-
makeTurnoutDeleteMsg
-
makeTurnoutListMsg
-
makeTurnoutIDsMsg
-
makeTurnoutIDMsg
-
makeTurnoutImplMsg
-
makeRosterIDsMsg
-
makeRosterIDMsg
-
makeAutomationIDsMsg
-
makeAutomationIDMsg
-
makeCurrentMaxesMsg
-
makeCurrentValuesMsg
-
makeClockRequestTimeMsg
-
makeClockSetMsg
-
makeClockSetMsg
-
makeTrackManagerRequestMsg
-
makeMessage
-
makeSensorAddMsg
Create/Delete/Query Sensor.sensor, or
<X>if no sensors defined.- Parameters:
id- pin pullup (0-32767).pin- Arduino pin index of sensor.pullup- true if use internal pullup for PIN, false if not.- Returns:
- message to create the sensor.
-
makeSensorDeleteMsg
-
makeSensorListMsg
-
makeQuerySensorStatesMsg
Query All Sensors States.- Returns:
- message to query all sensor states.
-
makeWriteDirectCVMsg
Write Direct CV Byte to Programming TrackFormat:
<W CV VALUE CALLBACKNUM CALLBACKSUB>CV: the number of the Configuration Variable memory location in the decoder to write to (1-1024) VALUE: the value to be written to the Configuration Variable memory location (0-255) CALLBACKNUM: an arbitrary integer (0-32767) that is ignored by the Base Station and is simply echoed back in the output - useful for external programs that call this function CALLBACKSUB: a second arbitrary integer (0-32767) that is ignored by the Base Station and is simply echoed back in the output - useful for external programs (e.g. DCC++ Interface) that call this function
Note: The two-argument form embeds the opcode in CALLBACKSUB to aid in decoding the responses.
returns:
<r CALLBACKNUM|CALLBACKSUB|CV Value)where VALUE is a number from 0-255 as read from the requested CV, or -1 if verification read fails- Parameters:
cv- CV index, 1-1024.val- new CV value, 0-255.- Returns:
- message to write Direct CV.
-
makeWriteDirectCVMsg
-
makeWriteDirectCVMsgV4
-
makeBitWriteDirectCVMsg
Write Direct CV Bit to Programming Track.Format:
<B CV BIT VALUE CALLBACKNUM CALLBACKSUB>writes, and then verifies, a single bit within a Configuration Variable to the decoder of an engine on the programming track
CV: the number of the Configuration Variable memory location in the decoder to write to (1-1024) BIT: the bit number of the Configurarion Variable memory location to write (0-7) VALUE: the value of the bit to be written (0-1) CALLBACKNUM: an arbitrary integer (0-32767) that is ignored by the Base Station and is simply echoed back in the output - useful for external programs that call this function CALLBACKSUB: a second arbitrary integer (0-32767) that is ignored by the Base Station and is simply echoed back in the output - useful for external programs (e.g. DCC++ Interface) that call this function
Note: The two-argument form embeds the opcode in CALLBACKSUB to aid in decoding the responses.
returns:
<r CALLBACKNUM|CALLBACKSUB|CV BIT VALUE)where VALUE is a number from 0-1 as read from the requested CV bit, or -1 if verification read fails- Parameters:
cv- CV index, 1-1024.bit- bit index, 0-7val- bit value, 0-1.- Returns:
- message to write direct CV bit.
-
makeBitWriteDirectCVMsg
public static DCCppMessage makeBitWriteDirectCVMsg(int cv, int bit, int val, int callbacknum, int callbacksub) -
makeBitWriteDirectCVMsgV4
-
makeReadDirectCVMsg
Read Direct CV Byte from Programming Track.Format:
<R CV CALLBACKNUM CALLBACKSUB>reads a Configuration Variable from the decoder of an engine on the programming track
CV: the number of the Configuration Variable memory location in the decoder to read from (1-1024) CALLBACKNUM: an arbitrary integer (0-32767) that is ignored by the Base Station and is simply echoed back in the output - useful for external programs that call this function CALLBACKSUB: a second arbitrary integer (0-32767) that is ignored by the Base Station and is simply echoed back in the output - useful for external programs (e.g. DCC++ Interface) that call this function
Note: The two-argument form embeds the opcode in CALLBACKSUB to aid in decoding the responses.
returns:
<r CALLBACKNUM|CALLBACKSUB|CV VALUE>where VALUE is a number from 0-255 as read from the requested CV, or -1 if read could not be verified- Parameters:
cv- CV index.- Returns:
- message to send read direct CV.
-
makeReadDirectCVMsg
-
makeVerifyCVMsg
Verify Direct CV Byte from Programming Track.Format:
<V CV STARTVAL>Verifies a Configuration Variable from the decoder of an engine on the programming track. Returns the current value of that CV. Used as faster replacement for 'R'eadCV command
CV: the number of the Configuration Variable memory location in the decoder to read from (1-1024) STARTVAL: a "guess" as to the current value of the CV. DCC-EX will try this value first, then read and return the current value if different
returns:
<v CV VALUE>where VALUE is a number from 0-255 as read from the requested CV, -1 if read could not be performed- Parameters:
cv- CV index.startVal- "guess" as to current value- Returns:
- message to send verify direct CV.
-
makeWriteOpsModeCVMsg
Write Direct CV Byte to Main TrackFormat:
<w CAB CV VALUE>Writes, without any verification, a Configuration Variable to the decoder of an engine on the main operations track.
- Parameters:
address- the short (1-127) or long (128-10293) address of the engine decoder.cv- the number of the Configuration Variable memory location in the decoder to write to (1-1024).val- the value to be written to the Configuration Variable memory location (0-255).- Returns:
- message to Write CV in Ops Mode.
-
makeBitWriteOpsModeCVMsg
Write Direct CV Bit to Main Track.Format:
<b CAB CV BIT VALUE>writes, without any verification, a single bit within a Configuration Variable to the decoder of an engine on the main operations track
CAB: the short (1-127) or long (128-10293) address of the engine decoder CV: the number of the Configuration Variable memory location in the decoder to write to (1-1024) BIT: the bit number of the Configuration Variable register to write (0-7) VALUE: the value of the bit to be written (0-1)
returns: NONE
- Parameters:
address- loco cab address.cv- CV index, 1-1024.bit- bit index, 0-7.val- bit value, 0 or 1.- Returns:
- message to write direct CV bit to main track.
-
makeSetTrackPowerMsg
Set Track Power ON or OFF.Format:
<1> (ON) or <0> (OFF)- Parameters:
on- true on, false off.- Returns:
- message to send track power on or off.
-
makeTrackPowerOnMsg
-
makeTrackPowerOffMsg
-
makeReadTrackCurrentMsg
Read main operations track currentFormat:
<c>reads current being drawn on main operations track- Returns:
- (for DCC-EX), 1 or more of
<c MeterName value C/V unit min max res warn>where name and settings are used to define arbitrary meters on the DCC-EX side AND<a CURRENT>where CURRENT = 0-1024, based on exponentially-smoothed weighting scheme
-
makeCSStatusMsg
Read DCC++ Base Station StatusFormat:
<s>returns status messages containing track power status, throttle status, turn-out status, and a version number NOTE: this is very useful as a first command for an interface to send to this sketch in order to verify connectivity and update any GUI to reflect actual throttle and turn-out settings
- Returns:
- series of status messages that can be read by an interface to determine status of DCC++ Base Station and important settings
-
makeCSMaxNumSlotsMsg
Get number of supported slots for this DCC++ Base Station StatusFormat:
<N>returns number of slots NOTE: this is not implemented in older versions which then do not return anything at all
- Returns:
- status message with to get number of slots.
-
makeFunctionV4Message
Generate a function message using the V4 'F' syntax supported by DCC-EX- Parameters:
cab- cab address to send function tofunc- function number to setstate- new state of function 0/1- Returns:
- function functionV4message
-
makeForgetCabMessage
Generate a "Forget Cab" message '-'- Parameters:
cab- cab address to send function to (or 0 for all)- Returns:
- forget message to be sent
-
makeAddressedEmergencyStop
Generate an emergency stop for the specified address.Note: This just sends a THROTTLE command with speed = -1
- Parameters:
register- Register Number for the loco assigned address.address- is the locomotive address.- Returns:
- message to send e stop to the specified address.
-
makeAddressedEmergencyStop
Generate an emergency stop for the specified address.Note: This just sends a THROTTLE command with speed = -1
- Parameters:
address- is the locomotive address.- Returns:
- message to send e stop to the specified address.
-
makeEmergencyStopAllMsg
Generate an emergency stop for all locos in reminder table.- Returns:
- message to send e stop for all locos
-
makeSpeedAndDirectionMsg
public static DCCppMessage makeSpeedAndDirectionMsg(int register, int address, float speed, boolean isForward) Generate a Speed and Direction Request message- Parameters:
register- is the DCC++ base station register assigned.address- is the locomotive addressspeed- 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. Format:<t REGISTER CAB SPEED DIRECTION>sets the throttle for a given register/cab combination REGISTER: an internal register number, from 1 through MAX_MAIN_REGISTERS (inclusive), to store the DCC packet used to control this throttle setting CAB: the short (1-127) or long (128-10293) address of the engine decoder SPEED: throttle speed from 0-126, or -1 for emergency stop (resets SPEED to 0) DIRECTION: 1=forward, 0=reverse. Setting direction when speed=0 or speed=-1 only effects directionality of cab lighting for a stopped train- Returns:
<T REGISTER CAB SPEED DIRECTION>
-
makeSpeedAndDirectionMsg
Generate a Speed and Direction Request message- Parameters:
address- is the locomotive addressspeed- 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. Format:<t CAB SPEED DIRECTION>sets the throttle for a given register/cab combination CAB: the short (1-127) or long (128-10293) address of the engine decoder SPEED: throttle speed from 0-126, or -1 for emergency stop (resets SPEED to 0) DIRECTION: 1=forward, 0=reverse. Setting direction when speed=0 or speed=-1 only effects directionality of cab lighting for a stopped train- Returns:
<T CAB SPEED DIRECTION>
-
makeFunctionGroup1OpsMsg
public static DCCppMessage makeFunctionGroup1OpsMsg(int address, boolean f0, boolean f1, boolean f2, boolean f3, boolean f4) Generate a Function Group One Operation Request message.- Parameters:
address- is the locomotive addressf0- is true if f0 is on, false if f0 is offf1- is true if f1 is on, false if f1 is offf2- is true if f2 is on, false if f2 is offf3- is true if f3 is on, false if f3 is offf4- is true if f4 is on, false if f4 is off- Returns:
- message to set function group 1.
-
makeFunctionGroup1SetMomMsg
public static DCCppMessage makeFunctionGroup1SetMomMsg(int address, boolean f0, boolean f1, boolean f2, boolean f3, boolean f4) Generate a Function Group One Set Momentary Functions message.- Parameters:
address- is the locomotive addressf0- is true if f0 is momentaryf1- is true if f1 is momentaryf2- is true if f2 is momentaryf3- is true if f3 is momentaryf4- is true if f4 is momentary- Returns:
- message to set momentary function group 1.
-
makeFunctionGroup2OpsMsg
public static DCCppMessage makeFunctionGroup2OpsMsg(int address, boolean f5, boolean f6, boolean f7, boolean f8) Generate a Function Group Two Operation Request message.- Parameters:
address- is the locomotive addressf5- is true if f5 is on, false if f5 is offf6- is true if f6 is on, false if f6 is offf7- is true if f7 is on, false if f7 is offf8- is true if f8 is on, false if f8 is off- Returns:
- message to set function group 2.
-
makeFunctionGroup2SetMomMsg
public static DCCppMessage makeFunctionGroup2SetMomMsg(int address, boolean f5, boolean f6, boolean f7, boolean f8) Generate a Function Group Two Set Momentary Functions message.- Parameters:
address- is the locomotive addressf5- is true if f5 is momentaryf6- is true if f6 is momentaryf7- is true if f7 is momentaryf8- is true if f8 is momentary- Returns:
- message to set momentary function group 2.
-
makeFunctionGroup3OpsMsg
public static DCCppMessage makeFunctionGroup3OpsMsg(int address, boolean f9, boolean f10, boolean f11, boolean f12) Generate a Function Group Three Operation Request message.- Parameters:
address- is the locomotive addressf9- is true if f9 is on, false if f9 is offf10- is true if f10 is on, false if f10 is offf11- is true if f11 is on, false if f11 is offf12- is true if f12 is on, false if f12 is off- Returns:
- message to set function group 3.
-
makeFunctionGroup3SetMomMsg
public static DCCppMessage makeFunctionGroup3SetMomMsg(int address, boolean f9, boolean f10, boolean f11, boolean f12) Generate a Function Group Three Set Momentary Functions message.- Parameters:
address- is the locomotive addressf9- is true if f9 is momentaryf10- is true if f10 is momentaryf11- is true if f11 is momentaryf12- is true if f12 is momentary- Returns:
- message to set momentary function group 3.
-
makeFunctionGroup4OpsMsg
public static DCCppMessage makeFunctionGroup4OpsMsg(int address, boolean f13, boolean f14, boolean f15, boolean f16, boolean f17, boolean f18, boolean f19, boolean f20) Generate a Function Group Four Operation Request message.- Parameters:
address- is the locomotive addressf13- is true if f13 is on, false if f13 is offf14- is true if f14 is on, false if f14 is offf15- is true if f15 is on, false if f15 is offf16- is true if f18 is on, false if f16 is offf17- is true if f17 is on, false if f17 is offf18- is true if f18 is on, false if f18 is offf19- is true if f19 is on, false if f19 is offf20- is true if f20 is on, false if f20 is off- Returns:
- message to set function group 4.
-
makeFunctionGroup4SetMomMsg
public static DCCppMessage makeFunctionGroup4SetMomMsg(int address, boolean f13, boolean f14, boolean f15, boolean f16, boolean f17, boolean f18, boolean f19, boolean f20) Generate a Function Group Four Set Momentary Function message.- Parameters:
address- is the locomotive addressf13- is true if f13 is Momentaryf14- is true if f14 is Momentaryf15- is true if f15 is Momentaryf16- is true if f18 is Momentaryf17- is true if f17 is Momentaryf18- is true if f18 is Momentaryf19- is true if f19 is Momentaryf20- is true if f20 is Momentary- Returns:
- message to set momentary function group 4.
-
makeFunctionGroup5OpsMsg
public static DCCppMessage makeFunctionGroup5OpsMsg(int address, boolean f21, boolean f22, boolean f23, boolean f24, boolean f25, boolean f26, boolean f27, boolean f28) Generate a Function Group Five Operation Request message.- Parameters:
address- is the locomotive addressf21- is true if f21 is on, false if f21 is offf22- is true if f22 is on, false if f22 is offf23- is true if f23 is on, false if f23 is offf24- is true if f24 is on, false if f24 is offf25- is true if f25 is on, false if f25 is offf26- is true if f26 is on, false if f26 is offf27- is true if f27 is on, false if f27 is offf28- is true if f28 is on, false if f28 is off- Returns:
- message to set function group 5.
-
makeFunctionGroup5SetMomMsg
public static DCCppMessage makeFunctionGroup5SetMomMsg(int address, boolean f21, boolean f22, boolean f23, boolean f24, boolean f25, boolean f26, boolean f27, boolean f28) Generate a Function Group Five Set Momentary Function message.- Parameters:
address- is the locomotive addressf21- is true if f21 is momentaryf22- is true if f22 is momentaryf23- is true if f23 is momentaryf24- is true if f24 is momentaryf25- is true if f25 is momentaryf26- is true if f26 is momentaryf27- is true if f27 is momentaryf28- is true if f28 is momentary- Returns:
- message to set momentary function group 5.
-
makeWriteDCCPacketMainMsg
Write DCC Packet to a specified Register on the Main.
DCC++ BaseStation code appends its own error-correction byte so we must not provide one.- Parameters:
register- the DCC++ BaseStation main register number to usenumBytes- the number of bytes in the packetbytes- byte array representing the packet. The firstnum_bytesare used.- Returns:
- the formatted message to send
-
makeWriteDCCPacketProgMsg
Write DCC Packet to a specified Register on the Programming Track.
DCC++ BaseStation code appends its own error-correction byte so we must not provide one.- Parameters:
register- the DCC++ BaseStation main register number to usenumBytes- the number of bytes in the packetbytes- byte array representing the packet. The firstnum_bytesare used.- Returns:
- the formatted message to send
-
makeListRegisterContentsMsg
-
makeLCDRequestMsg
Request LCD Messages used for Virtual LCD DisplayFormat:
<@>tells EX_CommandStation to send any LCD message updates to this instance of JMRI
- Returns:
- the formatted message to send
-
equals
This implementation of equals is targeted to the background function refreshing in SerialDCCppPacketizer. To keep only one function group in the refresh queue the logic is as follows. Two messages are equal if they are:- actually identical, or
- a function call to the same address and same function group
- Overrides:
equalsin classAbstractMessage
-
hashCode
Description copied from class:AbstractMessageHash code from base data.- Overrides:
hashCodein classAbstractMessage- Returns:
- hashcode from sum of elements.
-
delayFor
Before adding the message to the delay queue call this method to set when the message should be repeated. The only time guarantee is that it will be repeated after at least this much time, but it can be significantly longer until it is repeated, function of the message queue length.- Parameters:
millis- milliseconds in the future
-
compareTo
Comparing two queued message for refreshing the function calls, based on their expected execution time.- Specified by:
compareToin interfaceComparable<Delayed>
-
getDelay
From theDelayedinterface, how long this message still has until it should be executed.
-