RangingSession.Callback
public
static
interface
RangingSession.Callback
| android.ranging.RangingSession.Callback |
Callback interface for receiving ranging session events.
Summary
Constants | |
|---|---|
int |
REASON_LOCAL_REQUEST
Indicates that the session was closed because |
int |
REASON_NO_PEERS_FOUND
Indicates that the session was closed because none of the specified peers were found. |
int |
REASON_REMOTE_REQUEST
Indicates that the session was closed at the request of a remote peer. |
int |
REASON_SYSTEM_POLICY
Indicates that the local system policy forced the session to close, such as power management policy, airplane mode etc. |
int |
REASON_UNKNOWN
Indicates that the session was closed due to an unknown reason. |
int |
REASON_UNSUPPORTED
Indicates that the session closed because the provided session parameters were not supported. |
Public methods | |
|---|---|
abstract
void
|
onClosed(int reason)
Called when the ranging session has closed. |
abstract
void
|
onOpenFailed(int reason)
Called when the ranging session failed to open. |
abstract
void
|
onOpened()
Called when the ranging session opens successfully. |
abstract
void
|
onResults(RangingDevice peer, RangingData data)
Called when ranging data has been received from a peer. |
abstract
void
|
onStarted(RangingDevice peer, int technology)
Called when ranging has started with a particular peer using a particular technology during an ongoing session. |
abstract
void
|
onStopped(RangingDevice peer, int technology)
Called when ranging has stopped with a particular peer using a particular technology during an ongoing session. |
Constants
REASON_LOCAL_REQUEST
public static final int REASON_LOCAL_REQUEST
Indicates that the session was closed because AutoCloseable.close() or
RangingSession.stop() was called.
Constant Value: 1 (0x00000001)
REASON_NO_PEERS_FOUND
public static final int REASON_NO_PEERS_FOUND
Indicates that the session was closed because none of the specified peers were found.
Constant Value: 5 (0x00000005)
REASON_REMOTE_REQUEST
public static final int REASON_REMOTE_REQUEST
Indicates that the session was closed at the request of a remote peer.
Constant Value: 2 (0x00000002)
REASON_SYSTEM_POLICY
public static final int REASON_SYSTEM_POLICY
Indicates that the local system policy forced the session to close, such as power management policy, airplane mode etc.
Constant Value: 4 (0x00000004)
REASON_UNKNOWN
public static final int REASON_UNKNOWN
Indicates that the session was closed due to an unknown reason.
Constant Value: 0 (0x00000000)
REASON_UNSUPPORTED
public static final int REASON_UNSUPPORTED
Indicates that the session closed because the provided session parameters were not supported.
Constant Value: 3 (0x00000003)
Public methods
onClosed
public abstract void onClosed (int reason)
Called when the ranging session has closed.
| Parameters | |
|---|---|
reason |
int: the reason why the session was closed, limited to values
defined by ERROR(Reason/android.ranging.RangingSession.Callback.Reason Reason).
Value is REASON_UNKNOWN, REASON_LOCAL_REQUEST, REASON_REMOTE_REQUEST, REASON_UNSUPPORTED, REASON_SYSTEM_POLICY, or REASON_NO_PEERS_FOUND |
onOpenFailed
public abstract void onOpenFailed (int reason)
Called when the ranging session failed to open.
| Parameters | |
|---|---|
reason |
int: the reason for the failure, limited to values defined by
ERROR(Reason/android.ranging.RangingSession.Callback.Reason Reason).
Value is REASON_UNKNOWN, REASON_LOCAL_REQUEST, REASON_REMOTE_REQUEST, REASON_UNSUPPORTED, REASON_SYSTEM_POLICY, or REASON_NO_PEERS_FOUND |
onOpened
public abstract void onOpened ()
Called when the ranging session opens successfully.
onResults
public abstract void onResults (RangingDevice peer, RangingData data)
Called when ranging data has been received from a peer.
| Parameters | |
|---|---|
peer |
RangingDevice: RangingDevice the peer from which ranging data was received.
This value cannot be null. |
data |
RangingData: RangingData the received.
This value cannot be null. |
onStarted
public abstract void onStarted (RangingDevice peer, int technology)
Called when ranging has started with a particular peer using a particular technology during an ongoing session.
| Parameters | |
|---|---|
peer |
RangingDevice: RangingDevice the peer with which ranging has started.
This value cannot be null. |
technology |
int: ERROR(/android.ranging.RangingManager.RangingTechnology)
the ranging technology that started.
Value is RangingManager.UWB, RangingManager.BLE_CS, RangingManager.WIFI_NAN_RTT, RangingManager.BLE_RSSI, or RangingManager.WIFI_STA_RTT |
onStopped
public abstract void onStopped (RangingDevice peer, int technology)
Called when ranging has stopped with a particular peer using a particular technology during an ongoing session.
| Parameters | |
|---|---|
peer |
RangingDevice: RangingDevice the peer with which ranging has stopped.
This value cannot be null. |
technology |
int: ERROR(/android.ranging.RangingManager.RangingTechnology)
the ranging technology that stopped.
Value is RangingManager.UWB, RangingManager.BLE_CS, RangingManager.WIFI_NAN_RTT, RangingManager.BLE_RSSI, or RangingManager.WIFI_STA_RTT |