Package jmri.jmrix.roco.z21
Class Z21Message
java.lang.Object
jmri.jmrix.AbstractMessage
jmri.jmrix.AbstractMRMessage
jmri.jmrix.roco.z21.Z21Message
- All Implemented Interfaces:
Message
Class for messages in the z21/Z21 protocol.
Messages have the following format: 2 bytes data length. 2 bytes op code. n
bytes data.
All numeric values are stored in little endian format.
Carries a sequence of characters, with accessors.
-
Field Summary
FieldsFields inherited from class jmri.jmrix.AbstractMRMessage
LONG_TIMEOUT, SHORT_TIMEOUTFields inherited from class jmri.jmrix.AbstractMessage
_dataChars, _nDataChars -
Constructor Summary
ConstructorsConstructorDescriptionZ21Message(byte[] a, int l) Deprecated, for removal: This API element is subject to removal in a future version.5.13.5, unused, requires further development.Z21Message(int i) Z21Message(String m) This ctor interprets the String as the exact sequence to send, byte-for-byte. -
Method Summary
Modifier and TypeMethodDescription(package private) byte[]static Z21MessagegetLanCanDetector(int address) static Z21Messagestatic Z21Messagestatic Z21Messagestatic Z21Messagestatic Z21MessagegetLanRMBusGetDataRequestMessage(int group) static Z21MessagegetLanRMBusProgramModuleMessage(int address) static Z21MessagegetLanSetBroadcastFlagsRequestMessage(int flags) Set the broadcast flags as described in section 2.16 of the Roco Z21 Protocol Manual.static Z21Messageintintstatic Z21Message(package private) boolean(package private) boolean(package private) boolean(package private) booleanbooleanIs a reply expected to this message?voidsetLength(int i) voidsetOpCode(int i) Methods inherited from class jmri.jmrix.AbstractMRMessage
addIntAsFourHex, addIntAsThree, addIntAsThreeHex, addIntAsTwoHex, getNeededMode, getOpCodeHex, getRetries, getTimeout, isBinary, setBinary, setNeededMode, setRetries, setTimeout, toStringMethods inherited from class jmri.jmrix.AbstractMessage
equals, getElement, getNumDataElements, hashCode, setElement
-
Field Details
-
mReplyExpected
boolean mReplyExpected
-
-
Constructor Details
-
Z21Message
public Z21Message() -
Z21Message
-
Z21Message
-
Z21Message
-
Z21Message
This ctor interprets the String as the exact sequence to send, byte-for-byte.- Parameters:
m- message string.
-
Z21Message
Deprecated, for removal: This API element is subject to removal in a future version.5.13.5, unused, requires further development.This ctor interprets the byte array as a sequence of characters to send.- Parameters:
a- Array of bytes to sendl- unused.
-
-
Method Details
-
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.
-
setOpCode
- Overrides:
setOpCodein classAbstractMRMessage
-
getOpCode
- Overrides:
getOpCodein classAbstractMRMessage
-
setLength
-
getLength
-
getBuffer
byte[] getBuffer() -
getSerialNumberRequestMessage
-
getLanGetHardwareInfoRequestMessage
-
getLanLogoffRequestMessage
-
getLanGetBroadcastFlagsRequestMessage
- Returns:
- z21 message for LAN_GET_BROADCAST_FLAGS request.
-
getLanSetBroadcastFlagsRequestMessage
Set the broadcast flags as described in section 2.16 of the Roco Z21 Protocol Manual.Brief descriptions of the flags are as follows (losely translated from German with the aid of google translate).
- 0x00000001 send XpressNet related information (track power on/off, programming mode, short circuit, broadcast stop, locomotive information, turnout information).
- 0x00000002 send data changes that occur on the RMBUS.
- 0x00000004 (deprecated by Roco) send Railcom Data
- 0x00000100 send changes in system state (such as track voltage)
- 0x00010000 send changes to locomotives on XpressNet (must also have 0x00000001 set.
- 0x01000000 forward LocoNet data to the client. Does not send Locomotive or turnout data.
- 0x02000000 send Locomotive specific LocoNet data to the client.
- 0x04000000 send Turnout specific LocoNet data to the client.
- 0x08000000 send Occupancy information from LocoNet to the client
- 0x00040000 Automatically send updates for Railcom data to the client
- 0x00080000 send can detector messages to the client
- Parameters:
flags- integer representing the flags (32 bits).- Returns:
- z21 message for LAN_SET_BROADCAST_FLAGS request.
-
getLanRailComGetDataRequestMessage
- Returns:
- z21 message for LAN_RAILCOM_GETDATA request.
-
getLanSystemStateDataChangedRequestMessage
- Returns:
- z21 message for LAN_SYSTEMSTATE_GETDATA
-
toMonitorString
- Returns:
- a human-readable representation of the message.
-
isLocoNetTunnelMessage
boolean isLocoNetTunnelMessage() -
isLocoNetDispatchMessage
boolean isLocoNetDispatchMessage() -
isLocoNetDetectorMessage
boolean isLocoNetDetectorMessage() -
getLocoNetMessage
-
getLanRMBusGetDataRequestMessage
- Parameters:
group- the RM Bus group number to request.- Returns:
- z21 message for LAN_RMBUS_GETDATA
-
getLanRMBusProgramModuleMessage
- Parameters:
address- the RM Bus address to write.- Returns:
- z21 message for LAN_RMBUS_PROGRAMMODULE
-
isCanDetectorMessage
boolean isCanDetectorMessage() -
getLanCanDetector
- Parameters:
address- CAN NetworkID of the module to request data from.- Returns:
- z21 message for LAN_CAN_DETECTOR request message
-