RangingData


public final class RangingData
extends Object implements Parcelable

java.lang.Object
   ↳ android.ranging.RangingData


Represents ranging data, including distance, azimuth, elevation, and RSSI measurements, along with the ranging technology used and a timestamp.

Summary

Inherited constants

Fields

public static final Creator<RangingData> CREATOR

Public methods

int describeContents()

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

RangingMeasurement getAzimuth()

Returns the azimuth measurement, or null if not available.

RangingMeasurement getDistance()

Returns the distance measurement.

double getDistanceStandardDeviationMeters()

Get the standard deviation of distance in meters .

RangingMeasurement getElevation()

Returns the elevation measurement, or null if not available.

int getRangingTechnology()

Returns the ranging technology used.

int getRssi()

Returns the RSSI (Received Signal Strength Indicator) value.

long getTimestampMillis()

Returns the timestamp of when the ranging data was collected.

boolean hasDistanceStandardDeviation()

Check if the standard deviation of distance is set.

boolean hasRssi()

Returns whether an RSSI measurement is included with the data.

void writeToParcel(Parcel dest, int flags)

Flatten this object in to a Parcel.

Inherited methods

Fields

CREATOR

Added in API level 36
public static final Creator<RangingData> CREATOR

Public methods

describeContents

Added in API level 36
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

getAzimuth

Added in API level 36
public RangingMeasurement getAzimuth ()

Returns the azimuth measurement, or null if not available.

Returns
RangingMeasurement The RangingMeasurement representing the azimuth, or null.

getDistance

Added in API level 36
public RangingMeasurement getDistance ()

Returns the distance measurement.

Returns
RangingMeasurement The RangingMeasurement representing the distance. This value may be null.

getDistanceStandardDeviationMeters

public double getDistanceStandardDeviationMeters ()

Get the standard deviation of distance in meters .

Returned value will be positive if it exists

Returns
double The standard deviation of distance in meters.

Throws
IllegalStateException if distance standard deviation is not set.

getElevation

Added in API level 36
public RangingMeasurement getElevation ()

Returns the elevation measurement, or null if not available.

Returns
RangingMeasurement The RangingMeasurement representing the elevation, or null.

getRangingTechnology

Added in API level 36
public int getRangingTechnology ()

Returns the ranging technology used.

Returns
int The ranging technology as an integer. Value is RangingManager.UWB, RangingManager.BLE_CS, RangingManager.WIFI_NAN_RTT, RangingManager.BLE_RSSI, or RangingManager.WIFI_STA_RTT

getRssi

Added in API level 36
public int getRssi ()

Returns the RSSI (Received Signal Strength Indicator) value.

Returns
int The RSSI value as an integer.

Throws
IllegalStateException if rssi is not set.

getTimestampMillis

Added in API level 36
public long getTimestampMillis ()

Returns the timestamp of when the ranging data was collected.
Value is a non-negative timestamp measured as the number of milliseconds since 1970-01-01T00:00:00Z.

Returns
long The timestamp in milliseconds. Value is a non-negative timestamp measured as the number of milliseconds since 1970-01-01T00:00:00Z.

hasDistanceStandardDeviation

public boolean hasDistanceStandardDeviation ()

Check if the standard deviation of distance is set.

Returns
boolean True if a standard deviation value is set, false if it isn't.

hasRssi

Added in API level 36
public boolean hasRssi ()

Returns whether an RSSI measurement is included with the data.

Returns
boolean The RSSI value as an integer.

writeToParcel

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

Flatten this object in to a Parcel.

Parameters
dest Parcel: 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