|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjmri.jmrix.AbstractPortController
jmri.jmrix.AbstractSerialPortController
public abstract class AbstractSerialPortController
Provide an abstract base for *PortController classes.
This is complicated by the lack of multiple inheritance. SerialPortAdapter is an Interface, and its implementing classes also inherit from various PortController types. But we want some common behaviours for those, so we put them here.
SerialPortAdapter| Nested Class Summary | |
|---|---|
(package private) class |
AbstractSerialPortController.reconnectwait
|
| Nested classes/interfaces inherited from class jmri.jmrix.AbstractPortController |
|---|
AbstractPortController.Option |
| Field Summary | |
|---|---|
protected static org.slf4j.Logger |
log
|
protected String |
mBaudRate
|
protected String |
mPort
|
(package private) Vector<String> |
portNameVector
|
| Fields inherited from class jmri.jmrix.AbstractPortController |
|---|
allowConnectionRecovery, mDisabled, mManufacturer, opened, option1Name, option2Name, option3Name, option4Name, options, reconnectinterval, retryAttempts |
| Constructor Summary | |
|---|---|
AbstractSerialPortController()
|
|
| Method Summary | |
|---|---|
protected void |
closeConnection()
|
void |
configureBaudRate(String rate)
Set the baud rate. |
void |
connect()
Open the connection |
int |
currentBaudNumber(String currentBaudRate)
Convert a baud rate string to a number. |
void |
dispose()
|
String |
getCurrentBaudRate()
|
String |
getCurrentPortName()
|
Vector<String> |
getPortNames()
Provide a vector of valid port names, each a String. |
SystemConnectionMemo |
getSystemConnectionMemo()
|
String |
handlePortBusy(PortInUseException p,
String portName,
org.slf4j.Logger log)
Standard error handling for port-busy case |
String |
handlePortNotFound(NoSuchPortException p,
String portName,
org.slf4j.Logger log)
Standard error handling for port-not-found case |
void |
reconnect()
Attempts to reconnect to a failed Server |
void |
recover()
This is called when a connection is initially lost. |
protected void |
resetupConnection()
|
void |
setDisabled(boolean disabled)
Sets whether the connection is disabled |
void |
setPort(String port)
Remember the associated port name |
int[] |
validBaudNumber()
Get an array of valid baud rates as integers. |
| Methods inherited from class jmri.jmrix.AbstractPortController |
|---|
configureOption1, configureOption2, configureOption3, configureOption4, getDisabled, getInputStream, getManufacturer, getOption1Name, getOption2Name, getOption3Name, getOption4Name, getOptionChoices, getOptionDisplayName, getOptions, getOptionState, getOutputStream, isOptionAdvanced, safeSleep, setClosed, setManufacturer, setOpened, setOptionState, 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.SerialPortAdapter |
|---|
configure, configureOption1, configureOption2, configureOption3, configureOption4, getManufacturer, openPort, setManufacturer, status, validBaudRates |
| Methods inherited from interface jmri.jmrix.PortAdapter |
|---|
getDisabled, getInputStream, getOption1Name, getOption2Name, getOption3Name, getOption4Name, getOptionChoices, getOptionDisplayName, getOptions, getOptionState, getOutputStream, isOptionAdvanced, setOptionState |
| Field Detail |
|---|
protected String mPort
protected String mBaudRate
Vector<String> portNameVector
protected static final org.slf4j.Logger log
| Constructor Detail |
|---|
public AbstractSerialPortController()
| Method Detail |
|---|
public String handlePortBusy(PortInUseException p,
String portName,
org.slf4j.Logger log)
handlePortBusy in interface SerialPortAdapterAbstractSerialPortController
public String handlePortNotFound(NoSuchPortException p,
String portName,
org.slf4j.Logger log)
public void connect()
throws Exception
PortAdapter
connect in interface PortAdapterExceptionpublic void setPort(String port)
SerialPortAdapter
setPort in interface SerialPortAdapterpublic String getCurrentPortName()
getCurrentPortName in interface PortAdaptergetCurrentPortName in interface SerialPortAdaptergetCurrentPortName in class AbstractPortControllerpublic void configureBaudRate(String rate)
configureBaudRate in interface SerialPortAdapterpublic String getCurrentBaudRate()
getCurrentBaudRate in interface SerialPortAdapterpublic int[] validBaudNumber()
public int currentBaudNumber(String currentBaudRate)
public Vector<String> getPortNames()
SerialPortAdapter
getPortNames in interface SerialPortAdapterpublic SystemConnectionMemo getSystemConnectionMemo()
getSystemConnectionMemo in interface PortAdaptergetSystemConnectionMemo in class AbstractPortControllerpublic void setDisabled(boolean disabled)
PortAdapter
setDisabled in interface PortAdaptersetDisabled in class AbstractPortControllerpublic void dispose()
dispose in interface PortAdapterpublic void recover()
recover in interface PortAdapterrecover in class AbstractPortController
protected void closeConnection()
throws Exception
Exceptionprotected void resetupConnection()
public void reconnect()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||