WifiPdRangingParams.Builder


public static final class WifiPdRangingParams.Builder
extends Object

java.lang.Object
   ↳ 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:

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();
 

Summary

Public constructors

Builder(MacAddress peerMacAddress)

Constructs a new Builder for creating a ranging session.

Public methods

WifiPdRangingParams build()

Builds the WifiPdRangingParams object.

WifiPdRangingParams.Builder setChannelWidth(int channelWidth)

Sets the channel width.

WifiPdRangingParams.Builder setDeviceIk(byte[] deviceIk)

Sets the device identity key (IK).

WifiPdRangingParams.Builder setDiscoveryChannelFrequencyMhz(int discoveryChannelFrequencyMhz)

Sets the discovery channel frequency in MHz.

WifiPdRangingParams.Builder setPasnMode(int pasnMode)

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

WifiPdRangingParams.Builder setPassword(String password)

Sets the password for the ranging session.

WifiPdRangingParams.Builder setPreambleType(int preambleType)

Sets the preamble type.

WifiPdRangingParams.Builder setRangingUpdateRate(int rangingUpdateRate)

Sets the ranging update rate.

WifiPdRangingParams.Builder setResponder80211azNtbSupported(boolean isResponder80211azNtbSupported)

Sets whether the responder supports 802.11az NTB.

Inherited methods

Public constructors

Builder

public Builder (MacAddress peerMacAddress)

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

public WifiPdRangingParams build ()

Builds the WifiPdRangingParams object.

Returns
WifiPdRangingParams The built WifiPdRangingParams object.
This value cannot be null.

Throws
IllegalStateException if required parameters are not set.

setChannelWidth

public WifiPdRangingParams.Builder setChannelWidth (int channelWidth)

Sets the channel width.

Parameters
channelWidth int: The channel width.
Value is one of the following:
Returns
WifiPdRangingParams.Builder The builder to facilitate chaining.
This value cannot be null.

setDeviceIk

public WifiPdRangingParams.Builder setDeviceIk (byte[] deviceIk)

Sets the device identity key (IK).

Parameters
deviceIk byte: The device identity key.
This value may be null.

Returns
WifiPdRangingParams.Builder The builder to facilitate chaining.
This value cannot be null.

setDiscoveryChannelFrequencyMhz

public WifiPdRangingParams.Builder setDiscoveryChannelFrequencyMhz (int discoveryChannelFrequencyMhz)

Sets the discovery channel frequency in MHz.

Parameters
discoveryChannelFrequencyMhz int: The discovery channel frequency in MHz.
Value is between 2400 and 7125 inclusive

Returns
WifiPdRangingParams.Builder The builder to facilitate chaining.
This value cannot be null.

setPasnMode

public WifiPdRangingParams.Builder setPasnMode (int pasnMode)

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

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

setPassword

public WifiPdRangingParams.Builder setPassword (String password)

Sets the password for the ranging session.

Parameters
password String: The password for the ranging session.
This value may be null.

Returns
WifiPdRangingParams.Builder The builder to facilitate chaining.
This value cannot be null.

setPreambleType

public WifiPdRangingParams.Builder setPreambleType (int preambleType)

Sets the preamble type.

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

setRangingUpdateRate

public WifiPdRangingParams.Builder setRangingUpdateRate (int rangingUpdateRate)

Sets the ranging update rate.

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

setResponder80211azNtbSupported

public WifiPdRangingParams.Builder setResponder80211azNtbSupported (boolean isResponder80211azNtbSupported)

Sets whether the responder supports 802.11az NTB.

Parameters
isResponder80211azNtbSupported boolean: Whether the responder supports 802.11az NTB.

Returns
WifiPdRangingParams.Builder The builder to facilitate chaining.
This value cannot be null.