Package jmri.jmrix.nce
Class NceTurnoutMonitor
- java.lang.Object
-
- jmri.jmrix.nce.NceTurnoutMonitor
-
- All Implemented Interfaces:
java.beans.PropertyChangeListener
,java.util.EventListener
,AbstractMRListener
,NceListener
public class NceTurnoutMonitor extends java.lang.Object implements NceListener, java.beans.PropertyChangeListener
Polls NCE Command Station for turnout discrepanciesThis implementation reads the NCE Command Station (CS) memory that stores the state of all accessories thrown by cabs or through the com port using the new binary switch command. The accessory states are stored in 256 byte array starting at address 0xEC00 (PH5 0x5400).
byte 0, bit 0 = ACCY 1, bit 1 = ACCY 2 byte 1, bit 0 = ACCY 9, bit 1 = ACCY 10
byte 255, bit 0 = ACCY 2041, bit 3 = ACCY 2044 (last valid addr)
ACCY bit = 0 turnout thrown, 1 = turnout closed
Block reads (16 bytes) of the NCE CS memory are performed to minimize impact to the NCE CS. Data from the CS is then compared to the JMRI turnout (accessory) state and if a discrepancy is discovered, the JMRI turnout state is modified to match the CS.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) boolean[]
activeBlock
(package private) byte[]
csAccMemCopy
(package private) byte[]
dataBuffer
(package private) java.lang.Thread
nceTurnoutMonitorThread
(package private) boolean[]
newTurnouts
(package private) static int
POLL_TIME
(package private) boolean
turnoutUpdateValid
(package private) boolean[]
validBlock
-
Constructor Summary
Constructors Constructor Description NceTurnoutMonitor(NceTrafficController t)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
message(NceMessage m)
NceMessage
pollMessage()
void
propertyChange(java.beans.PropertyChangeEvent e)
void
reply(NceReply r)
-
-
-
Field Detail
-
POLL_TIME
static final int POLL_TIME
- See Also:
- Constant Field Values
-
newTurnouts
boolean[] newTurnouts
-
activeBlock
boolean[] activeBlock
-
validBlock
boolean[] validBlock
-
csAccMemCopy
byte[] csAccMemCopy
-
dataBuffer
byte[] dataBuffer
-
nceTurnoutMonitorThread
java.lang.Thread nceTurnoutMonitorThread
-
turnoutUpdateValid
boolean turnoutUpdateValid
-
-
Constructor Detail
-
NceTurnoutMonitor
public NceTurnoutMonitor(NceTrafficController t)
-
-
Method Detail
-
pollMessage
public NceMessage pollMessage()
-
message
public void message(NceMessage m)
- Specified by:
message
in interfaceNceListener
-
reply
public void reply(NceReply r)
- Specified by:
reply
in interfaceNceListener
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent e)
- Specified by:
propertyChange
in interfacejava.beans.PropertyChangeListener
-
-