RangingResult


public final class RangingResult
extends Object implements Parcelable

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


Ranging result for a request started by WifiRttManager#startRanging(RangingRequest, java.util.concurrent.Executor, RangingResultCallback). Results are returned in RangingResultCallback#onRangingResults(List).

A ranging result is the distance measurement result for a single device specified in the RangingRequest.

Summary

Nested classes

class RangingResult.Builder

Builder class used to construct RangingResult objects. 

Constants

int STATUS_FAIL

Individual range request status, getStatus().

int STATUS_RESPONDER_DOES_NOT_SUPPORT_IEEE80211MC

Individual range request status, getStatus().

int STATUS_SUCCESS

Individual range request status, getStatus().

int UNSPECIFIED

The unspecified value.

Inherited constants

Fields

public static final Creator<RangingResult> CREATOR

Public methods

int describeContents()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.

boolean equals(Object o)

Indicates whether some other object is "equal to" this one.

int get80211azInitiatorTxLtfRepetitionsCount()

Gets LTF repetitions that the initiator station (ISTA) used in the preamble of the initiator to responder (I2R) null data PPDU (NDP) for this result.

int get80211azNumberOfRxSpatialStreams()

Gets number of receive spatial streams that the initiator station (ISTA) used for the initiator to responder (I2R) null data PPDU (NDP) for this result.

int get80211azNumberOfTxSpatialStreams()

Gets number of transmit spatial streams that the initiator station (ISTA) used for the initiator to responder (I2R) null data PPDU (NDP) for this result.

int get80211azResponderTxLtfRepetitionsCount()

Gets LTF repetitions that the responder station (RSTA) used in the preamble of the responder to initiator (I2R) null data PPDU (NDP) for this result.

int getDistanceMm()
int getDistanceStdDevMm()
byte[] getLci()
byte[] getLcr()
MacAddress getMacAddress()
long getMaxTimeBetweenNtbMeasurementsMicros()

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

int getMeasurementBandwidth()

The bandwidth used to transmit the RTT measurement frame.

int getMeasurementChannelFrequencyMHz()

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

long getMinTimeBetweenNtbMeasurementsMicros()

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

int getNumAttemptedMeasurements()
int getNumSuccessfulMeasurements()
PeerHandle getPeerHandle()
long getRangingTimestampMillis()
int getRssi()
int getStatus()
ResponderLocation getUnverifiedResponderLocation()
int hashCode()

Returns a hash code value for the object.

boolean is80211azNtbMeasurement()
boolean is80211mcMeasurement()
void writeToParcel(Parcel dest, int flags)

Flatten this object in to a Parcel.

Inherited methods

Constants

STATUS_FAIL

Added in API level 28
public static final int STATUS_FAIL

Individual range request status, getStatus(). Indicates ranging operation failed and the distance value is invalid.

Constant Value: 1 (0x00000001)

STATUS_RESPONDER_DOES_NOT_SUPPORT_IEEE80211MC

Added in API level 28
public static final int STATUS_RESPONDER_DOES_NOT_SUPPORT_IEEE80211MC

Individual range request status, getStatus(). Indicates that the ranging operation failed because the specified peer does not support IEEE 802.11mc RTT operations. Support by an Access Point can be confirmed using ScanResult.is80211mcResponder().

On such a failure, the individual result fields of RangingResult such as RangingResult#getDistanceMm() are invalid.

Constant Value: 2 (0x00000002)

STATUS_SUCCESS

Added in API level 28
public static final int STATUS_SUCCESS

Individual range request status, getStatus(). Indicates ranging operation was successful and distance value is valid.

Constant Value: 0 (0x00000000)

UNSPECIFIED

Added in API level 34
public static final int UNSPECIFIED

The unspecified value.

Constant Value: -1 (0xffffffff)

Fields

CREATOR

Added in API level 28
public static final Creator<RangingResult> CREATOR

Public methods

describeContents

Added in API level 28
public int describeContents ()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of writeToParcel(android.os.Parcel, int), the return value of this method must include the CONTENTS_FILE_DESCRIPTOR bit.

Returns
int a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or CONTENTS_FILE_DESCRIPTOR

equals

Added in API level 28
public boolean equals (Object o)

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
o Object: the reference object with which to compare.

Returns
boolean true if this object is the same as the obj argument; false otherwise.

get80211azInitiatorTxLtfRepetitionsCount

Added in API level 35
public int get80211azInitiatorTxLtfRepetitionsCount ()

Gets LTF repetitions that the initiator station (ISTA) used in the preamble of the initiator to responder (I2R) null data PPDU (NDP) for this result. LTF repetitions is the multiple transmissions of HE-LTF symbols in an HE ranging NDP. An HE-LTF repetition value of 1 indicates no repetitions.

Returns
int LTF repetitions count

get80211azNumberOfRxSpatialStreams

Added in API level 35
public int get80211azNumberOfRxSpatialStreams ()

Gets number of receive spatial streams that the initiator station (ISTA) used for the initiator to responder (I2R) null data PPDU (NDP) for this result.

Returns
int Number of spatial streams

get80211azNumberOfTxSpatialStreams

Added in API level 35
public int get80211azNumberOfTxSpatialStreams ()

Gets number of transmit spatial streams that the initiator station (ISTA) used for the initiator to responder (I2R) null data PPDU (NDP) for this result.

Returns
int Number of spatial streams

get80211azResponderTxLtfRepetitionsCount

Added in API level 35
public int get80211azResponderTxLtfRepetitionsCount ()

Gets LTF repetitions that the responder station (RSTA) used in the preamble of the responder to initiator (I2R) null data PPDU (NDP) for this result. LTF repetitions is the multiple transmissions of HE-LTF symbols in an HE ranging NDP. An HE-LTF repetition value of 1 indicates no repetitions.

Returns
int LTF repetitions count

getDistanceMm

Added in API level 28
public int getDistanceMm ()

Returns
int The distance (in mm) to the device specified by getMacAddress() or getPeerHandle().

Note: the measured distance may be negative for very close devices.

Only valid if getStatus() returns STATUS_SUCCESS, otherwise will throw an exception.

getDistanceStdDevMm

Added in API level 28
public int getDistanceStdDevMm ()

Returns
int The standard deviation of the measured distance (in mm) to the device specified by getMacAddress() or getPeerHandle(). The standard deviation is calculated over the measurements executed in a single RTT burst. The number of measurements is returned by getNumSuccessfulMeasurements() - 0 successful measurements indicate that the standard deviation is not valid (a valid standard deviation requires at least 2 data points).

Only valid if getStatus() returns STATUS_SUCCESS, otherwise will throw an exception.

getLci

Added in API level 35
public byte[] getLci ()

Returns
byte[] The Location Configuration Information (LCI) as self-reported by the peer. The format is specified in the IEEE 802.11-2016 specifications, section 9.4.2.22.10.

Note: the information is NOT validated - use with caution. Consider validating it with other sources of information before using it. This value cannot be null.

getLcr

Added in API level 35
public byte[] getLcr ()

Returns
byte[] The Location Civic report (LCR) as self-reported by the peer. The format is specified in the IEEE 802.11-2016 specifications, section 9.4.2.22.13.

Note: the information is NOT validated - use with caution. Consider validating it with other sources of information before using it. This value cannot be null.

getMacAddress

Added in API level 28
public MacAddress getMacAddress ()

Returns
MacAddress The MAC address of the device whose range measurement was requested. Will correspond to the MAC address of the device in the RangingRequest.

Will return a null for results corresponding to requests issued using a PeerHandle, i.e. using the RangingRequest.Builder#addWifiAwarePeer(PeerHandle) API.

getMaxTimeBetweenNtbMeasurementsMicros

Added in API level 35
public long getMaxTimeBetweenNtbMeasurementsMicros ()

Gets maximum time between measurements in microseconds for IEEE 802.11az non-trigger based ranging. The next 11az ranging request needs to be invoked before the maximum time from the last measurement time getRangingTimestampMillis(). Otherwise, the non-trigger based ranging session will be terminated and a new ranging negotiation will happen with the responding station.

Returns
long

getMeasurementChannelFrequencyMHz

Added in API level 34
public int getMeasurementChannelFrequencyMHz ()

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

Returns
int center frequency in Mhz of the channel if available, otherwise UNSPECIFIED is returned.

Throws
IllegalStateException if getStatus() does not return STATUS_SUCCESS.

getMinTimeBetweenNtbMeasurementsMicros

Added in API level 35
public long getMinTimeBetweenNtbMeasurementsMicros ()

Gets minimum time between measurements in microseconds for IEEE 802.11az non-trigger based ranging. The next 11az ranging measurement request must be invoked after the minimum time from the last measurement time getRangingTimestampMillis() for the peer. Otherwise, cached ranging result will be returned for the peer.

Returns
long

getNumAttemptedMeasurements

Added in API level 28
public int getNumAttemptedMeasurements ()

Returns
int The number of attempted measurements used in the RTT exchange resulting in this set of results. The number of successful measurements is returned by getNumSuccessfulMeasurements() which at most, if there are no errors, will be 1 less than the number of attempted measurements.

Only valid if getStatus() returns STATUS_SUCCESS, otherwise will throw an exception. If the value is 0, it should be interpreted as no information available, which may occur for one-sided RTT measurements. Instead RangingRequest#getRttBurstSize() should be used instead.

getNumSuccessfulMeasurements

Added in API level 28
public int getNumSuccessfulMeasurements ()

Returns
int The number of successful measurements used to calculate the distance and standard deviation. If the number of successful measurements if 1 then then standard deviation, returned by getDistanceStdDevMm(), is not valid (a 0 is returned for the standard deviation).

The total number of measurement attempts is returned by getNumAttemptedMeasurements(). The number of successful measurements will be at most 1 less then the number of attempted measurements.

Only valid if getStatus() returns STATUS_SUCCESS, otherwise will throw an exception.

getPeerHandle

Added in API level 28
public PeerHandle getPeerHandle ()

Returns
PeerHandle The PeerHandle of the device whose reange measurement was requested. Will correspond to the PeerHandle of the devices requested using RangingRequest.Builder#addWifiAwarePeer(PeerHandle).

Will return a null for results corresponding to requests issued using a MAC address.

getRangingTimestampMillis

Added in API level 28
public long getRangingTimestampMillis ()

Returns
long The timestamp 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().

Only valid if getStatus() returns STATUS_SUCCESS, otherwise will throw an exception.

getRssi

Added in API level 28
public int getRssi ()

Returns
int The average RSSI, in units of dBm, observed during the RTT measurement.

Only valid if getStatus() returns STATUS_SUCCESS, otherwise will throw an exception.

getStatus

Added in API level 28
public int getStatus ()

Returns
int The status of ranging measurement: STATUS_SUCCESS in case of success, and STATUS_FAIL in case of failure. Value is STATUS_SUCCESS, STATUS_FAIL, or STATUS_RESPONDER_DOES_NOT_SUPPORT_IEEE80211MC

getUnverifiedResponderLocation

Added in API level 29
public ResponderLocation getUnverifiedResponderLocation ()

Returns
ResponderLocation The unverified responder location represented as ResponderLocation which captures location information the responder is programmed to broadcast. The responder location is referred to as unverified, because we are relying on the device/site administrator to correctly configure its location data.

Will return a null when the location information cannot be parsed.

Only valid if getStatus() returns STATUS_SUCCESS, otherwise will throw an exception.

hashCode

Added in API level 28
public int hashCode ()

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.

Returns
int a hash code value for this object.

is80211azNtbMeasurement

Added in API level 35
public boolean is80211azNtbMeasurement ()

Returns
boolean The result is true if the IEEE 802.11az non-trigger based protocol was used. If the result is false, and is80211mcMeasurement() is also false a one-side RTT result is provided which does not subtract the turnaround time at the responder.

. Only valid if getStatus() returns STATUS_SUCCESS, otherwise will throw an exception.

is80211mcMeasurement

Added in API level 31
public boolean is80211mcMeasurement ()

Returns
boolean The result is true if the IEEE 802.11mc protocol was used. If the result is false, and is80211azNtbMeasurement() is also false a one-side RTT result is provided which does not subtract the turnaround time at the responder.

Only valid if getStatus() returns STATUS_SUCCESS, otherwise will throw an exception.

writeToParcel

Added in API level 28
public void writeToParcel (Parcel dest, 
                int flags)

Flatten this object in to a Parcel.

Parameters
dest Parcel: The Parcel in which the object should be written. This value cannot be null.

flags int: Additional flags about how the object should be written. May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of Parcelable.PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES