UartDeviceCallback

public interface UartDeviceCallback

com.google.android.things.pio.UartDeviceCallback


UART interrupt callback.

Call registerUartDeviceCallback(Handler, UartDeviceCallback) to start getting callbacks.

Summary

Public methods

abstract boolean onUartDeviceDataAvailable(UartDevice uart)

Called when data is ready to be read from the UART.

default void onUartDeviceError(UartDevice uart, int error)

Called when an error occurs with the interrupt event listener.

Public methods

onUartDeviceDataAvailable

boolean onUartDeviceDataAvailable (UartDevice uart)

Called when data is ready to be read from the UART.

Parameters
uart UartDevice: The UartDevice that has data ready.

Returns
boolean True to keep watching for events, false to stop.

onUartDeviceError

void onUartDeviceError (UartDevice uart, 
                int error)

Called when an error occurs with the interrupt event listener. At this point the receiver should assume that this UART is no longer usable. No further callbacks will be received on this object.

Parameters
uart UartDevice: The UartDevice that received an error.

error int: An OsConstants errno code.