jmri.jmrix.nce
Class NceMessage
java.lang.Object
jmri.jmrix.AbstractMessage
jmri.jmrix.AbstractMRMessage
jmri.jmrix.nce.NceMessage
- All Implemented Interfaces:
- Message
public class NceMessage
- extends AbstractMRMessage
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
See the 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.
- Author:
- Bob Jacobsen Copyright (C) 2001, Daniel Boudreau Copyright (C) 2007
|
Method Summary |
static NceMessage |
createBinaryMessage(NceTrafficController tc,
byte[] bytes)
|
static NceMessage |
createBinaryMessage(NceTrafficController tc,
byte[] bytes,
int replyLen)
|
static NceMessage |
getEnableMain(NceTrafficController tc)
|
static NceMessage |
getExitProgMode(NceTrafficController tc)
Apparently the binary "exitProgrammingMode" command can crash the
command station if the EPROM was built before 2006. |
static NceMessage |
getKillMain(NceTrafficController tc)
|
static NceMessage |
getProgMode(NceTrafficController tc)
|
static NceMessage |
getReadDirectCV(NceTrafficController tc,
int cv)
|
static NceMessage |
getReadPagedCV(NceTrafficController tc,
int cv)
|
static NceMessage |
getReadRegister(NceTrafficController tc,
int reg)
|
int |
getReplyLen()
|
static NceMessage |
getWriteDirectCV(NceTrafficController tc,
int cv,
int val)
|
static NceMessage |
getWritePagedCV(NceTrafficController tc,
int cv,
int val)
|
static NceMessage |
getWriteRegister(NceTrafficController tc,
int reg,
int val)
|
boolean |
isEnableMain()
|
boolean |
isKillMain()
|
static NceMessage |
queuePacketMessage(NceTrafficController tc,
byte[] bytes)
|
static NceMessage |
sendPacketMessage(NceTrafficController tc,
byte[] bytes)
|
static NceMessage |
sendPacketMessage(NceTrafficController tc,
byte[] bytes,
int retries)
|
void |
setReplyLen(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, toString |
NOP_CMD
public static final int NOP_CMD
- See Also:
- Constant Field Values
ENTER_PROG_CMD
public static final int ENTER_PROG_CMD
- See Also:
- Constant Field Values
EXIT_PROG_CMD
public static final int EXIT_PROG_CMD
- See Also:
- Constant Field Values
WRITE_PAGED_CV_CMD
public static final int WRITE_PAGED_CV_CMD
- See Also:
- Constant Field Values
READ_PAGED_CV_CMD
public static final int READ_PAGED_CV_CMD
- See Also:
- Constant Field Values
WRITE_REG_CMD
public static final int WRITE_REG_CMD
- See Also:
- Constant Field Values
READ_REG_CMD
public static final int READ_REG_CMD
- See Also:
- Constant Field Values
WRITE_DIR_CV_CMD
public static final int WRITE_DIR_CV_CMD
- See Also:
- Constant Field Values
READ_DIR_CV_CMD
public static final int READ_DIR_CV_CMD
- See Also:
- Constant Field Values
ENABLE_MAIN_CMD
public static final int ENABLE_MAIN_CMD
- See Also:
- Constant Field Values
KILL_MAIN_CMD
public static final int KILL_MAIN_CMD
- See Also:
- Constant Field Values
SENDn_BYTES_CMD
public static final int SENDn_BYTES_CMD
- See Also:
- Constant Field Values
QUEUEn_BYTES_CMD
public static final int QUEUEn_BYTES_CMD
- See Also:
- Constant Field Values
NCE_PAGED_CV_TIMEOUT
protected static final int NCE_PAGED_CV_TIMEOUT
- See Also:
- Constant Field Values
NCE_DIRECT_CV_TIMEOUT
protected static final int NCE_DIRECT_CV_TIMEOUT
- See Also:
- Constant Field Values
SHORT_TIMEOUT
protected static final int SHORT_TIMEOUT
- See Also:
- Constant Field Values
NceMessage
public NceMessage()
NceMessage
public NceMessage(int i)
NceMessage
public NceMessage(NceMessage m)
NceMessage
public NceMessage(String m)
setReplyLen
public void setReplyLen(int len)
- 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.
getReplyLen
public int getReplyLen()
isKillMain
public boolean isKillMain()
isEnableMain
public boolean isEnableMain()
getEnableMain
public static NceMessage getEnableMain(NceTrafficController tc)
getKillMain
public static NceMessage getKillMain(NceTrafficController tc)
getProgMode
public static NceMessage getProgMode(NceTrafficController tc)
getExitProgMode
public static NceMessage getExitProgMode(NceTrafficController tc)
- 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.
getReadPagedCV
public static NceMessage getReadPagedCV(NceTrafficController tc,
int cv)
getWritePagedCV
public static NceMessage getWritePagedCV(NceTrafficController tc,
int cv,
int val)
getReadRegister
public static NceMessage getReadRegister(NceTrafficController tc,
int reg)
getWriteRegister
public static NceMessage getWriteRegister(NceTrafficController tc,
int reg,
int val)
getReadDirectCV
public static NceMessage getReadDirectCV(NceTrafficController tc,
int cv)
getWriteDirectCV
public static NceMessage getWriteDirectCV(NceTrafficController tc,
int cv,
int val)
sendPacketMessage
public static NceMessage sendPacketMessage(NceTrafficController tc,
byte[] bytes)
sendPacketMessage
public static NceMessage sendPacketMessage(NceTrafficController tc,
byte[] bytes,
int retries)
createBinaryMessage
public static NceMessage createBinaryMessage(NceTrafficController tc,
byte[] bytes)
createBinaryMessage
public static NceMessage createBinaryMessage(NceTrafficController tc,
byte[] bytes,
int replyLen)
queuePacketMessage
public static NceMessage queuePacketMessage(NceTrafficController tc,
byte[] bytes)
Copyright © 1997 - 2011 JMRI Community.
JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.
Additional information on copyright, trademarks and licenses is linked here.
Site hosted by: