Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7a60ea4c authored by Etan Cohen's avatar Etan Cohen
Browse files

[RTT] Expose new public API for number of measurements

The RTT distance and standard deviation are calculated based on a set
of N measurements. Of those M (M<=N) may be successful.

The quality of the provided results can be assessed by 2 measures:

1. The standard deviation of the results

The standard deviation is only valid if the number of successful
measurements is >1 otherwise a 0 is returned. A value of 0 cannot be
differentiated from a legitimate 0 standard deviation.

In one case (number of samples > 1) a standard deviation of 0 indicates
high confidence in the result. In the other case (number of samples = 0)
no confidence information can be derived.

2. The ratio of successful to total attempted measurements

Add API which provides the number of attempted measurements and number
of successful measurements used to calculate the final results.

Bug: 76445930
Test: N/A (unhide CL only, code verified earlier)
Change-Id: Ia7322b3abc28e83c29d0b0ae79db30fd99bb7fe1
parent ce7179bf
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -28587,6 +28587,8 @@ package android.net.wifi.rtt {
    method public int getDistanceMm();
    method public int getDistanceMm();
    method public int getDistanceStdDevMm();
    method public int getDistanceStdDevMm();
    method public android.net.MacAddress getMacAddress();
    method public android.net.MacAddress getMacAddress();
    method public int getNumAttemptedMeasurements();
    method public int getNumSuccessfulMeasurements();
    method public android.net.wifi.aware.PeerHandle getPeerHandle();
    method public android.net.wifi.aware.PeerHandle getPeerHandle();
    method public long getRangingTimestampMillis();
    method public long getRangingTimestampMillis();
    method public int getRssi();
    method public int getRssi();
+10 −4
Original line number Original line Diff line number Diff line
@@ -170,7 +170,9 @@ public final class RangingResult implements Parcelable {
    /**
    /**
     * @return The standard deviation of the measured distance (in mm) to the device specified by
     * @return The standard deviation of the measured distance (in mm) to the device specified by
     * {@link #getMacAddress()} or {@link #getPeerHandle()}. The standard deviation is calculated
     * {@link #getMacAddress()} or {@link #getPeerHandle()}. The standard deviation is calculated
     * over the measurements executed in a single RTT burst.
     * over the measurements executed in a single RTT burst. The number of measurements is returned
     * by {@link #getNumSuccessfulMeasurements()} - 0 successful measurements indicate that the
     * standard deviation is not valid (a valid standard deviation requires at least 2 data points).
     * <p>
     * <p>
     * Only valid if {@link #getStatus()} returns {@link #STATUS_SUCCESS}, otherwise will throw an
     * Only valid if {@link #getStatus()} returns {@link #STATUS_SUCCESS}, otherwise will throw an
     * exception.
     * exception.
@@ -199,11 +201,12 @@ public final class RangingResult implements Parcelable {


    /**
    /**
     * @return The number of attempted measurements used in the RTT exchange resulting in this set
     * @return The number of attempted measurements used in the RTT exchange resulting in this set
     * of results.
     * of results. The number of successful measurements is returned by
     * {@link #getNumSuccessfulMeasurements()} which at most, if there are no errors, will be 1 less
     * that the number of attempted measurements.
     * <p>
     * <p>
     * Only valid if {@link #getStatus()} returns {@link #STATUS_SUCCESS}, otherwise will throw an
     * Only valid if {@link #getStatus()} returns {@link #STATUS_SUCCESS}, otherwise will throw an
     * exception.
     * exception.
     * @hide
     */
     */
    public int getNumAttemptedMeasurements() {
    public int getNumAttemptedMeasurements() {
        if (mStatus != STATUS_SUCCESS) {
        if (mStatus != STATUS_SUCCESS) {
@@ -220,9 +223,12 @@ public final class RangingResult implements Parcelable {
     * returned by {@link #getDistanceStdDevMm()}, is not valid (a 0 is returned for the standard
     * returned by {@link #getDistanceStdDevMm()}, is not valid (a 0 is returned for the standard
     * deviation).
     * deviation).
     * <p>
     * <p>
     * The total number of measurement attempts is returned by
     * {@link #getNumAttemptedMeasurements()}. The number of successful measurements will be at
     * most 1 less then the number of attempted measurements.
     * <p>
     * Only valid if {@link #getStatus()} returns {@link #STATUS_SUCCESS}, otherwise will throw an
     * Only valid if {@link #getStatus()} returns {@link #STATUS_SUCCESS}, otherwise will throw an
     * exception.
     * exception.
     * @hide
     */
     */
    public int getNumSuccessfulMeasurements() {
    public int getNumSuccessfulMeasurements() {
        if (mStatus != STATUS_SUCCESS) {
        if (mStatus != STATUS_SUCCESS) {