Builder
class Builder
kotlin.Any | |
↳ | android.ranging.uwb.UwbRangingParams.Builder |
Builder class for creating instances of UwbRangingParams
Summary
Public constructors | |
---|---|
Builder(sessionId: Int, configId: Int, deviceAddress: UwbAddress, peerAddress: UwbAddress) Constructs a new |
Public methods | |
---|---|
UwbRangingParams |
build() Builds a new instance of |
UwbRangingParams.Builder |
setComplexChannel(complexChannel: UwbComplexChannel) Sets the complex channel configuration for the ranging session. |
UwbRangingParams.Builder |
setRangingUpdateRate(rate: Int) Sets the ranging update rate for the session. |
UwbRangingParams.Builder |
setSessionKeyInfo(sessionKeyInfo: ByteArray) Sets the session key information for secure ranging. |
UwbRangingParams.Builder |
setSlotDuration(durationMs: Int) Sets the slot duration in milliseconds for the ranging session. |
UwbRangingParams.Builder |
setSubSessionId(subSessionId: Int) Sets the sub-session ID for the ranging session. |
UwbRangingParams.Builder |
setSubSessionKeyInfo(subSessionKeyInfo: ByteArray) Sets the sub-session key information for secure ranging. |
Public constructors
Builder
Builder(
sessionId: Int,
configId: Int,
deviceAddress: UwbAddress,
peerAddress: UwbAddress)
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 android.ranging.uwb.UwbRangingParams#CONFIG_UNICAST_DS_TWR , android.ranging.uwb.UwbRangingParams#CONFIG_MULTICAST_DS_TWR , android.ranging.uwb.UwbRangingParams#CONFIG_PROVISIONED_UNICAST_DS_TWR , android.ranging.uwb.UwbRangingParams#CONFIG_PROVISIONED_MULTICAST_DS_TWR , android.ranging.uwb.UwbRangingParams#CONFIG_PROVISIONED_INDIVIDUAL_MULTICAST_DS_TWR , or android.ranging.uwb.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. |
Exceptions | |
---|---|
java.lang.IllegalArgumentException |
if either deviceAddress or peerAddress is null. |
Public methods
build
fun build(): UwbRangingParams
Builds a new instance of UwbRangingParams
.
Return | |
---|---|
UwbRangingParams |
a new instance of UwbRangingParams created using the current state of the builder. This value cannot be null . |
setComplexChannel
fun setComplexChannel(complexChannel: UwbComplexChannel): UwbRangingParams.Builder
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. |
Return | |
---|---|
UwbRangingParams.Builder |
this Builder instance. This value cannot be null . |
Exceptions | |
---|---|
java.lang.IllegalArgumentException |
if the provided complex channel is null. |
setRangingUpdateRate
fun setRangingUpdateRate(rate: Int): UwbRangingParams.Builder
Sets the ranging update rate for the session.
Defaults to android.ranging.raw.RawRangingDevice.RangingUpdateRate#UPDATE_RATE_NORMAL.
Parameters | |
---|---|
rate |
Int: the ranging update rate, defined as one of the constants in android.ranging.raw.RawRangingDevice.RangingUpdateRate. Value is android.ranging.raw.RawRangingDevice#UPDATE_RATE_NORMAL , android.ranging.raw.RawRangingDevice#UPDATE_RATE_INFREQUENT , or android.ranging.raw.RawRangingDevice#UPDATE_RATE_FREQUENT |
Return | |
---|---|
UwbRangingParams.Builder |
this Builder instance. This value cannot be null . |
setSessionKeyInfo
fun setSessionKeyInfo(sessionKeyInfo: ByteArray): UwbRangingParams.Builder
Sets the session key information for secure ranging.
Parameters | |
---|---|
sessionKeyInfo |
ByteArray: a byte array containing session key information. This value cannot be null . |
Return | |
---|---|
UwbRangingParams.Builder |
this Builder instance. This value cannot be null . |
Exceptions | |
---|---|
java.lang.IllegalArgumentException |
if the provided byte array is null. |
setSlotDuration
fun setSlotDuration(durationMs: Int): UwbRangingParams.Builder
Sets the slot duration in milliseconds for the ranging session.
Defaults to DURATION_2_MS
.
Parameters | |
---|---|
durationMs |
Int: the slot duration android.ranging.uwb.UwbRangingParams.SlotDuration Value is android.ranging.uwb.UwbRangingParams#DURATION_1_MS , or android.ranging.uwb.UwbRangingParams#DURATION_2_MS |
Return | |
---|---|
UwbRangingParams.Builder |
this Builder instance. This value cannot be null . |
Exceptions | |
---|---|
java.lang.IllegalArgumentException |
if the provided duration is out of range. |
setSubSessionId
fun setSubSessionId(subSessionId: Int): UwbRangingParams.Builder
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. |
Return | |
---|---|
UwbRangingParams.Builder |
this Builder instance for method chaining. This value cannot be null . |
setSubSessionKeyInfo
fun setSubSessionKeyInfo(subSessionKeyInfo: ByteArray): UwbRangingParams.Builder
Sets the sub-session key information for secure ranging.
Parameters | |
---|---|
subSessionKeyInfo |
ByteArray: a byte array containing sub-session key information. This value cannot be null . |
Return | |
---|---|
UwbRangingParams.Builder |
this Builder instance. This value cannot be null . |
Exceptions | |
---|---|
java.lang.IllegalArgumentException |
if the provided map is null. |