RangingResult.Builder


public static final class RangingResult.Builder
extends Object

java.lang.Object
   ↳ android.net.wifi.rtt.RangingResult.Builder


Builder class used to construct RangingResult objects.

Summary

Public constructors

Builder()

Public methods

RangingResult build()

Build RangingResult

RangingResult.Builder set80211azInitiatorTxLtfRepetitionsCount(int i2rTxLtfRepetitions)

Sets LTF repetitions that the initiator station used in the preamble.

RangingResult.Builder set80211azNtbMeasurement(boolean is80211azNtbMeasurement)

Sets whether the ranging measurement was performed using IEEE 802.11az non-trigger ranging method.

RangingResult.Builder set80211azNumberOfRxSpatialStreams(int numRxSpatialStreams)

Sets number of receive spatial streams that the initiator station used for the ranging result.

RangingResult.Builder set80211azNumberOfTxSpatialStreams(int numTxSpatialStreams)

Sets number of transmit spatial streams that the initiator station used for the ranging result.

RangingResult.Builder set80211azResponderTxLtfRepetitionsCount(int r2iTxLtfRepetitions)

Sets LTF repetitions that the responder station used in the preamble.

RangingResult.Builder set80211mcMeasurement(boolean is80211mcMeasurement)

Sets whether the ranging measurement was performed using IEEE 802.11mc ranging method.

RangingResult.Builder setDistanceMm(int distanceMm)

Sets the distance in millimeter.

RangingResult.Builder setDistanceStdDevMm(int distanceStdDevMm)

Sets the standard deviation of the distance in millimeter.

RangingResult.Builder setLci(byte[] lci)

Sets the Location Configuration Information (LCI).

RangingResult.Builder setLcr(byte[] lcr)

Sets the Location Civic Report (LCR).

RangingResult.Builder setMacAddress(MacAddress macAddress)

Sets the MAC address of the ranging result.

RangingResult.Builder setMaxTimeBetweenNtbMeasurementsMicros(long ntbMaxMeasurementTime)

Sets maximum time between measurements in microseconds for IEEE 802.11az non-trigger based ranging.

RangingResult.Builder setMeasurementBandwidth(int measurementBandwidth)

Sets the bandwidth used to transmit the RTT measurement frame.

RangingResult.Builder setMeasurementChannelFrequencyMHz(int frequencyMHz)

Sets the center frequency of the primary 20 MHz frequency (in MHz) of the channel over which the measurement frames are sent.

RangingResult.Builder setMinTimeBetweenNtbMeasurementsMicros(long ntbMinMeasurementTime)

Sets minimum time between measurements in microseconds for IEEE 802.11az non-trigger based ranging.

RangingResult.Builder setNumAttemptedMeasurements(int numAttemptedMeasurements)

Sets the total number of RTT measurements attempted.

RangingResult.Builder setNumSuccessfulMeasurements(int numSuccessfulMeasurements)

Sets the total number of successful RTT measurements.

RangingResult.Builder setPeerHandle(PeerHandle peerHandle)

Sets the peer handle.

RangingResult.Builder setRangingAuthenticated(boolean isRangingAuthenticated)

Set whether mutual authentication is done for the ranging.

RangingResult.Builder setRangingFrameProtected(boolean isRangingFrameProtected)

Set whether ranging frames are protected.

RangingResult.Builder setRangingTimestampMillis(long timestamp)

Sets the time stamp at which the ranging operation was performed.

RangingResult.Builder setRssi(int rssi)

Sets the average RSSI.

RangingResult.Builder setSecureHeLtfEnabled(boolean isSecureHeLtfEnabled)

Set whether secure HE-LTF is used for this ranging.

RangingResult.Builder setSecureHeLtfProtocolVersion(int secureHeLtfProtocolVersion)

Set secure HE-LTF protocol version used for this ranging.

RangingResult.Builder setStatus(int status)

Sets the Range result status.

RangingResult.Builder setUnverifiedResponderLocation(ResponderLocation responderLocation)

Sets Responder Location.

Inherited methods

Public constructors

Builder

Added in API level 35
public Builder ()

Public methods

build

Added in API level 35
public RangingResult build ()

Build RangingResult

Returns
RangingResult an instance of RangingResult This value cannot be null.

set80211azInitiatorTxLtfRepetitionsCount

Added in API level 35
public RangingResult.Builder set80211azInitiatorTxLtfRepetitionsCount (int i2rTxLtfRepetitions)

Sets LTF repetitions that the initiator station used in the preamble. If not set, defaults to RangingResult.UNSPECIFIED.

Parameters
i2rTxLtfRepetitions int: LFT repetition count.

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

set80211azNtbMeasurement

Added in API level 35
public RangingResult.Builder set80211azNtbMeasurement (boolean is80211azNtbMeasurement)

Sets whether the ranging measurement was performed using IEEE 802.11az non-trigger ranging method. If set80211azNtbMeasurement(boolean) is set as false and set80211mcMeasurement(boolean) is also set as false, ranging measurement was performed using one-side RTT. If not set defaults to false.

Parameters
is80211azNtbMeasurement boolean: true for IEEE 802.11az non-trigger based measurement, otherwise false.

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

set80211azNumberOfRxSpatialStreams

Added in API level 35
public RangingResult.Builder set80211azNumberOfRxSpatialStreams (int numRxSpatialStreams)

Sets number of receive spatial streams that the initiator station used for the ranging result. If not set, defaults to RangingResult.UNSPECIFIED.

Parameters
numRxSpatialStreams int: Number of receive spatial streams.

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

set80211azNumberOfTxSpatialStreams

Added in API level 35
public RangingResult.Builder set80211azNumberOfTxSpatialStreams (int numTxSpatialStreams)

Sets number of transmit spatial streams that the initiator station used for the ranging result. If not set, defaults to RangingResult.UNSPECIFIED.

Parameters
numTxSpatialStreams int: Number of transmit spatial streams.

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

set80211azResponderTxLtfRepetitionsCount

Added in API level 35
public RangingResult.Builder set80211azResponderTxLtfRepetitionsCount (int r2iTxLtfRepetitions)

Sets LTF repetitions that the responder station used in the preamble. If not set, defaults to RangingResult.UNSPECIFIED.

Parameters
r2iTxLtfRepetitions int: LFT repetition count.

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

set80211mcMeasurement

Added in API level 35
public RangingResult.Builder set80211mcMeasurement (boolean is80211mcMeasurement)

Sets whether the ranging measurement was performed using IEEE 802.11mc ranging method. If set80211mcMeasurement(boolean) is set as false and set80211azNtbMeasurement(boolean) is also set as false, ranging measurement was performed using one-side RTT. If not set, default to false.

Parameters
is80211mcMeasurement boolean: true for IEEE 802.11mc measure, otherwise false.

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

setDistanceMm

Added in API level 35
public RangingResult.Builder setDistanceMm (int distanceMm)

Sets the distance in millimeter.

Parameters
distanceMm int: distance. If not set, defaults to 0.

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

setDistanceStdDevMm

Added in API level 35
public RangingResult.Builder setDistanceStdDevMm (int distanceStdDevMm)

Sets the standard deviation of the distance in millimeter.

Parameters
distanceStdDevMm int: Standard deviation of the distance measurement. If not set defaults to 0.

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

setLci

Added in API level 35
public RangingResult.Builder setLci (byte[] lci)

Sets the Location Configuration Information (LCI). LCI provides data about the access point's (AP) physical location, such as its latitude, longitude, and altitude. The format is specified in the IEEE 802.11-2016 specifications, section 9.4.2.22.10.

Parameters
lci byte: Location configuration information. If not set, defaults to null.

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

setLcr

Added in API level 35
public RangingResult.Builder setLcr (byte[] lcr)

Sets the Location Civic Report (LCR). LCR provides additional details about the AP's location in a human-readable format, such as the street address, building name, or floor number. This can be helpful for users to understand the context of their location within a building or complex. The format is specified in the IEEE 802.11-2016 specifications, section 9.4.2.22.13.

Parameters
lcr byte: Location civic report. If not set, defaults to null.

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

setMacAddress

Added in API level 35
public RangingResult.Builder setMacAddress (MacAddress macAddress)

Sets the MAC address of the ranging result.

Parameters
macAddress MacAddress: Mac address, if not defaults to null.

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

setMaxTimeBetweenNtbMeasurementsMicros

Added in API level 35
public RangingResult.Builder setMaxTimeBetweenNtbMeasurementsMicros (long ntbMaxMeasurementTime)

Sets maximum time between measurements in microseconds for IEEE 802.11az non-trigger based ranging. If not set, defaults to RangingResult.UNSPECIFIED.

Parameters
ntbMaxMeasurementTime long: non-trigger based ranging maximum measurement time.

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

setMeasurementBandwidth

Added in API level 35
public RangingResult.Builder setMeasurementBandwidth (int measurementBandwidth)

Sets the bandwidth used to transmit the RTT measurement frame. If not set, default to RangingResult.UNSPECIFIED.

Parameters
measurementBandwidth int: Measurement bandwidth. Value is ScanResult.CHANNEL_WIDTH_20MHZ, ScanResult.CHANNEL_WIDTH_40MHZ, ScanResult.CHANNEL_WIDTH_80MHZ, ScanResult.CHANNEL_WIDTH_160MHZ, ScanResult.CHANNEL_WIDTH_80MHZ_PLUS_MHZ, or ScanResult.CHANNEL_WIDTH_320MHZ

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

setMeasurementChannelFrequencyMHz

Added in API level 35
public RangingResult.Builder setMeasurementChannelFrequencyMHz (int frequencyMHz)

Sets the center frequency of the primary 20 MHz frequency (in MHz) of the channel over which the measurement frames are sent. If not set, default to RangingResult.UNSPECIFIED

Parameters
frequencyMHz int: Frequency.

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

setMinTimeBetweenNtbMeasurementsMicros

Added in API level 35
public RangingResult.Builder setMinTimeBetweenNtbMeasurementsMicros (long ntbMinMeasurementTime)

Sets minimum time between measurements in microseconds for IEEE 802.11az non-trigger based ranging. If not set, defaults to RangingResult.UNSPECIFIED.

Parameters
ntbMinMeasurementTime long: non-trigger based ranging minimum measurement time.

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

setNumAttemptedMeasurements

Added in API level 35
public RangingResult.Builder setNumAttemptedMeasurements (int numAttemptedMeasurements)

Sets the total number of RTT measurements attempted.

Parameters
numAttemptedMeasurements int: Number of attempted measurements. If not set, default to 0.

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

setNumSuccessfulMeasurements

Added in API level 35
public RangingResult.Builder setNumSuccessfulMeasurements (int numSuccessfulMeasurements)

Sets the total number of successful RTT measurements.

Parameters
numSuccessfulMeasurements int: Number of successful measurements. If not set, default to 0.

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

setPeerHandle

Added in API level 35
public RangingResult.Builder setPeerHandle (PeerHandle peerHandle)

Sets the peer handle. Applicable only for NAN Ranging.

Parameters
peerHandle PeerHandle: Opaque object used to represent a Wi-Fi Aware peer. If not set, defaults to null.

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

setRangingAuthenticated

public RangingResult.Builder setRangingAuthenticated (boolean isRangingAuthenticated)

Set whether mutual authentication is done for the ranging. Authentication of ranging enables frame protection also. See setRangingFrameProtected(boolean).

Parameters
isRangingAuthenticated boolean: true if ranging is mutually authenticated, otherwise false.

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

setRangingFrameProtected

public RangingResult.Builder setRangingFrameProtected (boolean isRangingFrameProtected)

Set whether ranging frames are protected. Frame protection provides both encryption and integrity protection to the ranging frames.

Parameters
isRangingFrameProtected boolean: true if ranging frames are protected, otherwise false.

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

setRangingTimestampMillis

Added in API level 35
public RangingResult.Builder setRangingTimestampMillis (long timestamp)

Sets the time stamp at which the ranging operation was performed. The timestamp is in milliseconds since boot, including time spent in sleep, corresponding to values provided by SystemClock.elapsedRealtime().

Parameters
timestamp long: time stamp in milliseconds. If not set, default to 0. Value is a non-negative timestamp in the SystemClock.elapsedRealtime() time base.

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

setRssi

Added in API level 35
public RangingResult.Builder setRssi (int rssi)

Sets the average RSSI.

Parameters
rssi int: Average RSSI. If not set, defaults to -127.

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

setSecureHeLtfEnabled

public RangingResult.Builder setSecureHeLtfEnabled (boolean isSecureHeLtfEnabled)

Set whether secure HE-LTF is used for this ranging.

Parameters
isSecureHeLtfEnabled boolean: true if secure HE-LTF is enabled, otherwise false.

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

setSecureHeLtfProtocolVersion

public RangingResult.Builder setSecureHeLtfProtocolVersion (int secureHeLtfProtocolVersion)

Set secure HE-LTF protocol version used for this ranging. The secure HE-LTF negotiation supports negotiation of the secure HE-LTF protocol version which allows a responder and an initiator to negotiate the highest mutually supported secure HE-LTF protocol version. Refer IEEE 802.11az-2022 spec, section 9.4.2.298 Ranging Parameters element.

Parameters
secureHeLtfProtocolVersion int: Secure HE-LTF protocol version. Value is between 0 and 7 inclusive

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

setStatus

Added in API level 35
public RangingResult.Builder setStatus (int status)

Sets the Range result status.

Parameters
status int: Ranging result status, if not set defaults to RangingResult.STATUS_FAIL. Value is RangingResult.STATUS_SUCCESS, RangingResult.STATUS_FAIL, or RangingResult.STATUS_RESPONDER_DOES_NOT_SUPPORT_IEEE80211MC

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

setUnverifiedResponderLocation

Added in API level 35
public RangingResult.Builder setUnverifiedResponderLocation (ResponderLocation responderLocation)

Sets Responder Location. ResponderLocation is both a Location Configuration Information (LCI) decoder and a Location Civic Report (LCR) decoder for information received from a Wi-Fi Access Point (AP) during Wi-Fi RTT ranging process.

Parameters
responderLocation ResponderLocation: Responder location. If not set, defaults to null.

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