1
0
mirror of https://github.com/mik3y/usb-serial-for-android synced 2025-06-07 16:06:10 +00:00

new getControlLines() and getSupportedControLines() methods

getControlLines() requires less USB calls than calling getRTS() + ... + getRI() individually.
getSupportedControlLines() tells you, which control lines are supported by a driver. Previously you had to check the driver implementation.
This commit is contained in:
kai-morich 2020-06-28 20:10:45 +02:00
parent 13df128226
commit 7423fd9d79
10 changed files with 181 additions and 23 deletions

View File

@ -37,6 +37,7 @@ import com.hoho.android.usbserial.util.SerialInputOutputManager;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
import java.util.EnumSet;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
public class TerminalFragment extends Fragment implements SerialInputOutputManager.Listener { public class TerminalFragment extends Fragment implements SerialInputOutputManager.Listener {
@ -312,29 +313,42 @@ public class TerminalFragment extends Fragment implements SerialInputOutputManag
if (btn.equals(rtsBtn)) { ctrl = "RTS"; usbSerialPort.setRTS(btn.isChecked()); } if (btn.equals(rtsBtn)) { ctrl = "RTS"; usbSerialPort.setRTS(btn.isChecked()); }
if (btn.equals(dtrBtn)) { ctrl = "DTR"; usbSerialPort.setDTR(btn.isChecked()); } if (btn.equals(dtrBtn)) { ctrl = "DTR"; usbSerialPort.setDTR(btn.isChecked()); }
} catch (IOException e) { } catch (IOException e) {
status("set" + ctrl + " failed: " + e.getMessage()); status("set" + ctrl + "() failed: " + e.getMessage());
} }
} }
private boolean refresh() { private boolean refresh() {
String ctrl = "";
try { try {
ctrl = "RTS"; rtsBtn.setChecked(usbSerialPort.getRTS()); EnumSet<UsbSerialPort.ControlLine> controlLines = usbSerialPort.getControlLines();
ctrl = "CTS"; ctsBtn.setChecked(usbSerialPort.getCTS()); rtsBtn.setChecked(controlLines.contains(UsbSerialPort.ControlLine.RTS));
ctrl = "DTR"; dtrBtn.setChecked(usbSerialPort.getDTR()); ctsBtn.setChecked(controlLines.contains(UsbSerialPort.ControlLine.CTS));
ctrl = "DSR"; dsrBtn.setChecked(usbSerialPort.getDSR()); dtrBtn.setChecked(controlLines.contains(UsbSerialPort.ControlLine.DTR));
ctrl = "CD"; cdBtn.setChecked(usbSerialPort.getCD()); dsrBtn.setChecked(controlLines.contains(UsbSerialPort.ControlLine.DSR));
ctrl = "RI"; riBtn.setChecked(usbSerialPort.getRI()); cdBtn.setChecked(controlLines.contains(UsbSerialPort.ControlLine.CD));
riBtn.setChecked(controlLines.contains(UsbSerialPort.ControlLine.RI));
} catch (IOException e) { } catch (IOException e) {
status("get" + ctrl + " failed: " + e.getMessage() + " -> stopped control line refresh"); status("getControlLines() failed: " + e.getMessage() + " -> stopped control line refresh");
return false; return false;
} }
return true; return true;
} }
void start() { void start() {
if (connected && refresh()) if (connected) {
mainLooper.postDelayed(runnable, refreshInterval); try {
EnumSet<UsbSerialPort.ControlLine> controlLines = usbSerialPort.getSupportedControlLines();
if (!controlLines.contains(UsbSerialPort.ControlLine.RTS)) rtsBtn.setVisibility(View.INVISIBLE);
if (!controlLines.contains(UsbSerialPort.ControlLine.CTS)) ctsBtn.setVisibility(View.INVISIBLE);
if (!controlLines.contains(UsbSerialPort.ControlLine.DTR)) dtrBtn.setVisibility(View.INVISIBLE);
if (!controlLines.contains(UsbSerialPort.ControlLine.DSR)) dsrBtn.setVisibility(View.INVISIBLE);
if (!controlLines.contains(UsbSerialPort.ControlLine.CD)) cdBtn.setVisibility(View.INVISIBLE);
if (!controlLines.contains(UsbSerialPort.ControlLine.RI)) riBtn.setVisibility(View.INVISIBLE);
} catch (IOException e) {
Toast.makeText(getActivity(), "getSupportedControlLines() failed: " + e.getMessage(), Toast.LENGTH_SHORT).show();
}
if (refresh())
mainLooper.postDelayed(runnable, refreshInterval);
}
} }
void stop() { void stop() {

View File

@ -11,7 +11,7 @@ android {
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunnerArguments = [ // Raspi Windows LinuxVM ... testInstrumentationRunnerArguments = [ // Raspi Windows LinuxVM ...
'rfc2217_server_host': '192.168.0.100', 'rfc2217_server_host': '192.168.0.110',
'rfc2217_server_nonstandard_baudrates': 'true', // true false false 'rfc2217_server_nonstandard_baudrates': 'true', // true false false
] ]
} }

View File

@ -1564,12 +1564,20 @@ public class DeviceTest implements SerialInputOutputManager.Listener {
inputLinesSupported = true; inputLinesSupported = true;
inputLinesConnected = true; inputLinesConnected = true;
} }
EnumSet<UsbSerialPort.ControlLine> supportedControlLines = EnumSet.of(UsbSerialPort.ControlLine.RTS, UsbSerialPort.ControlLine.DTR);
if(inputLinesSupported) {
supportedControlLines.add(UsbSerialPort.ControlLine.CTS);
supportedControlLines.add(UsbSerialPort.ControlLine.DSR);
supportedControlLines.add(UsbSerialPort.ControlLine.CD);
supportedControlLines.add(UsbSerialPort.ControlLine.RI);
}
usbOpen(EnumSet.of(UsbOpenFlags.NO_CONTROL_LINE_INIT)); usbOpen(EnumSet.of(UsbOpenFlags.NO_CONTROL_LINE_INIT));
usbParameters(19200, 8, 1, UsbSerialPort.PARITY_NONE); usbParameters(19200, 8, 1, UsbSerialPort.PARITY_NONE);
telnetParameters(19200, 8, 1, UsbSerialPort.PARITY_NONE); telnetParameters(19200, 8, 1, UsbSerialPort.PARITY_NONE);
Thread.sleep(sleep); Thread.sleep(sleep);
assertEquals(supportedControlLines, usbSerialPort.getSupportedControlLines());
if(usbSerialDriver instanceof ProlificSerialDriver) { if(usbSerialDriver instanceof ProlificSerialDriver) {
// the initial status is sometimes not available or wrong. // the initial status is sometimes not available or wrong.
// this is more likely if other tests have been executed before. // this is more likely if other tests have been executed before.
@ -1579,6 +1587,10 @@ public class DeviceTest implements SerialInputOutputManager.Listener {
assertTrue(usbSerialPort.getRI()); assertTrue(usbSerialPort.getRI());
} }
data = "none".getBytes(); data = "none".getBytes();
assertEquals(inputLinesConnected
? EnumSet.of(UsbSerialPort.ControlLine.RI)
: EnumSet.noneOf(UsbSerialPort.ControlLine.class),
usbSerialPort.getControlLines());
assertFalse(usbSerialPort.getRTS()); assertFalse(usbSerialPort.getRTS());
assertFalse(usbSerialPort.getCTS()); assertFalse(usbSerialPort.getCTS());
assertFalse(usbSerialPort.getDTR()); assertFalse(usbSerialPort.getDTR());
@ -1598,6 +1610,10 @@ public class DeviceTest implements SerialInputOutputManager.Listener {
data = "rts ".getBytes(); data = "rts ".getBytes();
usbSerialPort.setRTS(true); usbSerialPort.setRTS(true);
Thread.sleep(sleep); Thread.sleep(sleep);
assertEquals(inputLinesConnected
? EnumSet.of(UsbSerialPort.ControlLine.RTS, UsbSerialPort.ControlLine.CTS)
: EnumSet.of(UsbSerialPort.ControlLine.RTS),
usbSerialPort.getControlLines());
assertTrue(usbSerialPort.getRTS()); assertTrue(usbSerialPort.getRTS());
assertEquals(usbSerialPort.getCTS(), inputLinesConnected); assertEquals(usbSerialPort.getCTS(), inputLinesConnected);
assertFalse(usbSerialPort.getDTR()); assertFalse(usbSerialPort.getDTR());
@ -1612,6 +1628,10 @@ public class DeviceTest implements SerialInputOutputManager.Listener {
data = "both".getBytes(); data = "both".getBytes();
usbSerialPort.setDTR(true); usbSerialPort.setDTR(true);
Thread.sleep(sleep); Thread.sleep(sleep);
assertEquals(inputLinesConnected
? EnumSet.of(UsbSerialPort.ControlLine.RTS, UsbSerialPort.ControlLine.DTR, UsbSerialPort.ControlLine.CD)
: EnumSet.of(UsbSerialPort.ControlLine.RTS, UsbSerialPort.ControlLine.DTR),
usbSerialPort.getControlLines());
assertTrue(usbSerialPort.getRTS()); assertTrue(usbSerialPort.getRTS());
assertFalse(usbSerialPort.getCTS()); assertFalse(usbSerialPort.getCTS());
assertTrue(usbSerialPort.getDTR()); assertTrue(usbSerialPort.getDTR());
@ -1626,6 +1646,10 @@ public class DeviceTest implements SerialInputOutputManager.Listener {
data = "dtr ".getBytes(); data = "dtr ".getBytes();
usbSerialPort.setRTS(false); usbSerialPort.setRTS(false);
Thread.sleep(sleep); Thread.sleep(sleep);
assertEquals(inputLinesConnected
? EnumSet.of(UsbSerialPort.ControlLine.DTR, UsbSerialPort.ControlLine.DSR)
: EnumSet.of(UsbSerialPort.ControlLine.DTR),
usbSerialPort.getControlLines());
assertFalse(usbSerialPort.getRTS()); assertFalse(usbSerialPort.getRTS());
assertFalse(usbSerialPort.getCTS()); assertFalse(usbSerialPort.getCTS());
assertTrue(usbSerialPort.getDTR()); assertTrue(usbSerialPort.getDTR());
@ -1646,6 +1670,10 @@ public class DeviceTest implements SerialInputOutputManager.Listener {
usbOpen(EnumSet.of(UsbOpenFlags.NO_CONTROL_LINE_INIT, UsbOpenFlags.NO_IOMANAGER_THREAD)); usbOpen(EnumSet.of(UsbOpenFlags.NO_CONTROL_LINE_INIT, UsbOpenFlags.NO_IOMANAGER_THREAD));
usbParameters(19200, 8, 1, UsbSerialPort.PARITY_NONE); usbParameters(19200, 8, 1, UsbSerialPort.PARITY_NONE);
EnumSet<UsbSerialPort.ControlLine> retainedControlLines = EnumSet.noneOf(UsbSerialPort.ControlLine.class);
if(outputRetained) retainedControlLines.add(UsbSerialPort.ControlLine.DTR);
if(inputRetained) retainedControlLines.add(UsbSerialPort.ControlLine.DSR);
assertEquals(retainedControlLines, usbSerialPort.getControlLines());
assertFalse(usbSerialPort.getRTS()); assertFalse(usbSerialPort.getRTS());
assertFalse(usbSerialPort.getCTS()); assertFalse(usbSerialPort.getCTS());
assertEquals(usbSerialPort.getDTR(), outputRetained); assertEquals(usbSerialPort.getDTR(), outputRetained);

View File

@ -30,6 +30,7 @@ import android.util.Log;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.EnumSet;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -300,6 +301,18 @@ public class CdcAcmSerialDriver implements UsbSerialDriver {
sendAcmControlMessage(SET_CONTROL_LINE_STATE, value, null); sendAcmControlMessage(SET_CONTROL_LINE_STATE, value, null);
} }
@Override
public EnumSet<ControlLine> getControlLines() throws IOException {
EnumSet<ControlLine> set = EnumSet.noneOf(ControlLine.class);
if(mRts) set.add(ControlLine.RTS);
if(mDtr) set.add(ControlLine.DTR);
return set;
}
@Override
public EnumSet<ControlLine> getSupportedControlLines() throws IOException {
return EnumSet.of(ControlLine.RTS, ControlLine.DTR);
}
} }
public static Map<Integer, int[]> getSupportedDevices() { public static Map<Integer, int[]> getSupportedDevices() {

View File

@ -28,6 +28,7 @@ import android.hardware.usb.UsbInterface;
import java.io.IOException; import java.io.IOException;
import java.util.Collections; import java.util.Collections;
import java.util.EnumSet;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -173,7 +174,7 @@ public class Ch34xSerialDriver implements UsbSerialDriver {
} }
} }
private byte getControlLines() throws IOException { private byte getStatus() throws IOException {
byte[] buffer = new byte[2]; byte[] buffer = new byte[2];
int ret = controlIn(0x95, 0x0706, 0, buffer); int ret = controlIn(0x95, 0x0706, 0, buffer);
if (ret < 0) if (ret < 0)
@ -304,17 +305,17 @@ public class Ch34xSerialDriver implements UsbSerialDriver {
@Override @Override
public boolean getCD() throws IOException { public boolean getCD() throws IOException {
return (getControlLines() & GCL_CD) == 0; return (getStatus() & GCL_CD) == 0;
} }
@Override @Override
public boolean getCTS() throws IOException { public boolean getCTS() throws IOException {
return (getControlLines() & GCL_CTS) == 0; return (getStatus() & GCL_CTS) == 0;
} }
@Override @Override
public boolean getDSR() throws IOException { public boolean getDSR() throws IOException {
return (getControlLines() & GCL_DSR) == 0; return (getStatus() & GCL_DSR) == 0;
} }
@Override @Override
@ -330,7 +331,7 @@ public class Ch34xSerialDriver implements UsbSerialDriver {
@Override @Override
public boolean getRI() throws IOException { public boolean getRI() throws IOException {
return (getControlLines() & GCL_RI) == 0; return (getStatus() & GCL_RI) == 0;
} }
@Override @Override
@ -344,6 +345,23 @@ public class Ch34xSerialDriver implements UsbSerialDriver {
setControlLines(); setControlLines();
} }
@Override
public EnumSet<ControlLine> getControlLines() throws IOException {
int status = getStatus();
EnumSet<ControlLine> set = EnumSet.noneOf(ControlLine.class);
if(rts) set.add(ControlLine.RTS);
if((status & GCL_CTS) == 0) set.add(ControlLine.CTS);
if(dtr) set.add(ControlLine.DTR);
if((status & GCL_DSR) == 0) set.add(ControlLine.DSR);
if((status & GCL_CD) == 0) set.add(ControlLine.CD);
if((status & GCL_RI) == 0) set.add(ControlLine.RI);
return set;
}
@Override
public EnumSet<ControlLine> getSupportedControlLines() throws IOException {
return EnumSet.allOf(ControlLine.class);
}
} }
public static Map<Integer, int[]> getSupportedDevices() { public static Map<Integer, int[]> getSupportedDevices() {

View File

@ -29,6 +29,7 @@ import android.util.Log;
import java.io.IOException; import java.io.IOException;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.util.EnumSet;
/** /**
* A base class shared by several driver implementations. * A base class shared by several driver implementations.
@ -249,6 +250,12 @@ public abstract class CommonUsbSerialPort implements UsbSerialPort {
@Override @Override
public abstract void setRTS(boolean value) throws IOException; public abstract void setRTS(boolean value) throws IOException;
@Override
public abstract EnumSet<ControlLine> getControlLines() throws IOException;
@Override
public abstract EnumSet<ControlLine> getSupportedControlLines() throws IOException;
@Override @Override
public boolean purgeHwBuffers(boolean purgeWriteBuffers, boolean purgeReadBuffers) throws IOException { public boolean purgeHwBuffers(boolean purgeWriteBuffers, boolean purgeReadBuffers) throws IOException {
return false; return false;

View File

@ -29,6 +29,7 @@ import android.hardware.usb.UsbInterface;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.EnumSet;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -299,6 +300,19 @@ public class Cp21xxSerialDriver implements UsbSerialDriver {
setConfigSingle(SILABSER_SET_DTR_RTS_REQUEST_CODE, rts ? RTS_ENABLE : RTS_DISABLE); setConfigSingle(SILABSER_SET_DTR_RTS_REQUEST_CODE, rts ? RTS_ENABLE : RTS_DISABLE);
} }
@Override
public EnumSet<ControlLine> getControlLines() throws IOException {
EnumSet<ControlLine> set = EnumSet.noneOf(ControlLine.class);
if(rts) set.add(ControlLine.RTS);
if(dtr) set.add(ControlLine.DTR);
return set;
}
@Override
public EnumSet<ControlLine> getSupportedControlLines() throws IOException {
return EnumSet.of(ControlLine.RTS, ControlLine.DTR);
}
@Override @Override
public boolean purgeHwBuffers(boolean purgeWriteBuffers, boolean purgeReadBuffers) throws IOException { public boolean purgeHwBuffers(boolean purgeWriteBuffers, boolean purgeReadBuffers) throws IOException {
int value = (purgeReadBuffers ? FLUSH_READ_CODE : 0) int value = (purgeReadBuffers ? FLUSH_READ_CODE : 0)

View File

@ -28,6 +28,7 @@ import android.util.Log;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.EnumSet;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -527,6 +528,24 @@ public class FtdiSerialDriver implements UsbSerialDriver {
mRtsState = value; mRtsState = value;
} }
@Override
public EnumSet<ControlLine> getControlLines() throws IOException {
int status = getModemStatus();
EnumSet<ControlLine> set = EnumSet.noneOf(ControlLine.class);
if(mRtsState) set.add(ControlLine.RTS);
if((status & SIO_MODEM_STATUS_CTS) != 0) set.add(ControlLine.CTS);
if(mDtrState) set.add(ControlLine.DTR);
if((status & SIO_MODEM_STATUS_DSR) != 0) set.add(ControlLine.DSR);
if((status & SIO_MODEM_STATUS_RLSD) != 0) set.add(ControlLine.CD);
if((status & SIO_MODEM_STATUS_RI) != 0) set.add(ControlLine.RI);
return set;
}
@Override
public EnumSet<ControlLine> getSupportedControlLines() throws IOException {
return EnumSet.allOf(ControlLine.class);
}
@Override @Override
public boolean purgeHwBuffers(boolean purgeWriteBuffers, boolean purgeReadBuffers) throws IOException { public boolean purgeHwBuffers(boolean purgeWriteBuffers, boolean purgeReadBuffers) throws IOException {
if (purgeWriteBuffers) { if (purgeWriteBuffers) {

View File

@ -37,6 +37,7 @@ import android.util.Log;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.Collections; import java.util.Collections;
import java.util.EnumSet;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -426,7 +427,7 @@ public class ProlificSerialDriver implements UsbSerialDriver {
@Override @Override
public boolean getDTR() throws IOException { public boolean getDTR() throws IOException {
return ((mControlLinesValue & CONTROL_DTR) == CONTROL_DTR); return (mControlLinesValue & CONTROL_DTR) != 0;
} }
@Override @Override
@ -447,7 +448,7 @@ public class ProlificSerialDriver implements UsbSerialDriver {
@Override @Override
public boolean getRTS() throws IOException { public boolean getRTS() throws IOException {
return ((mControlLinesValue & CONTROL_RTS) == CONTROL_RTS); return (mControlLinesValue & CONTROL_RTS) != 0;
} }
@Override @Override
@ -461,6 +462,25 @@ public class ProlificSerialDriver implements UsbSerialDriver {
setControlLines(newControlLinesValue); setControlLines(newControlLinesValue);
} }
@Override
public EnumSet<ControlLine> getControlLines() throws IOException {
int status = getStatus();
EnumSet<ControlLine> set = EnumSet.noneOf(ControlLine.class);
if((mControlLinesValue & CONTROL_RTS) != 0) set.add(ControlLine.RTS);
if((status & STATUS_FLAG_CTS) != 0) set.add(ControlLine.CTS);
if((mControlLinesValue & CONTROL_DTR) != 0) set.add(ControlLine.DTR);
if((status & STATUS_FLAG_DSR) != 0) set.add(ControlLine.DSR);
if((status & STATUS_FLAG_CD) != 0) set.add(ControlLine.CD);
if((status & STATUS_FLAG_RI) != 0) set.add(ControlLine.RI);
return set;
}
@Override
public EnumSet<ControlLine> getSupportedControlLines() throws IOException {
return EnumSet.allOf(ControlLine.class);
}
@Override @Override
public boolean purgeHwBuffers(boolean purgeWriteBuffers, boolean purgeReadBuffers) throws IOException { public boolean purgeHwBuffers(boolean purgeWriteBuffers, boolean purgeReadBuffers) throws IOException {
if (purgeWriteBuffers) { if (purgeWriteBuffers) {

View File

@ -27,6 +27,7 @@ import android.hardware.usb.UsbManager;
import java.io.Closeable; import java.io.Closeable;
import java.io.IOException; import java.io.IOException;
import java.util.EnumSet;
/** /**
* Interface for a single serial port. * Interface for a single serial port.
@ -86,6 +87,12 @@ public interface UsbSerialPort extends Closeable {
/** 2 stop bits. */ /** 2 stop bits. */
public static final int STOPBITS_2 = 2; public static final int STOPBITS_2 = 2;
/** values for get[Supported]ControlLines() */
public enum ControlLine { RTS, CTS, DTR, DSR, CD, RI };
/**
* Returns the driver used by this port.
*/
public UsbSerialDriver getDriver(); public UsbSerialDriver getDriver();
/** /**
@ -100,6 +107,9 @@ public interface UsbSerialPort extends Closeable {
/** /**
* The serial number of the underlying UsbDeviceConnection, or {@code null}. * The serial number of the underlying UsbDeviceConnection, or {@code null}.
*
* @return value from {@link UsbDeviceConnection#getSerial()}
* @throws SecurityException starting with target SDK 29 (Android 10) if permission for USB device is not granted
*/ */
public String getSerial(); public String getSerial();
@ -189,8 +199,7 @@ public interface UsbSerialPort extends Closeable {
public boolean getDTR() throws IOException; public boolean getDTR() throws IOException;
/** /**
* Sets the DTR (Data Terminal Ready) bit on the underlying UART, if * Sets the DTR (Data Terminal Ready) bit on the underlying UART, if supported.
* supported.
* *
* @param value the value to set * @param value the value to set
* @throws IOException if an error occurred during writing * @throws IOException if an error occurred during writing
@ -214,14 +223,30 @@ public interface UsbSerialPort extends Closeable {
public boolean getRTS() throws IOException; public boolean getRTS() throws IOException;
/** /**
* Sets the RTS (Request To Send) bit on the underlying UART, if * Sets the RTS (Request To Send) bit on the underlying UART, if supported.
* supported.
* *
* @param value the value to set * @param value the value to set
* @throws IOException if an error occurred during writing * @throws IOException if an error occurred during writing
*/ */
public void setRTS(boolean value) throws IOException; public void setRTS(boolean value) throws IOException;
/**
* Gets all control line values from the underlying UART, if supported.
* Requires less USB calls than calling getRTS() + ... + getRI() individually.
*
* @return EnumSet.contains(...) is {@code true} if set, else {@code false}
* @throws IOException
*/
public EnumSet<ControlLine> getControlLines() throws IOException;
/**
* Gets all control line supported flags.
*
* @return EnumSet.contains(...) is {@code true} if supported, else {@code false}
* @throws IOException
*/
public EnumSet<ControlLine> getSupportedControlLines() throws IOException;
/** /**
* purge non-transmitted output data and / or non-read input data * purge non-transmitted output data and / or non-read input data
* @param purgeWriteBuffers {@code true} to discard non-transmitted output data * @param purgeWriteBuffers {@code true} to discard non-transmitted output data