Package jmri.jmrix.direct
Class TrafficController
java.lang.Object
jmri.jmrix.direct.TrafficController
- All Implemented Interfaces:
CommandStation
Converts Stream-based I/O to/from NMRA packets and controls sending to the
direct interface.
This is much simpler than many other "TrafficHandler" classes, because
- It's not handling mode information, or even any information back from the device; it's just sending.
- It can work with the direct packets.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new Direct TrafficController instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidMake connection to existing PortController object.voidBreak connection to existing PortController object.booleansendPacket(byte[] packet, int repeats) Send a specific packet to the rails.booleanstatus()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface jmri.CommandStation
sendAccSignalDecoderPkt, sendAltAccSignalDecoderPkt
-
Field Details
-
istream
-
ostream
-
-
Constructor Details
-
TrafficController
Create a new Direct TrafficController instance.- Parameters:
memo- system connection.
-
-
Method Details
-
sendPacket
Send a specific packet to the rails.- Specified by:
sendPacketin interfaceCommandStation- Parameters:
packet- Byte array representing the packet, including the error-correction byte. Must not be null.repeats- Number of times to repeat the transmission, but is ignored in the current implementation- Returns:
trueif the operation succeeds,falseotherwise.
-
status
-
connectPort
Make connection to existing PortController object.- Parameters:
p- the controller to connect to
-
disconnectPort
Break connection to existing PortController object. Once broken, attempts to send via "message" member will fail.- Parameters:
p- the controller to disconnect from
-
getUserName
- Specified by:
getUserNamein interfaceCommandStation
-
getSystemPrefix
- Specified by:
getSystemPrefixin interfaceCommandStation
-