Package jmri.jmrix.nce
Class NceMessage
java.lang.Object
jmri.jmrix.AbstractMessage
jmri.jmrix.AbstractMRMessage
jmri.jmrix.nce.NceMessage
- All Implemented Interfaces:
Message
Encodes a message to an NCE command station.
The NceReply class handles the response from the command station.
The NCE protocol has "binary" and "ASCII" command sets. Depending on the version of the EPROM it contains, NCE command stations have different support for command sets:
- 1999 - All ASCII works. Binary works except for programming.
- 2004 - ASCII needed for programming, binary for everything else.
- 2006 - binary needed for everything
NceTrafficController.setCommandOptions(int) method for more
information.
Apparently the binary "exitProgrammingMode" command can crash the command
station if the EPROM was built before 2006. This method uses a state flag
(NceTrafficController.getNceProgMode()) to detect whether a command to
enter program mode has been generated, and presumably sent, when using the
later EPROMS.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final intprotected static final intstatic charprotected static final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final int(package private) intstatic final intstatic final intstatic final intstatic final intstatic final intprotected static final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intFields inherited from class jmri.jmrix.AbstractMRMessage
LONG_TIMEOUTFields inherited from class jmri.jmrix.AbstractMessage
_dataChars, _nDataChars -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic NceMessagecreateAccDecoderPktOpsMode(NceTrafficController tc, int accyAddr, int cvAddr, int cvData) static NceMessagecreateAccySignalMacroMessage(NceTrafficController tc, int op, int addr, int data) static NceMessagecreateBinaryMessage(NceTrafficController tc, byte[] bytes) static NceMessagecreateBinaryMessage(NceTrafficController tc, byte[] bytes, int replyLen) static NceMessagestatic NceMessagestatic NceMessageApparently the binary "exitProgrammingMode" command can crash the command station if the EPROM was built before 2006.static NceMessagestatic NceMessageenter programming track modestatic NceMessagegetReadDirectCV(NceTrafficController tc, int cv) static NceMessagegetReadPagedCV(NceTrafficController tc, int cv) Read Paged mode CV on programming track.static NceMessagegetReadRegister(NceTrafficController tc, int reg) intstatic NceMessagegetWriteDirectCV(NceTrafficController tc, int cv, int val) static NceMessagegetWritePagedCV(NceTrafficController tc, int cv, int val) Write paged mode CV to programming track.static NceMessagegetWriteRegister(NceTrafficController tc, int reg, int val) booleanbooleanstatic NceMessagequeuePacketMessage(NceTrafficController tc, byte[] bytes) static NceMessagesendLocoCmd(NceTrafficController tc, int locoAddr, byte locoSubCmd, byte locoData) static NceMessagesendPacketMessage(NceTrafficController tc, byte[] bytes) static NceMessagesendPacketMessage(NceTrafficController tc, byte[] bytes, int retries) voidsetReplyLen(int len) Set the number of characters expected back from the command station.Methods inherited from class jmri.jmrix.AbstractMRMessage
addIntAsFourHex, addIntAsThree, addIntAsThreeHex, addIntAsTwoHex, getNeededMode, getOpCode, getOpCodeHex, getRetries, getTimeout, isBinary, replyExpected, setBinary, setNeededMode, setOpCode, setRetries, setTimeout, toStringMethods inherited from class jmri.jmrix.AbstractMessage
equals, getElement, getNumDataElements, hashCode, setElement
-
Field Details
-
NOP_CMD
- See Also:
-
ASSIGN_CAB_CMD
- See Also:
-
READ_CLOCK_CMD
- See Also:
-
STOP_CLOCK_CMD
- See Also:
-
START_CLOCK_CMD
- See Also:
-
SET_CLOCK_CMD
- See Also:
-
CLOCK_1224_CMD
- See Also:
-
CLOCK_RATIO_CMD
- See Also:
-
DEQUEUE_CMD
- See Also:
-
READ_AUI4_CMD
- See Also:
-
DUMMY_CMD
- See Also:
-
SPEED_MODE_CMD
- See Also:
-
WRITE_N_CMD
- See Also:
-
READ16_CMD
- See Also:
-
DISPLAY3_CMD
- See Also:
-
DISPLAY4_CMD
- See Also:
-
DISPLAY2_CMD
- See Also:
-
QUEUE3_TMP_CMD
- See Also:
-
QUEUE4_TMP_CMD
- See Also:
-
QUEUE5_TMP_CMD
- See Also:
-
QUEUE6_TMP_CMD
- See Also:
-
WRITE1_CMD
- See Also:
-
WRITE2_CMD
- See Also:
-
WRITE4_CMD
- See Also:
-
WRITE8_CMD
- See Also:
-
READ_AUI2_CMD
- See Also:
-
MACRO_CMD
- See Also:
-
READ1_CMD
- See Also:
-
ENTER_PROG_CMD
- See Also:
-
EXIT_PROG_CMD
- See Also:
-
WRITE_PAGED_CV_CMD
- See Also:
-
READ_PAGED_CV_CMD
- See Also:
-
LOCO_CMD
- See Also:
-
QUEUE3_TRK_CMD
- See Also:
-
QUEUE4_TRK_CMD
- See Also:
-
QUEUE5_TRK_CMD
- See Also:
-
WRITE_REG_CMD
- See Also:
-
READ_REG_CMD
- See Also:
-
WRITE_DIR_CV_CMD
- See Also:
-
READ_DIR_CV_CMD
- See Also:
-
SW_REV_CMD
- See Also:
-
RESET_SOFT_CMD
- See Also:
-
RESET_HARD_CMD
- See Also:
-
SEND_ACC_SIG_MACRO_CMD
- See Also:
-
OPS_PROG_LOCO_CMD
- See Also:
-
OPS_PROG_ACCY_CMD
- See Also:
-
FACTORY_TEST_CMD
- See Also:
-
USB_SET_CAB_CMD
- See Also:
-
USB_MEM_POINTER_CMD
- See Also:
-
USB_MEM_WRITE_CMD
- See Also:
-
USB_MEM_READ_CMD
- See Also:
-
LOCO_CMD_SELECT_LOCO
- See Also:
-
LOCO_CMD_REV_28SPEED
- See Also:
-
LOCO_CMD_FWD_28SPEED
- See Also:
-
LOCO_CMD_REV_128SPEED
- See Also:
-
LOCO_CMD_FWD_128SPEED
- See Also:
-
LOCO_CMD_REV_ESTOP
- See Also:
-
LOCO_CMD_FWD_ESTOP
- See Also:
-
LOCO_CMD_FG1
- See Also:
-
LOCO_CMD_FG2
- See Also:
-
LOCO_CMD_FG3
- See Also:
-
LOCO_CMD_FG4
- See Also:
-
LOCO_CMD_FG5
- See Also:
-
LOCO_CMD_REV_CONSIST_LEAD
- See Also:
-
LOCO_CMD_FWD_CONSIST_LEAD
- See Also:
-
LOCO_CMD_REV_CONSIST_REAR
- See Also:
-
LOCO_CMD_FWD_CONSIST_REAR
- See Also:
-
LOCO_CMD_REV_CONSIST_MID
- See Also:
-
LOCO_CMD_FWD_CONSIST_MID
- See Also:
-
LOCO_CMD_DELETE_LOCO_CONSIST
- See Also:
-
LOCO_CMD_KILL_CONSIST
- See Also:
-
ENABLE_MAIN_CMD
- See Also:
-
KILL_MAIN_CMD
- See Also:
-
SENDn_BYTES_CMD
- See Also:
-
QUEUEn_BYTES_CMD
- See Also:
-
NCE_PAGED_CV_TIMEOUT
- See Also:
-
NCE_DIRECT_CV_TIMEOUT
- See Also:
-
SHORT_TIMEOUT
- See Also:
-
REPLY_1
- See Also:
-
REPLY_2
- See Also:
-
REPLY_3
- See Also:
-
REPLY_4
- See Also:
-
REPLY_16
- See Also:
-
NCE_OKAY
-
replyLen
int replyLen
-
-
Constructor Details
-
NceMessage
public NceMessage() -
NceMessage
-
NceMessage
-
NceMessage
-
-
Method Details
-
setReplyLen
Set the number of characters expected back from the command station. Used in binary mode, where there's no end-of-reply string to look for.- Parameters:
len- length of expected reply
-
getReplyLen
-
isKillMain
-
isEnableMain
-
getEnableMain
-
getKillMain
-
getProgMode
enter programming track mode- Parameters:
tc- controller for the associated connection- Returns:
- a new message to enter programming track mode
-
getExitProgMode
Apparently the binary "exitProgrammingMode" command can crash the command station if the EPROM was built before 2006. This method uses a state flag (NceTrafficController.getNceProgMode()) to detect whether a command to enter program mode has been generated, and presumably sent, when using the later EPROMS.- Parameters:
tc- controller for the associated connection- Returns:
- a new message to exit programming track mode
-
getReadPagedCV
Read Paged mode CV on programming track.- Parameters:
tc- controller for the associated connectioncv- the CV to read- Returns:
- a new message to read a CV
-
getWritePagedCV
@Nonnull public static NceMessage getWritePagedCV(@Nonnull NceTrafficController tc, int cv, int val) Write paged mode CV to programming track.- Parameters:
tc- controller for the associated connectioncv- CV to writeval- value to write to cv- Returns:
- a new message to write a CV
-
getReadRegister
-
getWriteRegister
-
getReadDirectCV
-
getWriteDirectCV
-
getEpromVersion
-
sendLocoCmd
public static NceMessage sendLocoCmd(NceTrafficController tc, int locoAddr, byte locoSubCmd, byte locoData) -
sendPacketMessage
-
sendPacketMessage
-
createBinaryMessage
-
createBinaryMessage
-
queuePacketMessage
-
createAccySignalMacroMessage
public static NceMessage createAccySignalMacroMessage(NceTrafficController tc, int op, int addr, int data) -
createAccDecoderPktOpsMode
public static NceMessage createAccDecoderPktOpsMode(NceTrafficController tc, int accyAddr, int cvAddr, int cvData) -
toMonitorString
- Returns:
- a human-readable representation of the message.
-