very new to serial programming and to Java so please excuse me if the question
is simple.
What steps will reproduce the problem?
1. the serial port code:
public void serialEvent(SerialPortEvent event) {
System.out.println(event.getEventValue());
if(event.isRXCHAR()){//If data is available
if(event.getEventValue() == 5){//Check bytes count in the input buffer
//Read data, if 10 bytes available
try {
byte[] buffer = serialPort.readBytes(10);
System.out.println(buffer);
cps.write(buffer);
}
catch (SerialPortException ex) {
System.out.println(ex + "what happened here?");
} catch (IOException ex) {
Logger.getLogger(Simple.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
else if(event.isCTS()){//If CTS line has changed state
if(event.getEventValue() == 1){//If line is ON
System.out.println("CTS - ON");
}
else {
System.out.println("CTS - OFF");
}
}
else if(event.isDSR()){///If DSR line has changed state
if(event.getEventValue() == 1){//If line is ON
System.out.println("DSR - ON");
}
else {
System.out.println("DSR - OFF");
}
}
}
}
2. I the Output of this code only appears to be the index of the items. If I
send characters through 232 port regardless of what I send the out put is '1'
then '2' then '3' etc. when it gets to '5' (10 bytes?) it seems to shutdown.
the IDM directs me to the line with the readBytes(10).
3. I am hoping to take text input from this 232 connection and display it, so
for only index numbers an only 5 of those.
What version of the product are you using? On what operating system?
Jssc 2.6
Product Version: NetBeans IDE 8.0 (Build 201403101706)
Updates: Updates available to version NetBeans 8.0.2 Patch 1
Java: 1.7.0_60; Java HotSpot(TM) 64-Bit Server VM 24.60-b09
Runtime: Java(TM) SE Runtime Environment 1.7.0_60-b19
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Thanks in advance!
Original issue reported on code.google.com by johnnysl...@yahoo.com on 3 Apr 2015 at 2:20
Original issue reported on code.google.com by
johnnysl...@yahoo.com
on 3 Apr 2015 at 2:20