HidEventListener


interface HidEventListener
android.hardware.hid.HidEventListener

Listener for receiving events from a HidDevice.

Summary

Public methods
abstract Unit

Called when the HID device has been closed or disconnected.

abstract Unit

Called when an error occurs during HID input report processing.

abstract Unit

Called when an input report is received from the HID device.

Public methods

onDisconnected

abstract fun onDisconnected(): Unit

Called when the HID device has been closed or disconnected.

This is the definitive signal that the device session has ended. All registered listeners (including this instance) are automatically unregistered, and the device is no longer usable.

onError

abstract fun onError(cause: Exception): Unit

Called when an error occurs during HID input report processing.

This callback is purely informative and never unregisters listeners. On non-fatal errors, report processing continues. On fatal errors, this callback is immediately followed by an explicit onDisconnected() invocation.

Parameters
cause Exception: The exception describing the error.
This value cannot be null.

onInputReport

abstract fun onInputReport(report: Report): Unit

Called when an input report is received from the HID device.

Parameters
report Report: This value cannot be null.