alejanrobellotti / java-simple-serial-connector

Automatically exported from code.google.com/p/java-simple-serial-connector
0 stars 0 forks source link

Port opened by other programs then makes that jSSC reads corrupted data. #21

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. I run my program and use jSSC without problems.
2. Close port without problems.
3. Open another program that uses the same port.
4. Use without problem.
5. Close port without problems.
6. I open again my program but this time the read data by jSSC are corrupted.
7. Close port and I read the source of información using a type hyperterminal 
program and the bytes sent are correct.

What is the expected output? What do you see instead?
I read bytes corrupted without any pattern of modification.

What version of the product are you using? On what operating system?
0.9.0 - WinXp

Please provide any additional information below
I turn on the PC and I use my program with JSSC. Then use another program and 
when I return to use my program with jSSC I received corrupt data. Restart the 
PC and my program starts running again.

Original issue reported on code.google.com by Nelson.L...@gmail.com on 4 Nov 2012 at 12:58

GoogleCodeExporter commented 8 years ago
Can you please attach your code example. It can be only if you don't use 
setParams() method because then port opens by some another program it get the 
last settings of serial port setted by previous application, that's why you 
should use setParams() method.

Original comment by scream3r.org@gmail.com on 5 Nov 2012 at 12:55

GoogleCodeExporter commented 8 years ago
Hello, this part of code initializes the port:
        try {
            serialPort.openPort();//Open serial port
            serialPort.setParams(SerialPort.BAUDRATE_38400, 
                                 SerialPort.DATABITS_8, 
                                 SerialPort.STOPBITS_1, 
                                 SerialPort.PARITY_NONE);
            jLabelPortLog.setText("¡Puerto abierto!");
            serialPort.writeBytes("q".getBytes());
            buffer = serialPort.readBytes(13);
        }
        catch (SerialPortException ex) {
            System.out.println(ex);
        }

Original comment by Nelson.L...@gmail.com on 5 Nov 2012 at 1:00

GoogleCodeExporter commented 8 years ago
Fixed in 2.1.0

Original comment by scream3r.org@gmail.com on 16 Apr 2013 at 7:55