Class RfidTrafficController
- java.lang.Object
-
- jmri.jmrix.AbstractMRTrafficController
-
- jmri.jmrix.rfid.RfidTrafficController
-
- All Implemented Interfaces:
RfidInterface
- Direct Known Subclasses:
ConcentratorTrafficController
,StandaloneTrafficController
public abstract class RfidTrafficController extends AbstractMRTrafficController implements RfidInterface
Converts Stream-based I/O to/from messages. The "RfidInterface" side sends/receives message objects.The connection to a SerialPortController 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 maintains a list of nodes, but doesn't currently do anything with it.
This implementation is complete and can be instantiated, but is not functional. It will be created e.g. when a default object is needed for configuring nodes, etc, during the initial configuration. A subclass must be instantiated to actually communicate with an adapter.
- Since:
- 2.11.4
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jmri.jmrix.AbstractMRTrafficController
AbstractMRTrafficController.RcvNotifier, AbstractMRTrafficController.XmtNotifier
-
-
Field Summary
Fields Modifier and Type Field Description protected RfidSystemConnectionMemo
adapterMemo
(package private) boolean
countingBytes
(package private) boolean
expectLength
protected boolean
logDebug
(package private) RfidReporterManager
mReporterManager
(package private) RfidSensorManager
mSensorManager
(package private) int
remainingBytes
(package private) boolean
sendInterlock
-
Fields inherited from class jmri.jmrix.AbstractMRTrafficController
allowUnexpectedReply, AUTORETRYSTATE, cmdListeners, connectionError, controller, flushReceiveChars, IDLESTATE, istream, listenerQueue, maxRcvExceptionCount, mCurrentMode, mCurrentState, mLastSender, msgQueue, mWaitBeforePoll, NORMALMODE, NOTIFIEDSTATE, OKSENDMSGSTATE, ostream, POLLSTATE, PROGRAMINGMODE, rcvException, rcvThread, replyInDispatch, threadStopRequest, timeoutFlag, timeouts, WAITMSGREPLYSTATE, WAITREPLYINNORMMODESTATE, WAITREPLYINPROGMODESTATE, waitTimePoll, xmtException, xmtRunnable, xmtThread
-
-
Constructor Summary
Constructors Constructor Description RfidTrafficController()
Create a new RfidTrafficController instance.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addRfidListener(RfidListener l)
protected boolean
endOfMessage(AbstractMRReply msg)
This is a default, null implementation, which must be overridden in an adapter-specific subclass.protected AbstractMRMessage
enterNormalMode()
Sets the system to normal mode during programming while in IDLESTATE.protected AbstractMRMessage
enterProgMode()
Set the system to programming mode.protected void
forwardMessage(AbstractMRListener client, AbstractMRMessage m)
Forward a RfidMessage to all registered RfidInterface listeners.protected void
forwardReply(AbstractMRListener client, AbstractMRReply r)
Forward a reply to all registered RfidInterface listeners.protected void
forwardToPort(AbstractMRMessage m, AbstractMRListener reply)
Actually transmit the next message to the port.RfidSystemConnectionMemo
getAdapterMemo()
java.lang.String
getRange()
RfidReporterManager
getReporterManager()
RfidMessage
getRfidMessage(int length)
Get a message of a specific length for filling in.RfidSensorManager
getSensorManager()
protected AbstractMRReply
newReply()
This is a default, null implementation, which must be overridden in an adapter-specific subclass.protected AbstractMRMessage
pollMessage()
Eventually, do initialization if neededprotected AbstractMRListener
pollReplyHandler()
void
removeRfidListener(RfidListener l)
abstract void
sendInitString()
void
sendRfidMessage(RfidMessage m, RfidListener reply)
Forward a preformatted message to the actual interface.void
setAdapterMemo(RfidSystemConnectionMemo memo)
void
setReporterManager(RfidReporterManager m)
void
setSensorManager(RfidSensorManager m)
-
Methods inherited from class jmri.jmrix.AbstractMRTrafficController
addConsoleListener, addHeaderToOutput, addListener, addTrailerToOutput, canReceive, connectionWarn, connectPort, disconnectPort, distributeReply, enterProgModeDelayTime, getLastSender, getPortName, getSynchronizeRx, handleOneIncomingReply, handleTimeout, hasTimeouts, lengthOfByteStream, loadChars, newRcvNotifier, notifyMessage, notifyReply, portReadyToSend, portWarn, portWarnTCP, programmerIdle, readByteProtected, receiveLoop, recovery, removeListener, reportReceiveLoopException, resetTimeout, sendMessage, setAllowUnexpectedReply, setSynchronizeRx, status, terminate, terminateThreads, transmitLoop, transmitWait, unexpectedReplyStateError, waitForStartOfReply, warnOnTimeout
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jmri.jmrix.rfid.RfidInterface
status
-
-
-
-
Field Detail
-
adapterMemo
protected RfidSystemConnectionMemo adapterMemo
-
logDebug
protected boolean logDebug
-
mSensorManager
RfidSensorManager mSensorManager
-
mReporterManager
RfidReporterManager mReporterManager
-
sendInterlock
boolean sendInterlock
-
expectLength
boolean expectLength
-
countingBytes
boolean countingBytes
-
remainingBytes
int remainingBytes
-
-
Constructor Detail
-
RfidTrafficController
public RfidTrafficController()
Create a new RfidTrafficController instance.
-
-
Method Detail
-
setAdapterMemo
public void setAdapterMemo(RfidSystemConnectionMemo memo)
-
getAdapterMemo
public RfidSystemConnectionMemo getAdapterMemo()
-
getRfidMessage
public RfidMessage getRfidMessage(int length)
Get a message of a specific length for filling in.This is a default, null implementation, which must be overridden in an adapter-specific subclass.
- Parameters:
length
- message length.- Returns:
- the RfidMessage.
-
addRfidListener
public void addRfidListener(RfidListener l)
- Specified by:
addRfidListener
in interfaceRfidInterface
-
removeRfidListener
public void removeRfidListener(RfidListener l)
- Specified by:
removeRfidListener
in interfaceRfidInterface
-
forwardMessage
protected void forwardMessage(AbstractMRListener client, AbstractMRMessage m)
Forward a RfidMessage to all registered RfidInterface listeners.- Specified by:
forwardMessage
in classAbstractMRTrafficController
- Parameters:
client
- abstract listener.m
- message to forward.
-
forwardReply
protected void forwardReply(AbstractMRListener client, AbstractMRReply r)
Forward a reply to all registered RfidInterface listeners.- Specified by:
forwardReply
in classAbstractMRTrafficController
-
setSensorManager
public void setSensorManager(RfidSensorManager m)
-
getSensorManager
public RfidSensorManager getSensorManager()
-
setReporterManager
public void setReporterManager(RfidReporterManager m)
-
getReporterManager
public RfidReporterManager getReporterManager()
-
pollMessage
protected AbstractMRMessage pollMessage()
Eventually, do initialization if needed- Specified by:
pollMessage
in classAbstractMRTrafficController
- Returns:
- Formatted poll message
-
pollReplyHandler
protected AbstractMRListener pollReplyHandler()
- Specified by:
pollReplyHandler
in classAbstractMRTrafficController
-
sendRfidMessage
public void sendRfidMessage(RfidMessage m, RfidListener reply)
Forward a preformatted message to the actual interface.- Specified by:
sendRfidMessage
in interfaceRfidInterface
-
forwardToPort
protected void forwardToPort(AbstractMRMessage m, AbstractMRListener reply)
Description copied from class:AbstractMRTrafficController
Actually transmit the next message to the port.- Overrides:
forwardToPort
in classAbstractMRTrafficController
- Parameters:
m
- the message to sendreply
- the Listener sending the message, often provided as 'this'- See Also:
AbstractMRTrafficController.sendMessage(AbstractMRMessage, AbstractMRListener)
-
enterProgMode
protected AbstractMRMessage enterProgMode()
Description copied from class:AbstractMRTrafficController
Set the system to programming mode.- Specified by:
enterProgMode
in classAbstractMRTrafficController
- Returns:
- any message that needs to be returned to the Command Station to change modes. If no message is needed, returns null.
- See Also:
AbstractMRTrafficController.enterNormalMode()
-
enterNormalMode
protected AbstractMRMessage enterNormalMode()
Description copied from class:AbstractMRTrafficController
Sets the system to normal mode during programming while in IDLESTATE. IfAbstractMRTrafficController.programmerIdle()
returns true, enterNormalMode() is called after a timeout.- Specified by:
enterNormalMode
in classAbstractMRTrafficController
- Returns:
- any message that needs to be returned to the Command Station to change modes. If no message is needed, returns null.
- See Also:
AbstractMRTrafficController.enterProgMode()
-
endOfMessage
protected boolean endOfMessage(AbstractMRReply msg)
This is a default, null implementation, which must be overridden in an adapter-specific subclass.
- Specified by:
endOfMessage
in classAbstractMRTrafficController
-
newReply
protected AbstractMRReply newReply()
This is a default, null implementation, which must be overridden in an adapter-specific subclass.
- Specified by:
newReply
in classAbstractMRTrafficController
-
sendInitString
public abstract void sendInitString()
-
getRange
public java.lang.String getRange()
-
-