UwbRangingParams.Builder


public static final class UwbRangingParams.Builder
extends Object

java.lang.Object
   ↳ android.ranging.uwb.UwbRangingParams.Builder


Builder class for creating instances of UwbRangingParams

Summary

Public constructors

Builder(int sessionId, int configId, UwbAddress deviceAddress, UwbAddress peerAddress)

Constructs a new Builder for creating a ranging session.

Public methods

UwbRangingParams build()

Builds a new instance of UwbRangingParams.

UwbRangingParams.Builder setComplexChannel(UwbComplexChannel complexChannel)

Sets the complex channel configuration for the ranging session.

UwbRangingParams.Builder setRangingUpdateRate(int rate)

Sets the ranging update rate for the session.

UwbRangingParams.Builder setSessionKeyInfo(byte[] sessionKeyInfo)

Sets the session key information for secure ranging.

UwbRangingParams.Builder setSlotDuration(int durationMs)

Sets the slot duration in milliseconds for the ranging session.

UwbRangingParams.Builder setSubSessionId(int subSessionId)

Sets the sub-session ID for the ranging session.

UwbRangingParams.Builder setSubSessionKeyInfo(byte[] subSessionKeyInfo)

Sets the sub-session key information for secure ranging.

Inherited methods

Public constructors

Builder

public Builder (int sessionId, 
                int configId, 
                UwbAddress deviceAddress, 
                UwbAddress peerAddress)

Constructs a new Builder for creating a ranging session.

Parameters
sessionId int: A unique identifier for the session.

configId int: The configuration ID for the ranging parameters. Value is UwbRangingParams.CONFIG_UNICAST_DS_TWR, UwbRangingParams.CONFIG_MULTICAST_DS_TWR, UwbRangingParams.CONFIG_PROVISIONED_UNICAST_DS_TWR, UwbRangingParams.CONFIG_PROVISIONED_MULTICAST_DS_TWR, UwbRangingParams.CONFIG_PROVISIONED_INDIVIDUAL_MULTICAST_DS_TWR, or UwbRangingParams.CONFIG_PROVISIONED_UNICAST_DS_TWR_VERY_FAST

deviceAddress UwbAddress: The UwbAddress representing the device's address. Must be non-null.

peerAddress UwbAddress: The UwbAddress of the peer device. Must be non-null.

Throws
IllegalArgumentException if either deviceAddress or peerAddress is null.

Public methods

build

public UwbRangingParams build ()

Builds a new instance of UwbRangingParams.

Returns
UwbRangingParams a new instance of UwbRangingParams created using the current state of the builder. This value cannot be null.

setComplexChannel

public UwbRangingParams.Builder setComplexChannel (UwbComplexChannel complexChannel)

Sets the complex channel configuration for the ranging session.

Parameters
complexChannel UwbComplexChannel: a non-null UwbComplexChannel instance representing the channel and preamble configuration. For better performance always use a random preamble index for each ranging session.

Returns
UwbRangingParams.Builder this Builder instance. This value cannot be null.

Throws
IllegalArgumentException if the provided complex channel is null.

setSessionKeyInfo

public UwbRangingParams.Builder setSessionKeyInfo (byte[] sessionKeyInfo)

Sets the session key information for secure ranging.

Parameters
sessionKeyInfo byte: a byte array containing session key information. This value cannot be null.

Returns
UwbRangingParams.Builder this Builder instance. This value cannot be null.

Throws
IllegalArgumentException if the provided byte array is null.

setSlotDuration

public UwbRangingParams.Builder setSlotDuration (int durationMs)

Sets the slot duration in milliseconds for the ranging session.

Defaults to UwbRangingParams.DURATION_2_MS.

Parameters
durationMs int: the slot duration ERROR(SlotDuration/android.ranging.uwb.UwbRangingParams.SlotDuration SlotDuration) Value is UwbRangingParams.DURATION_1_MS, or UwbRangingParams.DURATION_2_MS

Returns
UwbRangingParams.Builder this Builder instance. This value cannot be null.

Throws
IllegalArgumentException if the provided duration is out of range.

setSubSessionId

public UwbRangingParams.Builder setSubSessionId (int subSessionId)

Sets the sub-session ID for the ranging session.

Parameters
subSessionId int: the sub-session ID, which should be a unique identifier for the sub-session.

Returns
UwbRangingParams.Builder this Builder instance for method chaining. This value cannot be null.

setSubSessionKeyInfo

public UwbRangingParams.Builder setSubSessionKeyInfo (byte[] subSessionKeyInfo)

Sets the sub-session key information for secure ranging.

Parameters
subSessionKeyInfo byte: a byte array containing sub-session key information. This value cannot be null.

Returns
UwbRangingParams.Builder this Builder instance. This value cannot be null.

Throws
IllegalArgumentException if the provided map is null.