TransportHandle
public
interface
TransportHandle
implements
AutoCloseable
android.ranging.oob.TransportHandle
|
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 |
interface |
TransportHandle.ReceiveCallback
TransportHandle callback.
|
Public methods
registerReceiveCallback
public abstract void registerReceiveCallback (Executor executor,
TransportHandle.ReceiveCallback callback)
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.
Parameters |
executor |
Executor : the Executor on which the callback should be invoked. Must not be
null. |
callback |
TransportHandle.ReceiveCallback : the ReceiveCallback instance to receive updates. Must not be null. |
sendData
public abstract void sendData (byte[] data)
Send data to the peer device via the implemented OOB transport.
Parameters |
data |
byte : the data to be sent to the peer device. Must not 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-03-13 UTC.
[null,null,["Last updated 2025-03-13 UTC."],[],[],null,["# TransportHandle\n\nAdded in [API level 36](/guide/topics/manifest/uses-sdk-element#ApiLevels) \nSummary: [Nested Classes](#nestedclasses) \\| [Methods](#pubmethods) \\| [Inherited Methods](#inhmethods) \n\nTransportHandle\n===============\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/android/ranging/oob/TransportHandle \"View this page in Kotlin\") \\|Java\n\n\n`\npublic\n\n\ninterface\nTransportHandle\n`\n\n\n`\n\n\nimplements\n\n`[AutoCloseable](/reference/java/lang/AutoCloseable)`\n\n\n`\n\n|-------------------------------------|\n| android.ranging.oob.TransportHandle |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nTransportHandle is used as the Out-Of-Band (OOB) transport mechanism by ranging module.\nIn cases where module is used in a non-raw ranging mode, the user shall provide an implementation\nof the TransportHandle, allowing ranging module to do the necessary OOB communication with a peer\ndevice using the provided transport handle. Some examples of OOB transport between two peer\ndevices 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| ` interface` | [TransportHandle.ReceiveCallback](/reference/android/ranging/oob/TransportHandle.ReceiveCallback) TransportHandle callback. |\n\n| ### Public methods ||\n|------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract void` | ` `[registerReceiveCallback](/reference/android/ranging/oob/TransportHandle#registerReceiveCallback(java.util.concurrent.Executor,%20android.ranging.oob.TransportHandle.ReceiveCallback))`(`[Executor](/reference/java/util/concurrent/Executor)` executor, `[TransportHandle.ReceiveCallback](/reference/android/ranging/oob/TransportHandle.ReceiveCallback)` callback) ` Registers a callback to receive updates from the transport mechanism. |\n| ` abstract void` | ` `[sendData](/reference/android/ranging/oob/TransportHandle#sendData(byte[]))`(byte[] data) ` Send data to the peer device via the implemented OOB transport. |\n\n| ### Inherited methods |\n|-----------------------|---|\n| From interface ` `[java.lang.AutoCloseable](/reference/java/lang/AutoCloseable)` ` |------------------|---------------------------------------------------------------------------------------------------------------------------| | ` abstract void` | ` `[close](/reference/java/lang/AutoCloseable#close())`() ` Closes this resource, relinquishing any underlying resources. | ||\n\nPublic methods\n--------------\n\n### registerReceiveCallback\n\nAdded in [API level 36](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract void registerReceiveCallback (Executor executor, \n TransportHandle.ReceiveCallback callback)\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\ndata received from the peer device.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `executor` | `Executor`: the [Executor](/reference/java/util/concurrent/Executor) on which the callback should be invoked. Must not be null. \u003cbr /\u003e |\n| `callback` | `TransportHandle.ReceiveCallback`: the [ReceiveCallback](/reference/android/ranging/oob/TransportHandle.ReceiveCallback) instance to receive updates. Must not be null. \u003cbr /\u003e |\n\n| Throws ||\n|---------------------------------------------------------------------------|---------------------------------------------|\n| [IllegalArgumentException](/reference/java/lang/IllegalArgumentException) | if either `executor` or `callback` is null. |\n\n### sendData\n\nAdded in [API level 36](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract void sendData (byte[] data)\n```\n\nSend data to the peer device via the implemented OOB transport.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|--------|--------------------------------------------------------------------------|\n| `data` | `byte`: the data to be sent to the peer device. Must not be null. \u003cbr /\u003e |\n\n| Throws ||\n|---------------------------------------------------------------------------|-----------------------------------------|\n| [IllegalArgumentException](/reference/java/lang/IllegalArgumentException) | if the provided data is null or invalid |"]]