Hello,
i'm on J2ME 8.1. Using UART port. I've attached a Modem (Adafruit Fona) to my Raspberry and subscribed uart incoming data with:
uart.setEventListener(UARTEvent.INPUT_DATA_AVAILABLE, new UARTEventListener() {
@Override
public void eventDispatched(UARTEvent event) {
......
On event dispatch I read data in the usual way:
while((result = is.read(data)) != -1 ){
String aMsg = new String(data);
......
My problem is: This event is fired continually, even if no data is present (result = -1) as it is fired by a Timer task and not on a real buffer ready from the modem.
Maybe I'm doing something wrong. Someone can help me? Hope I'm been clear enough.
Regards,
Gianmaria