(String iname)
| 96 | } |
| 97 | |
| 98 | public static boolean touchForCDCReset(String iname) throws SerialException { |
| 99 | SerialPort serialPort = new SerialPort(iname); |
| 100 | try { |
| 101 | serialPort.openPort(); |
| 102 | serialPort.setParams(1200, 8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); |
| 103 | serialPort.setDTR(false); |
| 104 | serialPort.closePort(); |
| 105 | return true; |
| 106 | } catch (SerialPortException e) { |
| 107 | throw new SerialException(format(tr("Error touching serial port ''{0}''."), iname), e); |
| 108 | } finally { |
| 109 | if (serialPort.isOpened()) { |
| 110 | try { |
| 111 | serialPort.closePort(); |
| 112 | } catch (SerialPortException e) { |
| 113 | // noop |
| 114 | } |
| 115 | } |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | protected Serial(String iname, int irate, char iparity, int idatabits, float istopbits, boolean setRTS, boolean setDTR) throws SerialException { |
| 120 | //if (port != null) port.close(); |
no test coverage detected