RangingResultCallback

public abstract class RangingResultCallback
extends Object

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


Base class for ranging result callbacks. Should be extended by applications and set when calling WifiRttManager#startRanging(RangingRequest, java.util.concurrent.Executor, RangingResultCallback). If the ranging operation fails in whole (not attempted) then onRangingFailure(int) will be called with a failure code. If the ranging operation is performed for each of the requested peers then the onRangingResults(java.util.List) will be called with the set of results (@link RangingResult, each of which has its own success/failure code RangingResult#getStatus().

Summary

Constants

int STATUS_CODE_FAIL

A failure code for the whole ranging request operation.

int STATUS_CODE_FAIL_RTT_NOT_AVAILABLE

A failure code for the whole ranging request operation.

Public constructors

RangingResultCallback()

Public methods

abstract void onRangingFailure(int code)

Called when a ranging operation failed in whole - i.e.

abstract void onRangingResults(List<RangingResult> results)

Called when a ranging operation was executed.

Inherited methods

Constants

STATUS_CODE_FAIL

Added in API level 28
public static final int STATUS_CODE_FAIL

A failure code for the whole ranging request operation. Indicates a failure.

Constant Value: 1 (0x00000001)

STATUS_CODE_FAIL_RTT_NOT_AVAILABLE

Added in API level 28
public static final int STATUS_CODE_FAIL_RTT_NOT_AVAILABLE

A failure code for the whole ranging request operation. Indicates that the request failed due to RTT not being available - e.g. Wi-Fi was disabled. Use the WifiRttManager#isAvailable() and WifiRttManager#ACTION_WIFI_RTT_STATE_CHANGED to track RTT availability.

Constant Value: 2 (0x00000002)

Public constructors

RangingResultCallback

Added in API level 28
public RangingResultCallback ()

Public methods

onRangingFailure

Added in API level 28
public abstract void onRangingFailure (int code)

Called when a ranging operation failed in whole - i.e. no ranging operation to any of the devices specified in the request was attempted.

Parameters
code int: A status code indicating the type of failure. Value is STATUS_CODE_FAIL, or STATUS_CODE_FAIL_RTT_NOT_AVAILABLE

onRangingResults

Added in API level 28
public abstract void onRangingResults (List<RangingResult> results)

Called when a ranging operation was executed. The list of results corresponds to devices specified in the ranging request.

Parameters
results List: List of range measurements, one per requested device. This value cannot be null.