Closed CryptoClinck closed 1 year ago
The method exists in 2.9.3:
Ps.: please format your code snippet to make it readable
Problem solved.
It was not addDataListener the cause of the error but SerialPortEventListener.
The method exists in 2.9.3:
Ps.: please format your code snippet to make it readable
Thanks for your response. I used the button "add code" to add the code but format is not working :-(
Hello,
I had code like this working with previous version of the library:
public boolean open(final String portName) { SerialPort[] ports = SerialPort.getCommPorts(); final List<SerialPort> matchingPorts = Stream.of(ports).filter(port -> port.getSystemPortName().equals(portName)).collect(Collectors.toList()); if (matchingPorts.isEmpty()) { return false; } serialPort = matchingPorts.get(0); serialPort.setComPortParameters(baudRate, dataBits, stopBits, parity); serialPort.setComPortTimeouts(SerialPort.TIMEOUT_READ_BLOCKING, 0, 0); if (serialPort.openPort()) { input = new BufferedReader(new InputStreamReader(serialPort.getInputStream())); output = serialPort.getOutputStream(); serialPort.addDataListener(this); isOpen = true; } return isOpen; }
The method addDataListener doesn't exist anymore.
What can I use instead ?
Thanks