Builder


class Builder
kotlin.Any
   ↳ android.ranging.wifi.pd.WifiPdRangingParams.Builder

Builder for WifiPdRangingParams.

This class provides a convenient way to construct WifiPdRangingParams objects. The MAC address of the peer device and the ranging service role are mandatory parameters and must be provided during the Builder's construction. Other parameters are optional and can be set using the respective setter methods.

Example usage:

<code>MacAddress peerMacAddress = MacAddress.fromString("01:02:03:04:05:06");
  WifiPdRangingParams params = new WifiPdRangingParams.Builder(peerMacAddress)
          .setDiscoveryChannelFrequencyMhz(5180)
          .setPasnMode(WifiPdRangingCapabilities.AUTHENTICATED_PASN_MODE)
          .setPassword("myPassword")
          .setDeviceIk(new byte[] {0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C})
          .build();
  </code>

Summary

Public constructors
Builder(peerMacAddress: MacAddress)

Constructs a new Builder for creating a ranging session.

Public methods
WifiPdRangingParams

Builds the WifiPdRangingParams object.

WifiPdRangingParams.Builder
setChannelWidth(channelWidth: Int)

Sets the channel width.

WifiPdRangingParams.Builder
setDeviceIk(deviceIk: ByteArray?)

Sets the device identity key (IK).

WifiPdRangingParams.Builder
setDiscoveryChannelFrequencyMhz(discoveryChannelFrequencyMhz: Int)

Sets the discovery channel frequency in MHz.

WifiPdRangingParams.Builder
setPasnMode(pasnMode: Int)

Sets the PASN (Pre-association security negotiation) mode.

WifiPdRangingParams.Builder
setPassword(password: String?)

Sets the password for the ranging session.

WifiPdRangingParams.Builder
setPreambleType(preambleType: Int)

Sets the preamble type.

WifiPdRangingParams.Builder
setRangingUpdateRate(rangingUpdateRate: Int)

Sets the ranging update rate.

WifiPdRangingParams.Builder
setResponder80211azNtbSupported(isResponder80211azNtbSupported: Boolean)

Sets whether the responder supports 802.

Public constructors

Builder

Builder(peerMacAddress: MacAddress)

Constructs a new Builder for creating a ranging session.

Parameters
peerMacAddress MacAddress: The MAC address of the peer device.
This value cannot be null.

Public methods

build

fun build(): WifiPdRangingParams

Builds the WifiPdRangingParams object.

Return
WifiPdRangingParams The built WifiPdRangingParams object.
This value cannot be null.
Exceptions
java.lang.IllegalStateException if required parameters are not set.

setDeviceIk

fun setDeviceIk(deviceIk: ByteArray?): WifiPdRangingParams.Builder

Sets the device identity key (IK).

Parameters
deviceIk ByteArray?: The device identity key.
This value may be null.
Return
WifiPdRangingParams.Builder The builder to facilitate chaining.
This value cannot be null.

setDiscoveryChannelFrequencyMhz

fun setDiscoveryChannelFrequencyMhz(discoveryChannelFrequencyMhz: Int): WifiPdRangingParams.Builder

Sets the discovery channel frequency in MHz.

Parameters
discoveryChannelFrequencyMhz Int: The discovery channel frequency in MHz.
Value is between 2400 and 7125 inclusive
Return
WifiPdRangingParams.Builder The builder to facilitate chaining.
This value cannot be null.

setPasnMode

fun setPasnMode(pasnMode: Int): WifiPdRangingParams.Builder

Sets the PASN (Pre-association security negotiation) mode.

Parameters
pasnMode Int: The PASN mode.
Value is one of the following:
Return
WifiPdRangingParams.Builder The builder to facilitate chaining.
This value cannot be null.

setPassword

fun setPassword(password: String?): WifiPdRangingParams.Builder

Sets the password for the ranging session.

Parameters
password String?: The password for the ranging session.
This value may be null.
Return
WifiPdRangingParams.Builder The builder to facilitate chaining.
This value cannot be null.

setPreambleType

fun setPreambleType(preambleType: Int): WifiPdRangingParams.Builder

Sets the preamble type.

Parameters
preambleType Int: The preamble type.
Value is one of the following:
Return
WifiPdRangingParams.Builder The builder to facilitate chaining.
This value cannot be null.

setRangingUpdateRate

fun setRangingUpdateRate(rangingUpdateRate: Int): WifiPdRangingParams.Builder

Sets the ranging update rate.

Parameters
rangingUpdateRate Int: The ranging update rate.
Value is one of the following:
Return
WifiPdRangingParams.Builder The builder to facilitate chaining.
This value cannot be null.

setResponder80211azNtbSupported

fun setResponder80211azNtbSupported(isResponder80211azNtbSupported: Boolean): WifiPdRangingParams.Builder

Sets whether the responder supports 802.11az NTB.

Parameters
isResponder80211azNtbSupported Boolean: Whether the responder supports 802.11az NTB.
Return
WifiPdRangingParams.Builder The builder to facilitate chaining.
This value cannot be null.