Stay organized with collections
Save and categorize content based on your preferences.
BrailleDisplayCallback
interface BrailleDisplayCallback
Interface provided to BrailleDisplayController
connection methods to receive callbacks from the system.
Summary
Constants |
static Int |
A unique Braille display matching the requested properties could not be identified.
|
static Int |
The system cannot access connected HID devices.
|
Public methods |
abstract Unit |
Callback to observe a successful Braille display connection.
|
abstract Unit |
Callback to observe a failed Braille display connection.
|
abstract Unit |
Callback to observe when the currently connected Braille display is disconnected by the system.
|
abstract Unit |
Callback to observe input bytes from the currently connected Braille display.
|
Constants
FLAG_ERROR_BRAILLE_DISPLAY_NOT_FOUND
static val FLAG_ERROR_BRAILLE_DISPLAY_NOT_FOUND: Int
A unique Braille display matching the requested properties could not be identified.
Value: 2
FLAG_ERROR_CANNOT_ACCESS
static val FLAG_ERROR_CANNOT_ACCESS: Int
The system cannot access connected HID devices.
Value: 1
Public methods
onConnected
abstract fun onConnected(hidDescriptor: ByteArray): Unit
Callback to observe a successful Braille display connection.
The provided HID report descriptor should be used to understand the input bytes received from the Braille display via onInput
and to prepare the output sent to the Braille display via write
.
Parameters |
hidDescriptor |
ByteArray: The HID report descriptor for this Braille display. This value cannot be null . |
onConnectionFailed
abstract fun onConnectionFailed(errorFlags: Int): Unit
Callback to observe a failed Braille display connection.
onDisconnected
abstract fun onDisconnected(): Unit
Callback to observe when the currently connected Braille display is disconnected by the system.
abstract fun onInput(input: ByteArray): Unit
Callback to observe input bytes from the currently connected Braille display.
Parameters |
input |
ByteArray: The input bytes from the Braille display, formatted according to the HID report descriptor and the HIDRAW kernel driver. This value cannot be null . |
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.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# BrailleDisplayController.BrailleDisplayCallback\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nBrailleDisplayCallback\n======================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/accessibilityservice/BrailleDisplayController.BrailleDisplayCallback \"View this page in Java\") \n\n```\ninterface BrailleDisplayCallback\n```\n\n|-----------------------------------------------------------------------------------|\n| [android.accessibilityservice.BrailleDisplayController.BrailleDisplayCallback](#) |\n\nInterface provided to [BrailleDisplayController](/reference/kotlin/android/accessibilityservice/BrailleDisplayController) connection methods to receive callbacks from the system.\n\nSummary\n-------\n\n| Constants ||\n|-----------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [FLAG_ERROR_BRAILLE_DISPLAY_NOT_FOUND](#FLAG_ERROR_BRAILLE_DISPLAY_NOT_FOUND:kotlin.Int) A unique Braille display matching the requested properties could not be identified. |\n| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [FLAG_ERROR_CANNOT_ACCESS](#FLAG_ERROR_CANNOT_ACCESS:kotlin.Int) The system cannot access connected HID devices. |\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onConnected](#onConnected(kotlin.ByteArray))`(`hidDescriptor:` `[ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)`)` Callback to observe a successful Braille display connection. |\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onConnectionFailed](#onConnectionFailed(kotlin.Int))`(`errorFlags:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Callback to observe a failed Braille display connection. |\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onDisconnected](#onDisconnected())`()` Callback to observe when the currently connected Braille display is disconnected by the system. |\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onInput](#onInput(kotlin.ByteArray))`(`input:` `[ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)`)` Callback to observe input bytes from the currently connected Braille display. |\n\nConstants\n---------\n\n### FLAG_ERROR_BRAILLE_DISPLAY_NOT_FOUND\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic val FLAG_ERROR_BRAILLE_DISPLAY_NOT_FOUND: Int\n```\n\nA unique Braille display matching the requested properties could not be identified. \n\n Value: 2\n\n### FLAG_ERROR_CANNOT_ACCESS\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic val FLAG_ERROR_CANNOT_ACCESS: Int\n```\n\nThe system cannot access connected HID devices. \n\n Value: 1\n\nPublic methods\n--------------\n\n### onConnected\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onConnected(hidDescriptor: ByteArray): Unit\n```\n\nCallback to observe a successful Braille display connection.\n\nThe provided HID report descriptor should be used to understand the input bytes received from the Braille display via [onInput](#onInput(kotlin.ByteArray)) and to prepare the output sent to the Braille display via [write](/reference/kotlin/android/accessibilityservice/BrailleDisplayController#write(kotlin.ByteArray)).\n\n| Parameters ||\n|-----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `hidDescriptor` | [ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html): The HID report descriptor for this Braille display. This value cannot be `null`. |\n\n**See Also**\n\n- [#connect(BluetoothDevice, BrailleDisplayCallback)](/reference/kotlin/android/accessibilityservice/BrailleDisplayController#connect(android.bluetooth.BluetoothDevice,%20android.accessibilityservice.BrailleDisplayController.BrailleDisplayCallback))\n- [#connect(UsbDevice, BrailleDisplayCallback)](/reference/kotlin/android/accessibilityservice/BrailleDisplayController#connect(android.hardware.usb.UsbDevice,%20android.accessibilityservice.BrailleDisplayController.BrailleDisplayCallback)) \n\n### onConnectionFailed\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onConnectionFailed(errorFlags: Int): Unit\n```\n\nCallback to observe a failed Braille display connection.\n\n| Parameters ||\n|--------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `errorFlags` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): A bitmask of error codes for the connection failure. Value is either `0` or a combination of [android.accessibilityservice.BrailleDisplayController.BrailleDisplayCallback#FLAG_ERROR_CANNOT_ACCESS](#FLAG_ERROR_CANNOT_ACCESS:kotlin.Int), and [android.accessibilityservice.BrailleDisplayController.BrailleDisplayCallback#FLAG_ERROR_BRAILLE_DISPLAY_NOT_FOUND](#FLAG_ERROR_BRAILLE_DISPLAY_NOT_FOUND:kotlin.Int) |\n\n**See Also**\n\n- [#connect(BluetoothDevice, BrailleDisplayCallback)](/reference/kotlin/android/accessibilityservice/BrailleDisplayController#connect(android.bluetooth.BluetoothDevice,%20android.accessibilityservice.BrailleDisplayController.BrailleDisplayCallback))\n- [#connect(UsbDevice, BrailleDisplayCallback)](/reference/kotlin/android/accessibilityservice/BrailleDisplayController#connect(android.hardware.usb.UsbDevice,%20android.accessibilityservice.BrailleDisplayController.BrailleDisplayCallback)) \n\n### onDisconnected\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onDisconnected(): Unit\n```\n\nCallback to observe when the currently connected Braille display is disconnected by the system. \n\n### onInput\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onInput(input: ByteArray): Unit\n```\n\nCallback to observe input bytes from the currently connected Braille display.\n\n| Parameters ||\n|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `input` | [ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html): The input bytes from the Braille display, formatted according to the HID report descriptor and the HIDRAW kernel driver. This value cannot be `null`. |"]]