port.notifyOnOutputEmpty(true);
port.notifyOnOverrunError(true);
port.notifyOnParityError(true);
port.notifyOnRingIndicator(true);
try {
port.addEventListener(new SerialPortEventListener() {
public void serialEvent(SerialPortEvent event) {
int type = event.getEventType();
switch (type) {
case SerialPortEvent.OUTPUT_BUFFER_EMPTY: