BenLenest / java-simple-serial-connector

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

Detect when port stop sending #44

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi,

Currently I'm working on SMS gateway kind of application.
In receiving AT-Command result from port, there are many pattern to capture 
before I start to be able to process the incoming SMS.
Is there any way, I can detect when the port has finished sending byte[]?.

Thanks
Bromo

Original issue reported on code.google.com by bromo...@gmail.com on 26 Jul 2013 at 6:55

GoogleCodeExporter commented 8 years ago
For that you can use SerialPortEventListener and SerialPort.MASK_TXEMPTY event 
for checking state of output buffer. Not all serial port devices support this 
event, and the second way is to use getOutputBufferBytesCount() method of 
SerialPort class, you can run a standalone thread for checking this parameter, 
this method return a count of bytes in output buffer and if this value == 0, 
it's mean that your output buffer is empty and serial port don't send any data.

Original comment by scream3r.org@gmail.com on 26 Jul 2013 at 1:39

GoogleCodeExporter commented 8 years ago

Original comment by scream3r.org@gmail.com on 30 Jul 2013 at 4:33