package android.serialport.api.sample; import java.io.File; import java.io.IOException; import java.security.InvalidParameterException; import android.serialport.api.SerialPort; import android.serialport.api.SerialPortFinder; public class KNX_Serialport { public SerialPortFinder mSerialPortFinder = new SerialPortFinder(); private SerialPort mSerialPort = null; public SerialPort getSerialPort() throws SecurityException, IOException, InvalidParameterException { if (mSerialPort == null) { mSerialPort = new SerialPort(new File("/dev/ttyS2"), 19200, 0); } return mSerialPort; } public void closeSerialPort() { if (mSerialPort != null) { mSerialPort.close(); mSerialPort = null; } } }