Package jmri.jmrix.fakeport
Class FakeSerialPort
- java.lang.Object
-
- jmri.jmrix.fakeport.FakeSerialPort
-
- All Implemented Interfaces:
SerialPort
public class FakeSerialPort extends java.lang.Object implements SerialPort
Implementation of a fake serial port.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jmri.jmrix.SerialPort
SerialPort.Parity
-
-
Field Summary
-
Fields inherited from interface jmri.jmrix.SerialPort
LISTENING_EVENT_DATA_AVAILABLE, NO_PARITY, ONE_STOP_BIT
-
-
Constructor Summary
Constructors Constructor Description FakeSerialPort()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDataListener(SerialPortDataListener listener)
void
clearBreak()
void
clearDTR()
void
clearRTS()
void
closePort()
int
getBaudRate()
boolean
getCTS()
boolean
getDCD()
java.lang.String
getDescriptivePortName()
boolean
getDSR()
boolean
getDTR()
int
getFlowControlSettings()
java.io.InputStream
getInputStream()
int
getNumDataBits()
int
getNumStopBits()
java.io.OutputStream
getOutputStream()
SerialPort.Parity
getParity()
boolean
getRI()
boolean
getRTS()
void
setBaudRate(int baudrate)
void
setBreak()
boolean
setComPortTimeouts(int newTimeoutMode, int newReadTimeout, int newWriteTimeout)
void
setDTR()
void
setFlowControl(AbstractSerialPortController.FlowControl flow)
Configure the flow control settings.void
setNumDataBits(int bits)
void
setNumStopBits(int bits)
void
setParity(SerialPort.Parity parity)
void
setRTS()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jmri.jmrix.SerialPort
toString
-
-
-
-
Constructor Detail
-
FakeSerialPort
public FakeSerialPort()
-
-
Method Detail
-
addDataListener
public void addDataListener(SerialPortDataListener listener)
- Specified by:
addDataListener
in interfaceSerialPort
-
getInputStream
public java.io.InputStream getInputStream()
- Specified by:
getInputStream
in interfaceSerialPort
-
getOutputStream
public java.io.OutputStream getOutputStream()
- Specified by:
getOutputStream
in interfaceSerialPort
-
setRTS
public void setRTS()
- Specified by:
setRTS
in interfaceSerialPort
-
clearRTS
public void clearRTS()
- Specified by:
clearRTS
in interfaceSerialPort
-
setBaudRate
public void setBaudRate(int baudrate)
- Specified by:
setBaudRate
in interfaceSerialPort
-
getBaudRate
public int getBaudRate()
- Specified by:
getBaudRate
in interfaceSerialPort
-
setNumDataBits
public void setNumDataBits(int bits)
- Specified by:
setNumDataBits
in interfaceSerialPort
-
getNumDataBits
public int getNumDataBits()
- Specified by:
getNumDataBits
in interfaceSerialPort
-
setNumStopBits
public void setNumStopBits(int bits)
- Specified by:
setNumStopBits
in interfaceSerialPort
-
getNumStopBits
public int getNumStopBits()
- Specified by:
getNumStopBits
in interfaceSerialPort
-
setParity
public void setParity(SerialPort.Parity parity)
- Specified by:
setParity
in interfaceSerialPort
-
getParity
public SerialPort.Parity getParity()
- Specified by:
getParity
in interfaceSerialPort
-
setDTR
public void setDTR()
- Specified by:
setDTR
in interfaceSerialPort
-
clearDTR
public void clearDTR()
- Specified by:
clearDTR
in interfaceSerialPort
-
getDTR
public boolean getDTR()
- Specified by:
getDTR
in interfaceSerialPort
-
getRTS
public boolean getRTS()
- Specified by:
getRTS
in interfaceSerialPort
-
getDSR
public boolean getDSR()
- Specified by:
getDSR
in interfaceSerialPort
-
getCTS
public boolean getCTS()
- Specified by:
getCTS
in interfaceSerialPort
-
getDCD
public boolean getDCD()
- Specified by:
getDCD
in interfaceSerialPort
-
getRI
public boolean getRI()
- Specified by:
getRI
in interfaceSerialPort
-
setFlowControl
public void setFlowControl(AbstractSerialPortController.FlowControl flow)
Description copied from interface:SerialPort
Configure the flow control settings. Keep this in synch with the FlowControl enum.- Specified by:
setFlowControl
in interfaceSerialPort
- Parameters:
flow
- set which kind of flow control to use
-
setBreak
public void setBreak()
- Specified by:
setBreak
in interfaceSerialPort
-
clearBreak
public void clearBreak()
- Specified by:
clearBreak
in interfaceSerialPort
-
getFlowControlSettings
public int getFlowControlSettings()
- Specified by:
getFlowControlSettings
in interfaceSerialPort
-
setComPortTimeouts
public boolean setComPortTimeouts(int newTimeoutMode, int newReadTimeout, int newWriteTimeout)
- Specified by:
setComPortTimeouts
in interfaceSerialPort
-
closePort
public void closePort()
- Specified by:
closePort
in interfaceSerialPort
-
getDescriptivePortName
public java.lang.String getDescriptivePortName()
- Specified by:
getDescriptivePortName
in interfaceSerialPort
-
-