Stay organized with collections
Save and categorize content based on your preferences.
UartDeviceCallback
public
interface
UartDeviceCallback
com.google.android.things.pio.UartDeviceCallback
|
UART interrupt callback.
Call registerUartDeviceCallback(Handler, UartDeviceCallback)
to start
getting callbacks.
Summary
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.
|
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# UartDeviceCallback\n==================\n\n\n`\npublic\n\n\ninterface\nUartDeviceCallback\n`\n\n\n`\n\n\n`\n\n|--------------------------------------------------|\n| com.google.android.things.pio.UartDeviceCallback |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nUART interrupt callback.\n\nCall [registerUartDeviceCallback(Handler, UartDeviceCallback)](/reference/com/google/android/things/pio/UartDevice#registerUartDeviceCallback(android.os.Handler, com.google.android.things.pio.UartDeviceCallback)) to start\ngetting callbacks.\n\nSummary\n-------\n\n| ### Public methods ||\n|---------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract boolean` | ` `[onUartDeviceDataAvailable](/reference/com/google/android/things/pio/UartDeviceCallback#onUartDeviceDataAvailable(com.google.android.things.pio.UartDevice))`(`[UartDevice](/reference/com/google/android/things/pio/UartDevice)` uart) ` Called when data is ready to be read from the UART. |\n| ` default void` | ` `[onUartDeviceError](/reference/com/google/android/things/pio/UartDeviceCallback#onUartDeviceError(com.google.android.things.pio.UartDevice, int))`(`[UartDevice](/reference/com/google/android/things/pio/UartDevice)` uart, int error) ` Called when an error occurs with the interrupt event listener. |\n\nPublic methods\n--------------\n\n### onUartDeviceDataAvailable\n\n```\nboolean onUartDeviceDataAvailable (UartDevice uart)\n```\n\nCalled when data is ready to be read from the UART.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|--------|----------------------------------------------------------|\n| `uart` | `UartDevice`: The UartDevice that has data ready. \u003cbr /\u003e |\n\n| Returns ||\n|-----------|---------------------------------------------------------|\n| `boolean` | True to keep watching for events, false to stop. \u003cbr /\u003e |\n\n### onUartDeviceError\n\n```\nvoid onUartDeviceError (UartDevice uart, \n int error)\n```\n\nCalled when an error occurs with the interrupt event listener.\n\nAt this point the receiver should assume that this UART is no longer usable. No further\ncallbacks will be received on this object.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|---------|---------------------------------------------------------------------------------------------------------------------|\n| `uart` | `UartDevice`: The UartDevice that received an error. \u003cbr /\u003e |\n| `error` | `int`: An [OsConstants](https://developer.android.com/reference/android/system/OsConstants.html) errno code. \u003cbr /\u003e |\n\n-\n\n Interfaces\n ----------\n\n - [Gpio](/reference/com/google/android/things/pio/Gpio)\n - [GpioCallback](/reference/com/google/android/things/pio/GpioCallback)\n - [I2cDevice](/reference/com/google/android/things/pio/I2cDevice)\n - [Pwm](/reference/com/google/android/things/pio/Pwm)\n - [SpiDevice](/reference/com/google/android/things/pio/SpiDevice)\n - [UartDevice](/reference/com/google/android/things/pio/UartDevice)\n - [UartDeviceCallback](/reference/com/google/android/things/pio/UartDeviceCallback)\n-\n\n Classes\n -------\n\n - [PeripheralManager](/reference/com/google/android/things/pio/PeripheralManager)"]]