views:

19

answers:

1

I'm using the java comm library to listen for bytes coming in over a serial port. I have it setup for async. notification, i.e. have a class implementing SerialPortEventListener. Is there any way to set the threshold at which the SerialPortEvent.DATA_AVAILABLE event is called. In my case the library waits until about 20 bytes are received before it fires this event, in my case I'd like to be notified when the first 8 bytes or so have been received.

Thank you for any replies.

A: 

I think your problem may be the hardware buffer that most (all?) PC serial port UARTs have. IIRC, it's a minimum of 16 bytes long. Did you try calling disableReceiveThreshold() on the Port object? This may drastically decrease efficiency, depending on how the driver is implemented.

Jim Garrison
Yes I've tried disableReceiveThreshold, I still seem to be only getting the first data event when there are >= 14 bytes to be read from the inputstream, I would like to be notified when I've gotten about 8 bytes.
How about `setRcvFifoTrigger()`? The API docs say this is deprecated because it's "advisory only". If this doesn't work, you may have to find a way to program the UART using native code.
Jim Garrison
In case you haven't seen it yet: http://stackoverflow.com/questions/3367872/java-serial-comms-way-to-set-receieve-threshold-when-using-async-read-notifica -- This may not provide anything useful, however.
Jim Garrison