I\'m begginner in Java, I\'m writing (\"FLASH\").getbytes()
like this to serialport
.
After I\'ll get FLASH_OK
as response, aga
jSSC is a stable serial IO java library, take a look at following examples:
Looks like to need a SerialPortReader which needs to implement a SerialPortEventListener
public void serialEvent(SerialPortEvent event)
{
case SerialPortEvent.DATA_AVAILABLE:
byte[] readBuffer = new byte[40];
try
{
while (inputStream.available() > 0)
{
int numBytes = inputStream.read(readBuffer);
}
System.out.print(new String(readBuffer));
System.out.println();
System.out.println("DTR: " + serialPort.isDTR());
System.out.println("DSR: " + serialPort.isDSR());
System.out.println("CTS: " + serialPort.isCTS());
System.out.println("RTS: " + serialPort.isRTS());
System.out.println();
outputStream.write("ACTIVESYNC".getBytes());
}
catch (IOException e)
{
e.printStackTrace();
}