Stay organized with collections
Save and categorize content based on your preferences.
TransportHandle
interface TransportHandle : AutoCloseable
TransportHandle is used as the Out-Of-Band (OOB) transport mechanism by ranging module. In cases where module is used in a non-raw ranging mode, the user shall provide an implementation of the TransportHandle, allowing ranging module to do the necessary OOB communication with a peer device using the provided transport handle. Some examples of OOB transport between two peer devices are:
- BLE GATT connection
- Wi-Fi MDNS link
- Internet
Summary
Nested classes |
abstract |
TransportHandle callback.
|
Public methods |
abstract Unit |
Registers a callback to receive updates from the transport mechanism.
|
abstract Unit |
Send data to the peer device via the implemented OOB transport.
|
Inherited functions |
From class AutoCloseable
Unit |
close()
Closes this resource, relinquishing any underlying resources. This method is invoked automatically on objects managed by the try -with-resources statement.
|
|
Public methods
registerReceiveCallback
abstract fun registerReceiveCallback(
executor: Executor,
callback: TransportHandle.ReceiveCallback
): Unit
Registers a callback to receive updates from the transport mechanism.
The callback should be used to notify information about the peer device including the data received from the peer device.
Exceptions |
java.lang.IllegalArgumentException |
if either executor or callback is null. |
sendData
abstract fun sendData(data: ByteArray): Unit
Send data to the peer device via the implemented OOB transport.
Parameters |
data |
ByteArray: the data to be sent to the peer device. Must not be null. |
Exceptions |
java.lang.IllegalArgumentException |
if the provided data is null or invalid |
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-03-13 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-03-13 UTC."],[],[],null,["# TransportHandle\n\nAdded in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nTransportHandle\n===============\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/ranging/oob/TransportHandle \"View this page in Java\") \n\n```\ninterface TransportHandle : AutoCloseable\n```\n\n|------------------------------------------|\n| [android.ranging.oob.TransportHandle](#) |\n\nTransportHandle is used as the Out-Of-Band (OOB) transport mechanism by ranging module. In cases where module is used in a non-raw ranging mode, the user shall provide an implementation of the TransportHandle, allowing ranging module to do the necessary OOB communication with a peer device using the provided transport handle. Some examples of OOB transport between two peer devices are:\n\n- BLE GATT connection\n- Wi-Fi MDNS link\n- Internet\n\n\u003cbr /\u003e\n\nSummary\n-------\n\n| Nested classes ||\n|----------|--------------------------------------------------------------------------------------------------------------------|\n| abstract | [ReceiveCallback](/reference/kotlin/android/ranging/oob/TransportHandle.ReceiveCallback) TransportHandle callback. |\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [registerReceiveCallback](#registerReceiveCallback(java.util.concurrent.Executor,%20android.ranging.oob.TransportHandle.ReceiveCallback))`(`executor:` `[Executor](../../../java/util/concurrent/Executor.html#)`, `callback:` `[TransportHandle.ReceiveCallback](/reference/kotlin/android/ranging/oob/TransportHandle.ReceiveCallback)`)` Registers a callback to receive updates from the transport mechanism. |\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [sendData](#sendData(kotlin.ByteArray))`(`data:` `[ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)`)` Send data to the peer device via the implemented OOB transport. |\n\n| Inherited functions ||\n|---|---|\n| From class [AutoCloseable](../../../java/lang/AutoCloseable.html#) |------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [close](../../../java/lang/AutoCloseable.html#close())`()` Closes this resource, relinquishing any underlying resources. This method is invoked automatically on objects managed by the `try`-with-resources statement. \u003cbr /\u003e | ||\n\nPublic methods\n--------------\n\n### registerReceiveCallback\n\nAdded in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun registerReceiveCallback(\n executor: Executor, \n callback: TransportHandle.ReceiveCallback\n): Unit\n```\n\nRegisters a callback to receive updates from the transport mechanism.\n\nThe callback should be used to notify information about the peer device including the data received from the peer device.\n\n| Parameters ||\n|------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `executor` | [Executor](../../../java/util/concurrent/Executor.html#): the [Executor](../../../java/util/concurrent/Executor.html#) on which the callback should be invoked. Must not be null. |\n| `callback` | [TransportHandle.ReceiveCallback](/reference/kotlin/android/ranging/oob/TransportHandle.ReceiveCallback): the [ReceiveCallback](/reference/kotlin/android/ranging/oob/TransportHandle.ReceiveCallback) instance to receive updates. Must not be null. |\n\n| Exceptions ||\n|--------------------------------------|---------------------------------------------|\n| `java.lang.IllegalArgumentException` | if either `executor` or `callback` is null. |\n\n### sendData\n\nAdded in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun sendData(data: ByteArray): Unit\n```\n\nSend data to the peer device via the implemented OOB transport.\n\n| Parameters ||\n|--------|----------------------------------------------------------------------------------------------------------------------------------------------------|\n| `data` | [ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html): the data to be sent to the peer device. Must not be null. |\n\n| Exceptions ||\n|--------------------------------------|-----------------------------------------|\n| `java.lang.IllegalArgumentException` | if the provided data is null or invalid |"]]