PublishDiscoverySession
open class PublishDiscoverySession : DiscoverySession
| kotlin.Any | ||
| ↳ | android.net.wifi.aware.DiscoverySession | |
| ↳ | android.net.wifi.aware.PublishDiscoverySession | |
A class representing a Aware publish session. Created when WifiAwareSession.publish(PublishConfig,DiscoverySessionCallback,android.os.Handler) is called and a discovery session is created and returned in DiscoverySessionCallback.onPublishStarted(PublishDiscoverySession). See baseline functionality of all discovery sessions in DiscoverySession. This object allows updating an existing/running publish discovery session using updatePublish(PublishConfig).
Summary
| Public methods | |
|---|---|
| open Boolean |
acceptDataPathRequest(peerHandle: PeerHandle, request: AwareDataPathRequest)Accept a Wi-Fi Aware data path request to create a connection with the target peer. |
| open Boolean |
rejectDataPathRequest(peerHandle: PeerHandle)Reject a Wi-Fi Aware data path request received from peer. |
| open Unit |
updatePublish(publishConfig: PublishConfig)Re-configure the currently active publish session. |
| Inherited functions | |
|---|---|
Public methods
acceptDataPathRequest
open fun acceptDataPathRequest(
peerHandle: PeerHandle,
request: AwareDataPathRequest
): Boolean
Accept a Wi-Fi Aware data path request to create a connection with the target peer. The Aware data path request should be done in the context of a discovery session - after a DiscoverySessionCallback.onDataPathRequestReceived(PeerHandle) event is received. When the Aware data path setup succeeds, both side will receive DiscoverySessionCallback.onDataPathConnected(PeerHandle,WifiAwareNetworkInfo). Otherwise DiscoverySessionCallback.onDataPathRequestFailed(PeerHandle,int) will be called.
| Parameters | |
|---|---|
peerHandle |
PeerHandle: The peer's handle for the data path request. This value cannot be null. |
request |
AwareDataPathRequest: The data path request. This value cannot be null. |
| Return | |
|---|---|
Boolean |
true if framework accept the data path request successfully and start negotiation, false otherwise. |
rejectDataPathRequest
open fun rejectDataPathRequest(peerHandle: PeerHandle): Boolean
Reject a Wi-Fi Aware data path request received from peer. This is the response to the DiscoverySessionCallback.onDataPathRequestReceived(PeerHandle)
| Parameters | |
|---|---|
peerHandle |
PeerHandle: The peer's handle for the data path request. This value cannot be null. |
| Return | |
|---|---|
Boolean |
true if the data path is rejected successfully, false otherwise. |
updatePublish
open fun updatePublish(publishConfig: PublishConfig): Unit
Re-configure the currently active publish session. The DiscoverySessionCallback is not replaced - the same listener used at creation is still used. The results of the configuration are returned using DiscoverySessionCallback:
DiscoverySessionCallback.onSessionConfigUpdated(): configuration update succeeded.DiscoverySessionCallback.onSessionConfigFailed(): configuration update failed. The publish discovery session is still running using its previous configuration (i.e. update failure does not terminate the session).
| Parameters | |
|---|---|
publishConfig |
PublishConfig: The new discovery publish session configuration (PublishConfig). This value cannot be null. |