We are using the Pi4J Serial API for reading packets of data from our device. These packets can vary in length from 6 to 20 bytes and are sent about once every 2 seconds. We've configured the project to add a "SerialDataEventListener' and have overridden the "dataReceived" function.
My question is, what causes the "dataReceived" listener to be called. It doesn't appear to be called on receipt of every character, because I usually receive the entire packet when I do a get? Is it time-based? For example, if no character is received in n milliseconds.