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