Package jmri.jmrix.zimo
Class Mx1TrafficController
- java.lang.Object
-
- jmri.jmrix.zimo.Mx1TrafficController
-
- All Implemented Interfaces:
Mx1Interface
- Direct Known Subclasses:
Mx1Packetizer
public abstract class Mx1TrafficController extends java.lang.Object implements Mx1Interface
Abstract base class for implementations of MX-1 Interface.This provides just the basic interface, plus the "" static method for locating the local implementation.
Adapted by Sip Bosch for use with zimo Mx-1.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) Mx1SystemConnectionMemoadaptermemostatic booleanASCIIstatic booleanBINARYprotected java.util.Vector<Mx1Listener>listeners(package private) Mx1CommandStationmCommandStationReference to the command station in communication here(package private) booleanprotocol-
Fields inherited from interface jmri.jmrix.zimo.Mx1Interface
ALL, POWER, PROGRAMMING, SENSORS, SLOTINFO, TURNOUTS
-
-
Constructor Summary
Constructors Constructor Description Mx1TrafficController()Create a new TrafficController instance.Mx1TrafficController(Mx1CommandStation pCommandStation, boolean prot)Must provide a ZimoCommandStation reference at creation time
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddMx1Listener(int mask, Mx1Listener l)Request notification of things happening on the MX-1.Mx1SystemConnectionMemogetAdapterMemo()Mx1CommandStationgetCommandStation()Get access to communicating command station objectbooleangetProtocol()java.lang.StringgetSystemPrefix()java.lang.StringgetUserName()protected voidnotify(Mx1Message m, Mx1Listener replyTo)Forward a message to all registered listeners.voidremoveMx1Listener(int mask, Mx1Listener l)abstract voidsendMx1Message(Mx1Message m, Mx1Listener reply)Forward a pre-formatted Mx1Message to the actual interface.voidsetAdapterMemo(Mx1SystemConnectionMemo memo)abstract booleanstatus()
-
-
-
Field Detail
-
ASCII
public static final boolean ASCII
- See Also:
- Constant Field Values
-
BINARY
public static final boolean BINARY
- See Also:
- Constant Field Values
-
protocol
boolean protocol
-
listeners
protected java.util.Vector<Mx1Listener> listeners
-
mCommandStation
Mx1CommandStation mCommandStation
Reference to the command station in communication here
-
adaptermemo
Mx1SystemConnectionMemo adaptermemo
-
-
Constructor Detail
-
Mx1TrafficController
public Mx1TrafficController()
Create a new TrafficController instance. Simple implementation.
-
Mx1TrafficController
Mx1TrafficController(Mx1CommandStation pCommandStation, boolean prot)
Must provide a ZimoCommandStation reference at creation time
-
-
Method Detail
-
getProtocol
public boolean getProtocol()
-
status
public abstract boolean status()
- Specified by:
statusin interfaceMx1Interface
-
sendMx1Message
public abstract void sendMx1Message(Mx1Message m, Mx1Listener reply)
Forward a pre-formatted Mx1Message to the actual interface.- Specified by:
sendMx1Messagein interfaceMx1Interface- Parameters:
m- Message to send; will be updated with CRCreply- the listener to notify of a response
-
addMx1Listener
public void addMx1Listener(int mask, Mx1Listener l)
Description copied from interface:Mx1InterfaceRequest notification of things happening on the MX-1.The same listener can register multiple times with different masks. (Multiple registrations with a single mask value are equivalent to a single registration) Mask values are defined as class constants. Note that these are bit masks, and should be OR'd, not added, if multiple values are desired.
The event notification contains the received message as source, not this object, so that we can notify of an incoming message to multiple places and then move on.
- Specified by:
addMx1Listenerin interfaceMx1Interface- Parameters:
mask- The OR of the key values of messages to be reported (to reduce traffic, provide for listeners interested in different things)l- Object to be notified of new messages as they arrive.
-
removeMx1Listener
public void removeMx1Listener(int mask, Mx1Listener l)
- Specified by:
removeMx1Listenerin interfaceMx1Interface
-
notify
protected void notify(Mx1Message m, Mx1Listener replyTo)
Forward a message to all registered listeners.- Parameters:
m- Message to forward. Listeners should not modify it!replyTo- Listener for the reply to this message, doesn't get the echo of it.
-
getCommandStation
public Mx1CommandStation getCommandStation()
Get access to communicating command station object- Returns:
- associated Command Station object
-
getAdapterMemo
public Mx1SystemConnectionMemo getAdapterMemo()
-
setAdapterMemo
public void setAdapterMemo(Mx1SystemConnectionMemo memo)
-
getUserName
public java.lang.String getUserName()
-
getSystemPrefix
public java.lang.String getSystemPrefix()
-
-