UwbClientSessionScope

interface UwbClientSessionScope

Known direct subclasses
UwbControleeSessionScope

Interface for controlee client session that is established between nearby UWB devices.

UwbControllerSessionScope

Interface for controller client session that is established between nearby UWB devices.


Interface for client session that is established between nearby UWB devices.

Summary

Public functions

Flow<RangingResult>

Returns a flow of RangingResult.

suspend Unit
reconfigureRangeDataNtf(
    configType: Int,
    proximityNear: Int,
    proximityFar: Int
)

Dynamically reconfigures range data notification config to an active ranging session.

Public properties

UwbAddress

A local address can only be used for a single ranging session.

RangingCapabilities

Returns the RangingCapabilities which the device supports.

Public functions

prepareSession

Added in 1.0.0-alpha08
fun prepareSession(parameters: RangingParameters): Flow<RangingResult>

Returns a flow of RangingResult. Consuming the flow will initiate the UWB ranging and only one flow can be initiated. To consume the flow from multiple consumers, convert the flow to a SharedFlow.

Throws
kotlin.IllegalStateException

if a new flow was consumed again after the UWB ranging is already initiated.

androidx.core.uwb.exceptions.UwbSystemCallbackException

if the backend UWB system has resulted in an error.

java.lang.SecurityException

if ranging does not have the android.permission.UWB_RANGING permission. Apps must have requested and been granted this permission before calling this method.

kotlin.IllegalArgumentException

if the client starts a ranging session without setting complex channel and peer address.

kotlin.IllegalArgumentException

if the client starts a ranging session with invalid config id or ranging update type.

reconfigureRangeDataNtf

Added in 1.0.0-alpha08
suspend fun reconfigureRangeDataNtf(
    configType: Int,
    proximityNear: Int,
    proximityFar: Int
): Unit

Dynamically reconfigures range data notification config to an active ranging session.

Throws
kotlin.IllegalStateException

if the ranging is inactive.

Otherwise, this method will return successfully, then clients are expected to handle RangingResult.RangingResultPeerDisconnected with the controlee as parameter of the callback.

Public properties

localAddress

Added in 1.0.0-alpha08
val localAddressUwbAddress

A local address can only be used for a single ranging session. After a ranging session is ended, a new address will be allocated.

Ranging session duration may also be limited to prevent addresses from being used for too long. In this case, your ranging session would be suspended and clients would need to exchange the new address with their peer before starting again.

rangingCapabilities

Added in 1.0.0-alpha08
val rangingCapabilitiesRangingCapabilities

Returns the RangingCapabilities which the device supports.

Extension functions