001package jmri.jmrix.fakeport;
002
003import java.io.InputStream;
004import java.io.OutputStream;
005
006import jmri.jmrix.*;
007
008/**
009 * Implementation of a fake serial port.
010 *
011 * @author Daniel Bergqvist (C) 2024
012 */
013public class FakeSerialPort implements SerialPort {
014
015    @Override
016    public void addDataListener(SerialPortDataListener listener) {
017        // Do nothing
018    }
019
020    @Override
021    public InputStream getInputStream() {
022        return InputStream.nullInputStream();
023    }
024
025    @Override
026    public OutputStream getOutputStream() {
027        return OutputStream.nullOutputStream();
028    }
029
030    @Override
031    public void setRTS() {
032        // Do nothing
033    }
034
035    @Override
036    public void clearRTS() {
037        // Do nothing
038    }
039
040    @Override
041    public void setBaudRate(int baudrate) {
042        // Do nothing
043    }
044
045    @Override
046    public int getBaudRate() {
047        return 9600;
048    }
049
050    @Override
051    public void setNumDataBits(int bits) {
052        // Do nothing
053    }
054
055    @Override
056    public int getNumDataBits() {
057        return 8;
058    }
059
060    @Override
061    public void setNumStopBits(int bits) {
062        // Do nothing
063    }
064
065    @Override
066    public int getNumStopBits() {
067        return 1;
068    }
069
070    @Override
071    public void setParity(Parity parity) {
072        // Do nothing
073    }
074
075    @Override
076    public Parity getParity() {
077        return Parity.NONE;
078    }
079
080    @Override
081    public void setDTR() {
082        // Do nothing
083    }
084
085    @Override
086    public void clearDTR() {
087        // Do nothing
088    }
089
090    @Override
091    public boolean getDTR() {
092        return false;
093    }
094
095    @Override
096    public boolean getRTS() {
097        return false;
098    }
099
100    @Override
101    public boolean getDSR() {
102        return false;
103    }
104
105    @Override
106    public boolean getCTS() {
107        return false;
108    }
109
110    @Override
111    public boolean getDCD() {
112        return false;
113    }
114
115    @Override
116    public boolean getRI() {
117        return false;
118    }
119
120    @Override
121    public void setFlowControl(AbstractSerialPortController.FlowControl flow) {
122        // Do nothing
123    }
124
125    @Override
126    public void setBreak() {
127        // Do nothing
128    }
129
130    @Override
131    public void clearBreak() {
132        // Do nothing
133    }
134
135    @Override
136    public int getFlowControlSettings() {
137        return 0;
138    }
139
140    @Override
141    public boolean setComPortTimeouts(int newTimeoutMode, int newReadTimeout, int newWriteTimeout) {
142        return true;
143    }
144
145    @Override
146    public void closePort() {
147        // Do nothing
148    }
149
150    @Override
151    public String getDescriptivePortName() {
152        return "FakePort";
153    }
154
155}