Builder
class Builder
| kotlin.Any | |
| ↳ | android.ranging.RangingPreference.Builder |
Builder for creating instances of RangingPreference.
This Builder class provides a flexible way to construct a RangingPreference instance by setting required and optional parameters. It ensures that all necessary parameters are specified and provides default values for optional configurations.
Example usage:
<code>RangingPreference rangingPreference = new RangingPreference.Builder(DEVICE_ROLE_RESPONDER, new RawResponderRangingParams.Builder() .setRawRangingDevice( new RawRangingDevice.Builder() .setRangingDevice( new RangingDevice.Builder() .build()) .setBleRssiRangingParams( new BleRssiRangingParams.Builder("AA:BB:CC:00:11:22") .build()) .build()) build()) .build(); </code>
Summary
| Public constructors | |
|---|---|
Builder(role: Int, rangingConfig: RangingConfig)Creates a Builder instance with the required device role and |
|
| Public methods | |
|---|---|
| RangingPreference |
build()Builds the |
| RangingPreference.Builder |
setSessionConfig(config: SessionConfig)Sets the configuration parameters for the ranging session policy. |
Public constructors
Builder
Builder(
role: Int,
rangingConfig: RangingConfig)
Creates a Builder instance with the required device role and RangingConfig.
| Parameters | |
|---|---|
role |
Int: the role of the device in android.ranging.RangingPreference.DeviceRole Value is android.ranging.RangingPreference#DEVICE_ROLE_RESPONDER, or android.ranging.RangingPreference#DEVICE_ROLE_INITIATOR |
rangingConfig |
RangingConfig: the RangingConfig to use. Needs to be an instance of one of the following:
null. |
| Exceptions | |
|---|---|
java.lang.NullPointerException |
if rangingConfig is null. |
Public methods
build
fun build(): RangingPreference
Builds the RangingPreference instance.
If the SessionConfig is not set, default instances will be used.
| Return | |
|---|---|
RangingPreference |
a new RangingPreference instance. This value cannot be null. |
setSessionConfig
fun setSessionConfig(config: SessionConfig): RangingPreference.Builder
Sets the configuration parameters for the ranging session policy.
This method allows specifying additional configuration parameters encapsulated in SessionConfig for fine-tuning the behavior of the ranging session.
| Parameters | |
|---|---|
config |
SessionConfig: the SessionConfig. This value cannot be null. |
| Return | |
|---|---|
RangingPreference.Builder |
this Builder instance. This value cannot be null. |
| Exceptions | |
|---|---|
java.lang.NullPointerException |
if config is null. |