@Override public void closePort() throws Exception { if (this.serialPort != null) { try { this.serialPort.removeEventListener(); if (this.serialPort.isOpened()) { this.serialPort.closePort(); } } finally { this.serialPort = null; } } }
@Override public int shutDown() { if (serialPort.isOpened()) { try { serialPort.removeEventListener(); serialPort.closePort(); return 1; } catch (SerialPortException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } return -1; }
@Override public void closeImpl() throws IOException { try { this.port.removeEventListener(); //Remove the listener } catch (jssc.SerialPortException e) { throw new IOException(e); } }
@Override public void closeConnection() { if (portOpened) { if (serialPort != null) { try { serialPort.removeEventListener(); serialPort.closePort(); } catch (SerialPortException e) { } } portOpened = false; } }
/** * Close the connection to the serial port. * * @throws IOException */ public void close() throws IOException { try { serialReader.close(); serialPort.removeEventListener(); serialPort.closePort(); } catch (final SerialPortException e) { throw new IOException(e); } }
/** * Close the connection to the serial port. * * @throws IOException */ public void close() throws IOException { try { serialReader.close(); serialPort.removeEventListener(); serialPort.closePort(); } catch (final SerialPortException e) { throw new IOException(e); } }
/** * {@inheritDoc} * * @see java.lang.Object#finalize() */ @Override protected void finalize() throws Throwable { if (serialPort.isOpened()) { serialReader.close(); serialPort.removeEventListener(); serialPort.closePort(); } super.finalize(); }
/** * {@inheritDoc} * * @see java.lang.Object#finalize() */ @Override protected void finalize() throws Throwable { if (serialPort.isOpened()) { serialReader.close(); serialPort.removeEventListener(); serialPort.closePort(); } super.finalize(); }