|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjmri.jmrix.AbstractMessage
jmri.jmrix.AbstractMRMessage
jmri.jmrix.nce.NceMessage
public class NceMessage
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:
setCommandOptions(int) method for more information.
Apparently the binary "exitProgrammingMode" command can crash the
command station if the EPROM was built before 2006. This
class uses a static state flag (ncsProgMode) to detect
whether a command to enter program mode has been generated, and
presumably sent, when using the later EPROMS.
| Field Summary | |
|---|---|
static int |
ENABLE_MAIN_CMD
|
static int |
ENTER_PROG_CMD
|
static int |
EXIT_PROG_CMD
|
static int |
KILL_MAIN_CMD
|
protected static int |
NCE_DIRECT_CV_TIMEOUT
|
protected static int |
NCE_PAGED_CV_TIMEOUT
|
protected static boolean |
ncsProgMode
|
static int |
NOP_CMD
|
static int |
OPTION_1999
Create commands compatible with the 1999 EPROM. |
static int |
OPTION_2004
Create commands compatible with the 2004 EPROM. |
static int |
OPTION_2006
Create commands compatible with the 2006 EPROM. |
static int |
OPTION_FORCE_ASCII
Create all commands in the ASCII format. |
static int |
OPTION_FORCE_BINARY
Create all commands in the binary format. |
static int |
QUEUEn_BYTES_CMD
|
static int |
READ_DIR_CV_CMD
|
static int |
READ_PAGED_CV_CMD
|
static int |
READ_REG_CMD
|
static int |
SENDn_BYTES_CMD
|
protected static int |
SHORT_TIMEOUT
|
static int |
WRITE_DIR_CV_CMD
|
static int |
WRITE_PAGED_CV_CMD
|
static int |
WRITE_REG_CMD
|
| Fields inherited from class jmri.jmrix.AbstractMRMessage |
|---|
LONG_TIMEOUT |
| Fields inherited from class jmri.jmrix.AbstractMessage |
|---|
_dataChars, _nDataChars |
| Constructor Summary | |
|---|---|
NceMessage()
|
|
NceMessage(int i)
|
|
NceMessage(NceMessage m)
|
|
NceMessage(String m)
|
|
| Method Summary | |
|---|---|
static NceMessage |
createBinaryMessage(byte[] bytes)
|
static NceMessage |
createBinaryMessage(byte[] bytes,
int replyLen)
|
static int |
getCommandOptions()
Determine which command format should be used for various commands: ASCII or binary. |
static NceMessage |
getEnableMain()
|
static NceMessage |
getExitProgMode()
|
static NceMessage |
getKillMain()
|
static NceMessage |
getProgMode()
|
static NceMessage |
getReadDirectCV(int cv)
|
static NceMessage |
getReadPagedCV(int cv)
|
static NceMessage |
getReadRegister(int reg)
|
int |
getReplyLen()
|
static NceMessage |
getWriteDirectCV(int cv,
int val)
|
static NceMessage |
getWritePagedCV(int cv,
int val)
|
static NceMessage |
getWriteRegister(int reg,
int val)
|
boolean |
isEnableMain()
|
boolean |
isKillMain()
|
static NceMessage |
queuePacketMessage(byte[] bytes)
|
static NceMessage |
sendPacketMessage(byte[] bytes)
|
static NceMessage |
sendPacketMessage(byte[] bytes,
int retries)
|
static void |
setCommandOptions(int val)
Control which command format should be used for various commands: ASCII or binary. |
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 |
| Methods inherited from class jmri.jmrix.AbstractMessage |
|---|
getElement, getNumDataElements, setElement |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int NOP_CMD
public static final int ENTER_PROG_CMD
public static final int EXIT_PROG_CMD
public static final int WRITE_PAGED_CV_CMD
public static final int READ_PAGED_CV_CMD
public static final int WRITE_REG_CMD
public static final int READ_REG_CMD
public static final int WRITE_DIR_CV_CMD
public static final int READ_DIR_CV_CMD
public static final int ENABLE_MAIN_CMD
public static final int KILL_MAIN_CMD
public static final int SENDn_BYTES_CMD
public static final int QUEUEn_BYTES_CMD
protected static int NCE_PAGED_CV_TIMEOUT
protected static int NCE_DIRECT_CV_TIMEOUT
protected static int SHORT_TIMEOUT
protected static boolean ncsProgMode
public static final int OPTION_FORCE_ASCII
public static final int OPTION_1999
This is binary for everything except service-mode CV programming operations.
public static final int OPTION_2004
This is binary for everything except service-mode CV programming operations.
public static final int OPTION_2006
This is binary for everything, including service-mode CV programming operations.
public static final int OPTION_FORCE_BINARY
| Constructor Detail |
|---|
public NceMessage()
public NceMessage(int i)
public NceMessage(NceMessage m)
public NceMessage(String m)
| Method Detail |
|---|
public void setReplyLen(int len)
public int getReplyLen()
public boolean isKillMain()
public boolean isEnableMain()
public static NceMessage getEnableMain()
public static NceMessage getKillMain()
public static NceMessage getProgMode()
public static NceMessage getExitProgMode()
public static NceMessage getReadPagedCV(int cv)
public static NceMessage getWritePagedCV(int cv,
int val)
public static NceMessage getReadRegister(int reg)
public static NceMessage getWriteRegister(int reg,
int val)
public static NceMessage getReadDirectCV(int cv)
public static NceMessage getWriteDirectCV(int cv,
int val)
public static NceMessage sendPacketMessage(byte[] bytes)
public static NceMessage sendPacketMessage(byte[] bytes,
int retries)
public static NceMessage createBinaryMessage(byte[] bytes)
public static NceMessage createBinaryMessage(byte[] bytes,
int replyLen)
public static NceMessage queuePacketMessage(byte[] bytes)
public static void setCommandOptions(int val)
The valid argument values are the class "OPTION" contants, which are interpreted in the various methods to get a particular message.
public static int getCommandOptions()
The valid return values are the class "OPTION" contants, which are interpreted in the various methods to get a particular message.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||