# RangingParameters

Artifact: [androidx.core.uwb:uwb](https://developer.android.com/jetpack/androidx/releases/core-uwb) [View Source](https://cs.android.com/search?q=file:androidx/core/uwb/RangingParameters.kt+class:androidx.core.uwb.RangingParameters) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core-uwb#1.0.0)

*** ** * ** ***


```
public final class RangingParameters
```

<br />

*** ** * ** ***

Set of parameters which should be passed to the UWB chip to start ranging.

## Summary

| ### Constants |
|---|---|
| `static final int` | `https://developer.android.com/reference/androidx/core/uwb/RangingParameters#CONFIG_MULTICAST_DS_TWR() = 2` Pre-defined one-to-many STATIC STS DS-TWR ranging |
| `static final int` | `https://developer.android.com/reference/androidx/core/uwb/RangingParameters#CONFIG_PROVISIONED_INDIVIDUAL_MULTICAST_DS_TWR() = 7` Same as CONFIG_MULTICAST_DS_TWR, except P-STS individual controlee key mode is enabled. |
| `static final int` | `https://developer.android.com/reference/androidx/core/uwb/RangingParameters#CONFIG_PROVISIONED_MULTICAST_DS_TWR() = 5` Same as CONFIG_MULTICAST_DS_TWR, except P-STS security mode is enabled. |
| `static final int` | `https://developer.android.com/reference/androidx/core/uwb/RangingParameters#CONFIG_PROVISIONED_UNICAST_DS_TWR() = 4` Same as CONFIG_UNICAST_DS_TWR, except P-STS security mode is enabled. |
| `static final int` | `https://developer.android.com/reference/androidx/core/uwb/RangingParameters#CONFIG_UNICAST_DS_TWR() = 1` Pre-defined unicast STATIC STS DS-TWR ranging. |
| `static final long` | `https://developer.android.com/reference/androidx/core/uwb/RangingParameters#RANGING_SLOT_DURATION_1_MILLIS() = 1` 1 millisecond slot duration |
| `static final long` | `https://developer.android.com/reference/androidx/core/uwb/RangingParameters#RANGING_SLOT_DURATION_2_MILLIS() = 2` 2 millisecond slot duration |
| `static final int` | `https://developer.android.com/reference/androidx/core/uwb/RangingParameters#RANGING_UPDATE_RATE_AUTOMATIC() = 1` The update rate that differs across different config id. |
| `static final int` | `https://developer.android.com/reference/androidx/core/uwb/RangingParameters#RANGING_UPDATE_RATE_FREQUENT() = 3` 600 millisecond update rate for all config ids. |
| `static final int` | `https://developer.android.com/reference/androidx/core/uwb/RangingParameters#RANGING_UPDATE_RATE_INFREQUENT() = 2` 120 millisecond update rate for all config ids. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/core/uwb/RangingParameters#RangingParameters(kotlin.Int,kotlin.Int,kotlin.Int,kotlin.ByteArray,kotlin.ByteArray,androidx.core.uwb.UwbComplexChannel,kotlin.collections.List,kotlin.Int,androidx.core.uwb.UwbRangeDataNtfConfig,kotlin.Long,kotlin.Boolean)( int uwbConfigType, int sessionId, int subSessionId, byte[] sessionKeyInfo, byte[] subSessionKeyInfo, https://developer.android.com/reference/androidx/core/uwb/UwbComplexChannel complexChannel, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/uwb/UwbDevice> peerDevices, int updateRateType, https://developer.android.com/reference/androidx/core/uwb/UwbRangeDataNtfConfig uwbRangeDataNtfConfig, @https://developer.android.com/reference/androidx/annotation/IntRange(from = 1, to = 2) long slotDurationMillis, boolean isAoaDisabled )` |

| ### Public methods |
|---|---|
| `final https://developer.android.com/reference/androidx/core/uwb/UwbComplexChannel` | `https://developer.android.com/reference/androidx/core/uwb/RangingParameters#getComplexChannel()()` Optional. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/uwb/UwbDevice>` | `https://developer.android.com/reference/androidx/core/uwb/RangingParameters#getPeerDevices()()` The peers to perform ranging with. |
| `final int` | `https://developer.android.com/reference/androidx/core/uwb/RangingParameters#getSessionId()()` The ID of the ranging session. |
| `final byte[]` | `https://developer.android.com/reference/androidx/core/uwb/RangingParameters#getSessionKeyInfo()()` The session key info to use for the ranging. |
| `final long` | `https://developer.android.com/reference/androidx/core/uwb/RangingParameters#getSlotDurationMillis()()` The slot duration of the ranging session in millisecond. |
| `final int` | `https://developer.android.com/reference/androidx/core/uwb/RangingParameters#getSubSessionId()()` The ID of the ranging sub-session. |
| `final byte[]` | `https://developer.android.com/reference/androidx/core/uwb/RangingParameters#getSubSessionKeyInfo()()` The sub-session key info to use for the ranging. |
| `final int` | `https://developer.android.com/reference/androidx/core/uwb/RangingParameters#getUpdateRateType()()` The update rate type of the ranging data. |
| `final int` | `https://developer.android.com/reference/androidx/core/uwb/RangingParameters#getUwbConfigType()()` The UWB configuration type. |
| `final https://developer.android.com/reference/androidx/core/uwb/UwbRangeDataNtfConfig` | `https://developer.android.com/reference/androidx/core/uwb/RangingParameters#getUwbRangeDataNtfConfig()()` Configurable range data notification reports for a UWB session. |
| `final boolean` | `https://developer.android.com/reference/androidx/core/uwb/RangingParameters#isAoaDisabled()()` The indicator of whether angle of arrival (AoA) is disabled. |

## Constants

### CONFIG_MULTICAST_DS_TWR

```
public static final int CONFIG_MULTICAST_DS_TWR = 2
```

Pre-defined one-to-many STATIC STS DS-TWR ranging

deferred mode, ranging interval = 200 ms, slot duration = 2400 RSTU, slots per ranging round = 20, hopping mode is enabled

All other MAC parameters use FiRa/UCI default values.

Typical use case: smart phone interacts with many smart devices

### CONFIG_PROVISIONED_INDIVIDUAL_MULTICAST_DS_TWR

```
public static final int CONFIG_PROVISIONED_INDIVIDUAL_MULTICAST_DS_TWR = 7
```

Same as CONFIG_MULTICAST_DS_TWR, except P-STS individual controlee key mode is enabled.

### CONFIG_PROVISIONED_MULTICAST_DS_TWR

```
public static final int CONFIG_PROVISIONED_MULTICAST_DS_TWR = 5
```

Same as CONFIG_MULTICAST_DS_TWR, except P-STS security mode is enabled.

### CONFIG_PROVISIONED_UNICAST_DS_TWR

```
public static final int CONFIG_PROVISIONED_UNICAST_DS_TWR = 4
```

Same as CONFIG_UNICAST_DS_TWR, except P-STS security mode is enabled.

### CONFIG_UNICAST_DS_TWR

```
public static final int CONFIG_UNICAST_DS_TWR = 1
```

Pre-defined unicast STATIC STS DS-TWR ranging.

deferred mode, ranging interval = 240 ms, slot duration = 2400 RSTU, slots per ranging round = 6, hopping mode is enabled

All other MAC parameters use FiRa/UCI default values.

Typical use case: device tracking tags

### RANGING_SLOT_DURATION_1_MILLIS

```
public static final long RANGING_SLOT_DURATION_1_MILLIS = 1
```

1 millisecond slot duration

### RANGING_SLOT_DURATION_2_MILLIS

```
public static final long RANGING_SLOT_DURATION_2_MILLIS = 2
```

2 millisecond slot duration

### RANGING_UPDATE_RATE_AUTOMATIC

```
public static final int RANGING_UPDATE_RATE_AUTOMATIC = 1
```

The update rate that differs across different config id. It is 240 millisecond for `https://developer.android.com/reference/androidx/core/uwb/RangingParameters#CONFIG_UNICAST_DS_TWR()` and `https://developer.android.com/reference/androidx/core/uwb/RangingParameters#CONFIG_PROVISIONED_UNICAST_DS_TWR()`, and is 200 millisecond for other config ids.

### RANGING_UPDATE_RATE_FREQUENT

```
public static final int RANGING_UPDATE_RATE_FREQUENT = 3
```

600 millisecond update rate for all config ids.

### RANGING_UPDATE_RATE_INFREQUENT

```
public static final int RANGING_UPDATE_RATE_INFREQUENT = 2
```

120 millisecond update rate for all config ids.

## Public constructors

### RangingParameters

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core-uwb#1.0.0)

```
public RangingParameters(
    int uwbConfigType,
    int sessionId,
    int subSessionId,
    byte[] sessionKeyInfo,
    byte[] subSessionKeyInfo,
    UwbComplexChannel complexChannel,
    @NonNull List<@NonNull UwbDevice> peerDevices,
    int updateRateType,
    UwbRangeDataNtfConfig uwbRangeDataNtfConfig,
    @IntRange(from = 1, to = 2) long slotDurationMillis,
    boolean isAoaDisabled
)
```

## Public methods

### getComplexChannel

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core-uwb#1.0.0)

```
public final UwbComplexChannel getComplexChannel()
```

Optional. If device type is ROLE_CONTROLEE then complex channel should be set.

### getPeerDevices

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core-uwb#1.0.0)

```
public final @NonNull List<@NonNull UwbDevice> getPeerDevices()
```

The peers to perform ranging with. If using unicast, length should be 1.

### getSessionId

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core-uwb#1.0.0)

```
public final int getSessionId()
```

The ID of the ranging session. If the value is SESSION_ID_UNSET (0), it will be created from the hash of controller address and complex channel values.

The same session IDs should be used at both ends (Controller and controlee).

### getSessionKeyInfo

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core-uwb#1.0.0)

```
public final byte[] getSessionKeyInfo()
```

The session key info to use for the ranging. If the profile uses STATIC STS, this byte array is 8-byte long with first two bytes as Vendor_ID and next six bytes as STATIC_STS_IV. If the profile uses PROVISIONED STS, this byte array is 16 or 32-byte long which represent session key.

The same session keys should be used at both ends (Controller and controlee).

### getSlotDurationMillis

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core-uwb#1.0.0)

```
public final long getSlotDurationMillis()
```

The slot duration of the ranging session in millisecond. The available slot durations are `https://developer.android.com/reference/androidx/core/uwb/RangingParameters#RANGING_SLOT_DURATION_1_MILLIS()` and `https://developer.android.com/reference/androidx/core/uwb/RangingParameters#RANGING_SLOT_DURATION_2_MILLIS()`. Default to `https://developer.android.com/reference/androidx/core/uwb/RangingParameters#RANGING_SLOT_DURATION_2_MILLIS()`.

### getSubSessionId

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core-uwb#1.0.0)

```
public final int getSubSessionId()
```

The ID of the ranging sub-session. This value should be set when the Provisioned STS individual responder case is used. If other config is used, it should remain SUB_SESSION_UNSET (0)

### getSubSessionKeyInfo

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core-uwb#1.0.0)

```
public final byte[] getSubSessionKeyInfo()
```

The sub-session key info to use for the ranging. This byte array is 16 or 32-byte long when the profile uses PROVISIONED STS individual responder cases. If other STS is used, this field should remain null.

### getUpdateRateType

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core-uwb#1.0.0)

```
public final int getUpdateRateType()
```

The update rate type of the ranging data. The update rate types include `https://developer.android.com/reference/androidx/core/uwb/RangingParameters#RANGING_UPDATE_RATE_AUTOMATIC()`, `https://developer.android.com/reference/androidx/core/uwb/RangingParameters#RANGING_UPDATE_RATE_FREQUENT()`, and `https://developer.android.com/reference/androidx/core/uwb/RangingParameters#RANGING_UPDATE_RATE_INFREQUENT()`.

### getUwbConfigType

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core-uwb#1.0.0)

```
public final int getUwbConfigType()
```

The UWB configuration type. One type specifies one fixed set of pre-defined parameters. The UWB config type includes `https://developer.android.com/reference/androidx/core/uwb/RangingParameters#CONFIG_UNICAST_DS_TWR()` and `https://developer.android.com/reference/androidx/core/uwb/RangingParameters#CONFIG_MULTICAST_DS_TWR()`.

### getUwbRangeDataNtfConfig

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core-uwb#1.0.0)

```
public final UwbRangeDataNtfConfig getUwbRangeDataNtfConfig()
```

Configurable range data notification reports for a UWB session.

### isAoaDisabled

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core-uwb#1.0.0)

```
public final boolean isAoaDisabled()
```

The indicator of whether angle of arrival (AoA) is disabled. Default to false.