Package jmri.jmrix.bidib.simulator
Class BiDiBSimulatorAdapter
java.lang.Object
jmri.jmrix.AbstractPortController
jmri.jmrix.AbstractSerialPortController
jmri.jmrix.bidib.BiDiBSerialPortController
jmri.jmrix.bidib.simulator.BiDiBSimulatorAdapter
- All Implemented Interfaces:
BiDiBPortController,PortAdapter,SerialPortAdapter
Provide access to a simulated BiDiB system.
-
Nested Class Summary
Nested classes/interfaces inherited from class jmri.jmrix.AbstractSerialPortController
AbstractSerialPortController.Blocking, AbstractSerialPortController.FlowControlNested classes/interfaces inherited from class jmri.jmrix.AbstractPortController
AbstractPortController.Option -
Field Summary
FieldsFields inherited from class jmri.jmrix.bidib.BiDiBSerialPortController
bidib, contextFields inherited from class jmri.jmrix.AbstractSerialPortController
currentSerialPort, mBaudRate, mPortFields inherited from class jmri.jmrix.AbstractPortController
allowConnectionRecovery, manufacturerName, opened, option1Name, option2Name, option3Name, option4Name, options, reconnectinterval, reconnectMaxAttempts, reconnectMaxInterval -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidSet up all of the other objects to operate with a BiDiBSimulator connected to this portOverridden in simulator adapter classes to return "";Get the InputStream from the port.Get the outputStream to the port.Get the physical port name used with jbidibcbooleanisDirty()Determine if configuration needs to be written to disk.booleanDetermine if application needs to be restarted for configuration changes to be applied.Here we do not really open something.voidregisterAllListeners(org.bidib.jbidibc.messages.ConnectionListener connectionListener, Set<org.bidib.jbidibc.core.NodeListener> nodeListeners, Set<org.bidib.jbidibc.core.MessageListener> messageListeners, Set<org.bidib.jbidibc.core.node.listener.TransferListener> transferListeners) Register all Listeners to the specific BiDiB Object.voidbooleanstatus()Query the status of this connection.Methods inherited from class jmri.jmrix.bidib.BiDiBSerialPortController
getContext, getSystemConnectionMemoMethods inherited from class jmri.jmrix.AbstractSerialPortController
activatePort, activatePort, activatePort, closeConnection, closeSerialPort, configureBaudRate, configureBaudRateFromIndex, configureBaudRateFromNumber, configureLeads, configureLeadsAndFlowControl, configureLeadsAndFlowControl, connect, currentBaudNumber, defaultBaudIndex, getActualPortNames, getCurrentBaudIndex, getCurrentBaudNumber, getCurrentBaudRate, getFlowControl, getPortSettingsString, handlePortBusy, handlePortNotFound, handlePortNotFound, isPortOpen, replacePortWithFakePort, reportPortStatus, resetupConnection, setBaudRate, setComPortTimeouts, setDataListener, setFlowControl, setPort, validBaudNumbers, validBaudRatesMethods inherited from class jmri.jmrix.AbstractPortController
configureOption1, configureOption2, configureOption3, configureOption4, dispose, getDisabled, getManufacturer, getOption1Name, getOption2Name, getOption3Name, getOption4Name, getOptionChoices, getOptionDisplayName, getOptions, getOptionState, getReconnectMaxAttempts, getReconnectMaxInterval, getSystemPrefix, getUserName, isOptionAdvanced, isOptionTypePassword, isOptionTypeText, purgeStream, reconnect, reconnectFromLoop, recover, safeSleep, setClosed, setDisabled, setManufacturer, setOpened, setOptionState, setReconnectMaxAttempts, setReconnectMaxInterval, setSystemConnectionMemo, setSystemPrefix, setUserNameMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface jmri.jmrix.PortAdapter
connect, dispose, getDisabled, getOption1Name, getOption2Name, getOption3Name, getOption4Name, getOptionChoices, getOptionDisplayName, getOptions, getOptionState, getReconnectMaxAttempts, getReconnectMaxInterval, getSystemPrefix, getUserName, isOptionAdvanced, isOptionTypePassword, isOptionTypeText, recover, setDisabled, setOptionState, setReconnectMaxAttempts, setReconnectMaxInterval, setSystemConnectionMemo, setSystemPrefix, setUserNameMethods inherited from interface jmri.jmrix.SerialPortAdapter
configureOption1, configureOption2, configureOption3, configureOption4, getManufacturer, getPortNames, setManufacturer
-
Field Details
-
simulationFile
-
loadedSimulationFilename
-
absoluteSimulationFile
-
-
Constructor Details
-
BiDiBSimulatorAdapter
public BiDiBSimulatorAdapter()
-
-
Method Details
-
getSimulationFile
-
setSimulationFile
-
isDirty
Description copied from interface:PortAdapterDetermine if configuration needs to be written to disk.- Specified by:
isDirtyin interfacePortAdapter- Overrides:
isDirtyin classAbstractPortController- Returns:
- true if configuration needs to be saved, false otherwise
-
isRestartRequired
Description copied from interface:PortAdapterDetermine if application needs to be restarted for configuration changes to be applied.- Specified by:
isRestartRequiredin interfacePortAdapter- Overrides:
isRestartRequiredin classAbstractPortController- Returns:
- true if application needs to restart, false otherwise
-
getCurrentPortName
Overridden in simulator adapter classes to return "";- Specified by:
getCurrentPortNamein interfacePortAdapter- Specified by:
getCurrentPortNamein interfaceSerialPortAdapter- Overrides:
getCurrentPortNamein classAbstractSerialPortController
-
getRealPortName
Get the physical port name used with jbidibc Get the "port name" in the format which is used by jbidibc - this is absolute path to the simulation XML file- Specified by:
getRealPortNamein interfaceBiDiBPortController- Overrides:
getRealPortNamein classBiDiBSerialPortController- Returns:
- real port name
-
openPort
Here we do not really open something.- Parameters:
fileName- name of simulation fileappName- not used- Returns:
- error string, null if no error
-
configure
Set up all of the other objects to operate with a BiDiBSimulator connected to this port -
registerAllListeners
public void registerAllListeners(org.bidib.jbidibc.messages.ConnectionListener connectionListener, Set<org.bidib.jbidibc.core.NodeListener> nodeListeners, Set<org.bidib.jbidibc.core.MessageListener> messageListeners, Set<org.bidib.jbidibc.core.node.listener.TransferListener> transferListeners) Register all Listeners to the specific BiDiB Object. We need this here since the BidibInterface does not provide this method.- Specified by:
registerAllListenersin interfaceBiDiBPortController- Specified by:
registerAllListenersin classBiDiBSerialPortController- Parameters:
connectionListener- where to addnodeListeners- listeners to addmessageListeners- listeners to addtransferListeners- listeners to add
-
getInputStream
Get the InputStream from the port.- Specified by:
getInputStreamin interfacePortAdapter- Overrides:
getInputStreamin classAbstractSerialPortController- Returns:
- the InputStream from the port
-
getOutputStream
Get the outputStream to the port.- Specified by:
getOutputStreamin interfacePortAdapter- Overrides:
getOutputStreamin classAbstractSerialPortController- Returns:
- the outputStream to the port
-
status
Query the status of this connection. This is a question of configuration, not transient hardware status.- Specified by:
statusin interfacePortAdapter- Specified by:
statusin interfaceSerialPortAdapter- Overrides:
statusin classAbstractPortController- Returns:
- true if OK, at least as far as known
-