Class GcSerialDriverAdapter
- java.lang.Object
-
- jmri.jmrix.AbstractPortController
-
- jmri.jmrix.AbstractSerialPortController
-
- jmri.jmrix.can.adapters.gridconnect.GcPortController
-
- jmri.jmrix.can.adapters.gridconnect.GcSerialDriverAdapter
-
- All Implemented Interfaces:
PortAdapter
,SerialPortAdapter
- Direct Known Subclasses:
CanisbSerialDriverAdapter
,PiLccSerialDriverAdapter
,PiSprog3SerialDriverAdapter
,SerialDriverAdapter
,SerialDriverAdapter
,SerialDriverAdapter
,SerialDriverAdapter
,SerialDriverAdapter
,Sprog3PlusSerialDriverAdapter
public class GcSerialDriverAdapter extends GcPortController
Implements SerialPortAdapter for the GridConnect protocol.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jmri.jmrix.AbstractSerialPortController
AbstractSerialPortController.Blocking, AbstractSerialPortController.FlowControl, AbstractSerialPortController.Parity, AbstractSerialPortController.SerialPort, AbstractSerialPortController.SerialPortDataListener, AbstractSerialPortController.SerialPortEvent
-
Nested classes/interfaces inherited from class jmri.jmrix.AbstractPortController
AbstractPortController.Option
-
-
Field Summary
Fields Modifier and Type Field Description protected AbstractSerialPortController.FlowControl
flowControl
(package private) java.io.InputStream
serialStream
-
Fields inherited from class jmri.jmrix.AbstractSerialPortController
currentSerialPort, mBaudRate, mPort
-
Fields inherited from class jmri.jmrix.AbstractPortController
allowConnectionRecovery, manufacturerName, opened, option1Name, option2Name, option3Name, option4Name, options, reconnectinterval, reconnectMaxAttempts, reconnectMaxInterval
-
-
Constructor Summary
Constructors Constructor Description GcSerialDriverAdapter()
Creates a new CAN GridConnect Network Driver Adapter.GcSerialDriverAdapter(java.lang.String prefix)
Creates a new CAN GridConnect Network Driver Adapter.GcSerialDriverAdapter(java.lang.String prefix, AbstractSerialPortController.FlowControl flow)
Creates a new CAN GridConnect Network Driver Adapter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
closeConnection()
Abstract class for controllers to close the connection.void
configure()
Set up all of the other objects to operate with a CAN RS adapter connected to this port.int
defaultBaudIndex()
Get the index of the default port speed for this adapter from the validSpeeds and validRates arrays.java.io.DataInputStream
getInputStream()
Base class methods for the PortController interface.protected void
localSetFlowControl()
Local set up the flow contro, here to allow overrideprotected GcTrafficController
makeGcTrafficController()
Make a new GC Traffic Controller.java.lang.String
openPort(java.lang.String portName, java.lang.String appName)
Open a specified port.protected void
resetupConnection()
Re-setup the connection.int[]
validBaudNumbers()
Get an array of valid baud rates.java.lang.String[]
validBaudRates()
Get an array of valid baud rate strings; used to display valid options in Connections Preferences.-
Methods inherited from class jmri.jmrix.can.adapters.gridconnect.GcPortController
getSystemConnectionMemo
-
Methods inherited from class jmri.jmrix.AbstractSerialPortController
activatePort, activatePort, activatePort, closeSerialPort, configureBaudRate, configureBaudRateFromIndex, configureBaudRateFromNumber, configureLeads, configureLeadsAndFlowControl, configureLeadsAndFlowControl, connect, currentBaudNumber, getActualPortNames, getCurrentBaudIndex, getCurrentBaudNumber, getCurrentBaudRate, getCurrentPortName, getFlowControl, getOutputStream, handlePortBusy, handlePortNotFound, handlePortNotFound, reportPortStatus, setBaudRate, setComPortTimeouts, setDataListener, setFlowControl, setParity, setPort
-
Methods 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, isDirty, isOptionAdvanced, isOptionTypePassword, isOptionTypeText, isRestartRequired, purgeStream, reconnect, reconnectFromLoop, recover, safeSleep, setClosed, setDisabled, setManufacturer, setOpened, setOptionState, setReconnectMaxAttempts, setReconnectMaxInterval, setSystemConnectionMemo, setSystemPrefix, setUserName, status
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jmri.jmrix.PortAdapter
dispose, getDisabled, getOption1Name, getOption2Name, getOption3Name, getOption4Name, getOptionChoices, getOptionDisplayName, getOptions, getOptionState, getReconnectMaxAttempts, getReconnectMaxInterval, getSystemPrefix, getUserName, isDirty, isOptionAdvanced, isOptionTypePassword, isOptionTypeText, isRestartRequired, recover, setDisabled, setOptionState, setReconnectMaxAttempts, setReconnectMaxInterval, setSystemConnectionMemo, setSystemPrefix, setUserName
-
Methods inherited from interface jmri.jmrix.SerialPortAdapter
configureOption1, configureOption2, configureOption3, configureOption4, getManufacturer, getPortNames, setManufacturer, status
-
-
-
-
Field Detail
-
flowControl
protected AbstractSerialPortController.FlowControl flowControl
-
serialStream
java.io.InputStream serialStream
-
-
Constructor Detail
-
GcSerialDriverAdapter
public GcSerialDriverAdapter()
Creates a new CAN GridConnect Network Driver Adapter.
-
GcSerialDriverAdapter
public GcSerialDriverAdapter(java.lang.String prefix)
Creates a new CAN GridConnect Network Driver Adapter.Allows for default systemPrefix other than "M".
- Parameters:
prefix
- System Prefix.
-
GcSerialDriverAdapter
public GcSerialDriverAdapter(java.lang.String prefix, AbstractSerialPortController.FlowControl flow)
Creates a new CAN GridConnect Network Driver Adapter.Allows for default systemPrefix other than "M".
- Parameters:
prefix
- System Prefix.flow
- flow control, true for RTS/CTS
-
-
Method Detail
-
openPort
public java.lang.String openPort(java.lang.String portName, java.lang.String appName)
Open a specified port.- Parameters:
portName
- name tu use for this portappName
- provided to the underlying OS during startup so that it can show on status displays, etc.- Returns:
- null indicates OK return, else error message.
-
localSetFlowControl
protected void localSetFlowControl()
Local set up the flow contro, here to allow override
-
configure
public void configure()
Set up all of the other objects to operate with a CAN RS adapter connected to this port. Configure all of the other jmrix widgets needed to work with this adapter.
-
resetupConnection
protected void resetupConnection()
Re-setup the connection. Called when the physical connection has reconnected and can be linked to this connection. Each port adapter should handle this and it should be abstract. Reconnects to Traffic Controller. Updates connection status.- Overrides:
resetupConnection
in classAbstractSerialPortController
-
closeConnection
protected void closeConnection()
Abstract class for controllers to close the connection. Called prior to any re-connection attempts. Each serial port adapter should handle this and it should be abstract. Closes serial streams.- Overrides:
closeConnection
in classAbstractSerialPortController
-
makeGcTrafficController
protected GcTrafficController makeGcTrafficController()
Make a new GC Traffic Controller.- Returns:
- new GridConnect Traffic Controller.
-
getInputStream
public java.io.DataInputStream getInputStream()
Base class methods for the PortController interface. Get the InputStream from the port.- Specified by:
getInputStream
in interfacePortAdapter
- Overrides:
getInputStream
in classAbstractSerialPortController
- Returns:
- the InputStream from the port
-
validBaudRates
public java.lang.String[] validBaudRates()
Get an array of valid baud rate strings; used to display valid options in Connections Preferences.- Specified by:
validBaudRates
in interfaceSerialPortAdapter
- Overrides:
validBaudRates
in classAbstractSerialPortController
- Returns:
- array of localized valid baud rates
-
validBaudNumbers
public int[] validBaudNumbers()
Get an array of valid baud rates.- Specified by:
validBaudNumbers
in interfaceSerialPortAdapter
- Overrides:
validBaudNumbers
in classAbstractSerialPortController
- Returns:
- valid baud rates
-
defaultBaudIndex
public int defaultBaudIndex()
Get the index of the default port speed for this adapter from the validSpeeds and validRates arrays.- Specified by:
defaultBaudIndex
in interfaceSerialPortAdapter
- Overrides:
defaultBaudIndex
in classAbstractSerialPortController
- Returns:
- -1 to indicate not supported, unless overridden in adapter
-
-