Witam,
mam problem z obsługą portu COM na którym mam podłączone urządzenia na bluetooth.
Program po stronie urządzenia jak i połączenie jest na 100% dobre, w Arduino serial monitor widze odpowiednie dane i moge wysyłać do urządzenia swoje. Problem jest po stronie kodu w javie. Przy połącznieniu USB i zmianie portu jest wszystko ok, ale przy porcie gdzie komuniakcja jest przez BT coś nie gra :/.
Obecnie wywala "Error 0x490 at ..\rxtx\src\termios.c(892): Nie można odnaleźć elementu."
Wcześniej przechodził przez proces inicjalizacji i zwracał true ale niee odbierał żadnych danych ani nie mogłem nic wysłać.
Zapewne problem jest błachy ale potrafie go zlokalizować. Być może ma ktoś przykład działającej komuniakcji, chętnie podpatrzę.

package sensor;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;

import gnu.io.CommPortIdentifier;
import gnu.io.SerialPort;
import gnu.io.SerialPortEvent;
import gnu.io.SerialPortEventListener;

public class ArduinoReader implements SerialPortEventListener, Runnable {

	SerialPort serialPort;
	private static final String PORT_NAME = "COM23";

	private BufferedReader input;
	public static OutputStream output;

	private static final int TIME_OUT = 2000;
	private static final int DATA_RATE = 9600;

	public void initialize() {
		CommPortIdentifier portId;
		try {
			portId = CommPortIdentifier.getPortIdentifier(PORT_NAME);

			serialPort = (SerialPort) portId.open(this.getClass().getName(), TIME_OUT);
			serialPort.setSerialPortParams(DATA_RATE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1,
					SerialPort.PARITY_NONE);
			input = new BufferedReader(new InputStreamReader(serialPort.getInputStream()));
			output = serialPort.getOutputStream();
			serialPort.addEventListener(this);
			serialPort.notifyOnDataAvailable(true);
		} catch (Exception e) {
			System.err.println(e.toString());
		}
	}

	public synchronized void close() {
		if (serialPort != null) {
			serialPort.removeEventListener();
			serialPort.close();
			
		}
	}

	public synchronized void serialEvent(SerialPortEvent oEvent) {
		if (oEvent.getEventType() == SerialPortEvent.DATA_AVAILABLE) {
			try {
				String inputLine = input.readLine();
				if (inputLine != null) {
System.out.println("xx");
				}
			} catch (Exception e) {
				System.err.println(e.toString());
			}
		}
	}




	public static synchronized void writeData(String data) {
		System.out.println("Sent: " + data);
		try {
			output.write(data.getBytes());
		} catch (Exception e) {
			System.out.println("could not write to port");
		}
	}






	@Override
	public void run() {
		try {
			Thread.sleep(999999999);
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		close();
	}



}