jmri.jmrix.zimo
Class Mx1Packetizer

java.lang.Object
  extended by jmri.jmrix.zimo.Mx1TrafficController
      extended by jmri.jmrix.zimo.Mx1Packetizer
All Implemented Interfaces:
Mx1Interface

public class Mx1Packetizer
extends Mx1TrafficController

Access to Zimo Mx1 messages via stream-based I/O. The "Mx1Interface" * side sends/receives Mx1Message objects. The connection to a Mx1PortController is via a pair of *Streams, which then carry sequences of characters for transmission.

Messages come to this via the main GUI thread, and are forwarded back to listeners in that same thread. Reception and transmission are handled in dedicated threads by RcvHandler and XmtHandler objects. Those are internal classes defined here. The thread priorities are:

Author:
Bob Jacobsen Copyright (C) 2001

Field Summary
 
Fields inherited from class jmri.jmrix.zimo.Mx1TrafficController
listeners
 
Fields inherited from interface jmri.jmrix.zimo.Mx1Interface
ALL, POWER, PROGRAMMING, SENSORS, SLOTINFO, TURNOUTS
 
Constructor Summary
Mx1Packetizer(Mx1CommandStation pCommandStation)
           
 
Method Summary
 void connectPort(Mx1PortController p)
          Make connection to existing Mx1PortController object.
 void disconnectPort(Mx1PortController p)
          Break connection to existing LnPortController object.
 void sendMx1Message(Mx1Message m, Mx1Listener reply)
          Forward a preformatted Mx1Message to the actual interface.
 void startThreads()
          Invoked at startup to start the threads needed here.
 boolean status()
           
 
Methods inherited from class jmri.jmrix.zimo.Mx1TrafficController
addMx1Listener, getCommandStation, instance, notify, removeMx1Listener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Mx1Packetizer

public Mx1Packetizer(Mx1CommandStation pCommandStation)
Method Detail

status

public boolean status()
Specified by:
status in interface Mx1Interface
Specified by:
status in class Mx1TrafficController

sendMx1Message

public void sendMx1Message(Mx1Message m,
                           Mx1Listener reply)
Forward a preformatted Mx1Message to the actual interface. End of Message is added here, then the message is converted to a byte array and queued for transmission

Specified by:
sendMx1Message in interface Mx1Interface
Specified by:
sendMx1Message in class Mx1TrafficController
Parameters:
m - Message to send; will be updated with CRC

connectPort

public void connectPort(Mx1PortController p)
Make connection to existing Mx1PortController object.

Parameters:
p - Port controller for connected. Save this for a later disconnect call

disconnectPort

public void disconnectPort(Mx1PortController p)
Break connection to existing LnPortController object. Once broken, attempts to send via "message" member will fail.

Parameters:
p - previously connected port

startThreads

public void startThreads()
Invoked at startup to start the threads needed here.



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: Get JMRI Model Railroad Interface at SourceForge.net. Fast, secure and Free Open Source software downloads