Added in API level 35

Builder


class Builder
kotlin.Any
   ↳ android.net.wifi.rtt.RangingResult.Builder

Builder class used to construct RangingResult objects.

Summary

Public constructors

Public methods
RangingResult

Build RangingResult

RangingResult.Builder

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

RangingResult.Builder
set80211azNtbMeasurement(is80211azNtbMeasurement: Boolean)

Sets whether the ranging measurement was performed using IEEE 802.

RangingResult.Builder

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

RangingResult.Builder

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

RangingResult.Builder

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

RangingResult.Builder
set80211mcMeasurement(is80211mcMeasurement: Boolean)

Sets whether the ranging measurement was performed using IEEE 802.

RangingResult.Builder
setDistanceMm(distanceMm: Int)

Sets the distance in millimeter.

RangingResult.Builder
setDistanceStdDevMm(distanceStdDevMm: Int)

Sets the standard deviation of the distance in millimeter.

RangingResult.Builder

Sets the Location Configuration Information (LCI).

RangingResult.Builder

Sets the Location Civic Report (LCR).

RangingResult.Builder
setMacAddress(macAddress: MacAddress?)

Sets the MAC address of the ranging result.

RangingResult.Builder

Sets maximum time between measurements in microseconds for IEEE 802.

RangingResult.Builder
setMeasurementBandwidth(measurementBandwidth: Int)

Sets the bandwidth used to transmit the RTT measurement frame.

RangingResult.Builder

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

RangingResult.Builder

Sets minimum time between measurements in microseconds for IEEE 802.

RangingResult.Builder
setNumAttemptedMeasurements(numAttemptedMeasurements: Int)

Sets the total number of RTT measurements attempted.

RangingResult.Builder
setNumSuccessfulMeasurements(numSuccessfulMeasurements: Int)

Sets the total number of successful RTT measurements.

RangingResult.Builder
setPeerHandle(peerHandle: PeerHandle?)

Sets the peer handle.

RangingResult.Builder
setRangingAuthenticated(isRangingAuthenticated: Boolean)

Set whether mutual authentication is done for the ranging.

RangingResult.Builder
setRangingFrameProtected(isRangingFrameProtected: Boolean)

Set whether ranging frames are protected.

RangingResult.Builder

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

RangingResult.Builder
setRssi(rssi: Int)

Sets the average RSSI.

RangingResult.Builder
setSecureHeLtfEnabled(isSecureHeLtfEnabled: Boolean)

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

RangingResult.Builder
setSecureHeLtfProtocolVersion(secureHeLtfProtocolVersion: Int)

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

RangingResult.Builder
setStatus(status: Int)

Sets the Range result status.

RangingResult.Builder

Sets Responder Location.

Public constructors

Builder

Added in API level 35
Builder()

Public methods

build

Added in API level 35
fun build(): RangingResult

Build RangingResult

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

set80211azInitiatorTxLtfRepetitionsCount

Added in API level 35
fun set80211azInitiatorTxLtfRepetitionsCount(i2rTxLtfRepetitions: Int): RangingResult.Builder

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

Parameters
i2rTxLtfRepetitions Int: LFT repetition count.
Return
RangingResult.Builder The builder to facilitate chaining. This value cannot be null.

set80211azNtbMeasurement

Added in API level 35
fun set80211azNtbMeasurement(is80211azNtbMeasurement: Boolean): RangingResult.Builder

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.
Return
RangingResult.Builder The builder to facilitate chaining. This value cannot be null.

set80211azNumberOfRxSpatialStreams

Added in API level 35
fun set80211azNumberOfRxSpatialStreams(numRxSpatialStreams: Int): RangingResult.Builder

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.
Return
RangingResult.Builder The builder to facilitate chaining. This value cannot be null.

set80211azNumberOfTxSpatialStreams

Added in API level 35
fun set80211azNumberOfTxSpatialStreams(numTxSpatialStreams: Int): RangingResult.Builder

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.
Return
RangingResult.Builder The builder to facilitate chaining. This value cannot be null.

set80211azResponderTxLtfRepetitionsCount

Added in API level 35
fun set80211azResponderTxLtfRepetitionsCount(r2iTxLtfRepetitions: Int): RangingResult.Builder

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

Parameters
r2iTxLtfRepetitions Int: LFT repetition count.
Return
RangingResult.Builder The builder to facilitate chaining. This value cannot be null.

set80211mcMeasurement

Added in API level 35
fun set80211mcMeasurement(is80211mcMeasurement: Boolean): RangingResult.Builder

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.
Return
RangingResult.Builder The builder to facilitate chaining. This value cannot be null.

setDistanceMm

Added in API level 35
fun setDistanceMm(distanceMm: Int): RangingResult.Builder

Sets the distance in millimeter.

Parameters
distanceMm Int: distance. If not set, defaults to 0.
Return
RangingResult.Builder The builder to facilitate chaining. This value cannot be null.

setDistanceStdDevMm

Added in API level 35
fun setDistanceStdDevMm(distanceStdDevMm: Int): RangingResult.Builder

Sets the standard deviation of the distance in millimeter.

Parameters
distanceStdDevMm Int: Standard deviation of the distance measurement. If not set defaults to 0.
Return
RangingResult.Builder The builder to facilitate chaining. This value cannot be null.

setLci

Added in API level 35
fun setLci(lci: ByteArray?): RangingResult.Builder

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 ByteArray?: Location configuration information. If not set, defaults to null.
Return
RangingResult.Builder The builder to facilitate chaining. This value cannot be null.

setLcr

Added in API level 35
fun setLcr(lcr: ByteArray?): RangingResult.Builder

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 ByteArray?: Location civic report. If not set, defaults to null.
Return
RangingResult.Builder The builder to facilitate chaining. This value cannot be null.

setMacAddress

Added in API level 35
fun setMacAddress(macAddress: MacAddress?): RangingResult.Builder

Sets the MAC address of the ranging result.

Parameters
macAddress MacAddress?: Mac address, if not defaults to null.
Return
RangingResult.Builder The builder to facilitate chaining. This value cannot be null.

setMaxTimeBetweenNtbMeasurementsMicros

Added in API level 35
fun setMaxTimeBetweenNtbMeasurementsMicros(ntbMaxMeasurementTime: Long): RangingResult.Builder

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.
Return
RangingResult.Builder The builder to facilitate chaining. This value cannot be null.

setMeasurementBandwidth

Added in API level 35
fun setMeasurementBandwidth(measurementBandwidth: Int): RangingResult.Builder

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

Parameters
measurementBandwidth Int: Measurement bandwidth. Value is android.net.wifi.ScanResult#CHANNEL_WIDTH_20MHZ, android.net.wifi.ScanResult#CHANNEL_WIDTH_40MHZ, android.net.wifi.ScanResult#CHANNEL_WIDTH_80MHZ, android.net.wifi.ScanResult#CHANNEL_WIDTH_160MHZ, android.net.wifi.ScanResult#CHANNEL_WIDTH_80MHZ_PLUS_MHZ, or android.net.wifi.ScanResult#CHANNEL_WIDTH_320MHZ
Return
RangingResult.Builder The builder to facilitate chaining. This value cannot be null.

setMeasurementChannelFrequencyMHz

Added in API level 35
fun setMeasurementChannelFrequencyMHz(frequencyMHz: Int): RangingResult.Builder

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.
Return
RangingResult.Builder The builder to facilitate chaining. This value cannot be null.

setMinTimeBetweenNtbMeasurementsMicros

Added in API level 35
fun setMinTimeBetweenNtbMeasurementsMicros(ntbMinMeasurementTime: Long): RangingResult.Builder

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.
Return
RangingResult.Builder The builder to facilitate chaining. This value cannot be null.

setNumAttemptedMeasurements

Added in API level 35
fun setNumAttemptedMeasurements(numAttemptedMeasurements: Int): RangingResult.Builder

Sets the total number of RTT measurements attempted.

Parameters
numAttemptedMeasurements Int: Number of attempted measurements. If not set, default to 0.
Return
RangingResult.Builder The builder to facilitate chaining. This value cannot be null.

setNumSuccessfulMeasurements

Added in API level 35
fun setNumSuccessfulMeasurements(numSuccessfulMeasurements: Int): RangingResult.Builder

Sets the total number of successful RTT measurements.

Parameters
numSuccessfulMeasurements Int: Number of successful measurements. If not set, default to 0.
Return
RangingResult.Builder The builder to facilitate chaining. This value cannot be null.

setPeerHandle

Added in API level 35
fun setPeerHandle(peerHandle: PeerHandle?): RangingResult.Builder

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.
Return
RangingResult.Builder The builder to facilitate chaining. This value cannot be null.

setRangingAuthenticated

fun setRangingAuthenticated(isRangingAuthenticated: Boolean): RangingResult.Builder

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.
Return
RangingResult.Builder The builder to facilitate chaining. This value cannot be null.

setRangingFrameProtected

fun setRangingFrameProtected(isRangingFrameProtected: Boolean): RangingResult.Builder

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.
Return
RangingResult.Builder The builder to facilitate chaining. This value cannot be null.

setRangingTimestampMillis

Added in API level 35
fun setRangingTimestampMillis(timestamp: Long): RangingResult.Builder

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 android.os.SystemClock#elapsedRealtime().

Parameters
timestamp Long: time stamp in milliseconds. If not set, default to 0. Value is a non-negative timestamp in the android.os.SystemClock#elapsedRealtime() time base.
Return
RangingResult.Builder The builder to facilitate chaining. This value cannot be null.

setRssi

Added in API level 35
fun setRssi(rssi: Int): RangingResult.Builder

Sets the average RSSI.

Parameters
rssi Int: Average RSSI. If not set, defaults to -127.
Return
RangingResult.Builder The builder to facilitate chaining. This value cannot be null.

setSecureHeLtfEnabled

fun setSecureHeLtfEnabled(isSecureHeLtfEnabled: Boolean): RangingResult.Builder

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

Parameters
isSecureHeLtfEnabled Boolean: true if secure HE-LTF is enabled, otherwise false.
Return
RangingResult.Builder The builder to facilitate chaining. This value cannot be null.

setSecureHeLtfProtocolVersion

fun setSecureHeLtfProtocolVersion(secureHeLtfProtocolVersion: Int): RangingResult.Builder

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
Return
RangingResult.Builder The builder to facilitate chaining. This value cannot be null.

setStatus

Added in API level 35
fun setStatus(status: Int): RangingResult.Builder

Sets the Range result status.

Parameters
status Int: Ranging result status, if not set defaults to STATUS_FAIL. Value is android.net.wifi.rtt.RangingResult#STATUS_SUCCESS, android.net.wifi.rtt.RangingResult#STATUS_FAIL, or android.net.wifi.rtt.RangingResult#STATUS_RESPONDER_DOES_NOT_SUPPORT_IEEE80211MC
Return
RangingResult.Builder The builder to facilitate chaining. This value cannot be null.

setUnverifiedResponderLocation

Added in API level 35
fun setUnverifiedResponderLocation(responderLocation: ResponderLocation?): RangingResult.Builder

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.
Return
RangingResult.Builder The builder to facilitate chaining. This value cannot be null.