|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjmri.jmrix.AbstractMRTrafficController
jmri.jmrix.nce.NceTrafficController
public class NceTrafficController
Converts Stream-based I/O to/from NCE messages. The "NceInterface" side sends/receives message objects.
The connection to a NcePortController is via a pair of *Streams, which then carry sequences of characters for transmission. Note that this processing is handled in an independent thread.
This handles the state transitions, based on the necessary state in each message.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class jmri.jmrix.AbstractMRTrafficController |
|---|
AbstractMRTrafficController.RcvNotifier, AbstractMRTrafficController.XmtNotifier |
| Field Summary | |
|---|---|
boolean |
commandOptionSet
|
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. |
protected boolean |
replyBinary
|
protected int |
replyLen
|
protected boolean |
unsolicitedSensorMessageSeen
|
static int |
USB_SYSTEM_NONE
Default when a NCE USB isn't selected in user system preferences |
static int |
USB_SYSTEM_POWERCAB
Create commands compatible with a NCE USB connected to a PowerCab |
static int |
USB_SYSTEM_POWERHOUSE
Create commands compatible with a NCE USB connected to a PowerHouse |
static int |
USB_SYSTEM_SB3
Create commands compatible with a NCE USB connected to a Smart Booster |
| Constructor Summary | |
|---|---|
NceTrafficController()
|
|
| Method Summary | |
|---|---|
void |
addNceListener(NceListener l)
|
protected boolean |
canReceive()
Override in the system specific code if necessary |
protected boolean |
endOfMessage(AbstractMRReply msg)
|
protected AbstractMRMessage |
enterNormalMode()
|
protected AbstractMRMessage |
enterProgMode()
|
protected int |
enterProgModeDelayTime()
|
protected void |
forwardMessage(AbstractMRListener client,
AbstractMRMessage m)
Forward a NceMessage to all registered NceInterface listeners. |
protected void |
forwardReply(AbstractMRListener client,
AbstractMRReply r)
Forward a NceReply to all registered NceInterface listeners. |
protected void |
forwardToPort(AbstractMRMessage m,
AbstractMRListener reply)
Actually transmits the next message to the port |
NceSystemConnectionMemo |
getAdapterMemo()
|
int |
getCommandOptions()
Determine which command format should be used for various commands: ASCII or binary. |
boolean |
getNceProgMode()
Gets the state of the command station |
NceSensorManager |
getSensorManager()
|
int |
getUsbSystem()
Get the type of system the NCE USB is connected to USB_SYSTEM_NONE
USB_SYSTEM_POWERCAB
USB_SYSTEM_SB3
USB_SYSTEM_POWERHOUSE
|
static NceTrafficController |
instance()
Deprecated. |
protected AbstractMRReply |
newReply()
|
protected AbstractMRMessage |
pollMessage()
Check NCE EPROM and start NCE CS accessory memory poll |
protected AbstractMRListener |
pollReplyHandler()
|
void |
removeNceListener(NceListener l)
|
void |
sendNceMessage(NceMessage m,
NceListener reply)
Forward a preformatted message to the actual interface. |
void |
sendPacket(byte[] packet,
int count)
CommandStation implementation |
void |
setAdapterMemo(NceSystemConnectionMemo adaptermemo)
|
void |
setCommandOptions(int val)
Control which command format should be used for various commands: ASCII or binary. |
void |
setInstance()
Deprecated. |
void |
setNceProgMode(boolean b)
Sets the state of the command station |
void |
setSensorManager(NceSensorManager m)
|
void |
setUsbSystem(int val)
Set the type of system the NCE USB is connected to USB_SYSTEM_NONE
USB_SYSTEM_POWERCAB
USB_SYSTEM_SB3
USB_SYSTEM_POWERHOUSE
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface jmri.jmrix.nce.NceInterface |
|---|
status |
| Field Detail |
|---|
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
public boolean commandOptionSet
public static final int USB_SYSTEM_NONE
public static final int USB_SYSTEM_POWERCAB
public static final int USB_SYSTEM_SB3
public static final int USB_SYSTEM_POWERHOUSE
protected int replyLen
protected boolean replyBinary
protected boolean unsolicitedSensorMessageSeen
| Constructor Detail |
|---|
public NceTrafficController()
| Method Detail |
|---|
public void addNceListener(NceListener l)
addNceListener in interface NceInterfacepublic void removeNceListener(NceListener l)
removeNceListener in interface NceInterfaceprotected int enterProgModeDelayTime()
enterProgModeDelayTime in class AbstractMRTrafficController
public void sendPacket(byte[] packet,
int count)
sendPacket in interface CommandStationpacket - Byte array representing the packet, including
the error-correction byte. Must not be null.count - Number of times to repeat the transmission.
protected void forwardMessage(AbstractMRListener client,
AbstractMRMessage m)
forwardMessage in class AbstractMRTrafficController
protected void forwardReply(AbstractMRListener client,
AbstractMRReply r)
forwardReply in class AbstractMRTrafficControllerpublic void setSensorManager(NceSensorManager m)
public NceSensorManager getSensorManager()
public void setCommandOptions(int val)
The valid argument values are the class "OPTION" constants, which are interpreted in the various methods to get a particular message.
public int getCommandOptions()
The valid return values are the class "OPTION" constants, which are interpreted in the various methods to get a particular message.
public void setUsbSystem(int val)
val - public int getUsbSystem()
public boolean getNceProgMode()
public void setNceProgMode(boolean b)
b - when true, set programming modeprotected AbstractMRMessage pollMessage()
pollMessage in class AbstractMRTrafficControllerprotected AbstractMRListener pollReplyHandler()
pollReplyHandler in class AbstractMRTrafficController
public void sendNceMessage(NceMessage m,
NceListener reply)
sendNceMessage in interface NceInterfacem - Message to be sent.reply - Listener to be notified of reply.
protected void forwardToPort(AbstractMRMessage m,
AbstractMRListener reply)
AbstractMRTrafficController
forwardToPort in class AbstractMRTrafficControllerprotected AbstractMRMessage enterProgMode()
enterProgMode in class AbstractMRTrafficControllerprotected AbstractMRMessage enterNormalMode()
enterNormalMode in class AbstractMRTrafficController@Deprecated public static NceTrafficController instance()
public void setAdapterMemo(NceSystemConnectionMemo adaptermemo)
public NceSystemConnectionMemo getAdapterMemo()
@Deprecated public void setInstance()
setInstance in class AbstractMRTrafficControllerprotected AbstractMRReply newReply()
newReply in class AbstractMRTrafficControllerprotected boolean canReceive()
AbstractMRTrafficController
canReceive in class AbstractMRTrafficControllerprotected boolean endOfMessage(AbstractMRReply msg)
endOfMessage in class AbstractMRTrafficController
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||