ExternalApproverRequestListener
interface ExternalApproverRequestListener
android.net.wifi.p2p.WifiP2pManager.ExternalApproverRequestListener |
Interface for callback invocation when an incoming request is received. This callback is registered by addExternalApprover(android.net.wifi.p2p.WifiP2pManager.Channel,android.net.MacAddress,android.net.wifi.p2p.WifiP2pManager.ExternalApproverRequestListener)
.
Summary
Constants | |
---|---|
static Int |
Detached since the |
static Int |
Detached due to a framework failure. |
static Int |
Detached by a call to |
static Int |
Detached when a new approver replaces an old one. |
static Int |
This device received an invitation request from GO to join the group. |
static Int |
This GO device received a request from a peer to join the group. |
static Int |
This device received a negotiation request from another peer. |
Constants
APPROVER_DETACH_REASON_CLOSE
static val APPROVER_DETACH_REASON_CLOSE: Int
Detached since the WifiP2pManager
channel was closed, e.g. by using Channel.close()
method. Used in onDetached(android.net.MacAddress,int)
.
Value: 3
APPROVER_DETACH_REASON_FAILURE
static val APPROVER_DETACH_REASON_FAILURE: Int
Detached due to a framework failure. Used in onDetached(android.net.MacAddress,int)
.
Value: 1
APPROVER_DETACH_REASON_REMOVE
static val APPROVER_DETACH_REASON_REMOVE: Int
Detached by a call to removeExternalApprover(android.net.wifi.p2p.WifiP2pManager.Channel,android.net.MacAddress,android.net.wifi.p2p.WifiP2pManager.ActionListener)
. Used in onDetached(android.net.MacAddress,int)
.
Value: 0
APPROVER_DETACH_REASON_REPLACE
static val APPROVER_DETACH_REASON_REPLACE: Int
Detached when a new approver replaces an old one. Used in onDetached(android.net.MacAddress,int)
.
Value: 2
REQUEST_TYPE_INVITATION
static val REQUEST_TYPE_INVITATION: Int
This device received an invitation request from GO to join the group. Used in onConnectionRequested(int,android.net.wifi.p2p.WifiP2pConfig,android.net.wifi.p2p.WifiP2pDevice)
.
Value: 1
REQUEST_TYPE_JOIN
static val REQUEST_TYPE_JOIN: Int
This GO device received a request from a peer to join the group. Used in onConnectionRequested(int,android.net.wifi.p2p.WifiP2pConfig,android.net.wifi.p2p.WifiP2pDevice)
.
Value: 2
REQUEST_TYPE_NEGOTIATION
static val REQUEST_TYPE_NEGOTIATION: Int
This device received a negotiation request from another peer. Used in onConnectionRequested(int,android.net.wifi.p2p.WifiP2pConfig,android.net.wifi.p2p.WifiP2pDevice)
.
Value: 0
Public methods
onAttached
abstract fun onAttached(deviceAddress: MacAddress): Unit
Called when an approver registration via addExternalApprover(android.net.wifi.p2p.WifiP2pManager.Channel,android.net.MacAddress,android.net.wifi.p2p.WifiP2pManager.ExternalApproverRequestListener)
is successful.
Parameters | |
---|---|
deviceAddress |
MacAddress: is the peer MAC address used in the registration. This value cannot be null . |
onConnectionRequested
abstract fun onConnectionRequested(
requestType: Int,
config: WifiP2pConfig,
device: WifiP2pDevice
): Unit
Called when there is an incoming connection request which matches a peer (identified by its MacAddress
) registered by the external approver through addExternalApprover(android.net.wifi.p2p.WifiP2pManager.Channel,android.net.MacAddress,android.net.wifi.p2p.WifiP2pManager.ExternalApproverRequestListener)
. The external approver is expected to follow up with a connection decision using the setConnectionRequestResult(android.net.wifi.p2p.WifiP2pManager.Channel,android.net.MacAddress,int,android.net.wifi.p2p.WifiP2pManager.ActionListener)
with CONNECTION_REQUEST_ACCEPT
, CONNECTION_REQUEST_REJECT
, or CONNECTION_REQUEST_DEFER_TO_SERVICE
.
Parameters | |
---|---|
requestType |
Int: is one of REQUEST_TYPE_NEGOTIATION , REQUEST_TYPE_INVITATION , and REQUEST_TYPE_JOIN . Value is android.net.wifi.p2p.WifiP2pManager.ExternalApproverRequestListener#REQUEST_TYPE_NEGOTIATION , android.net.wifi.p2p.WifiP2pManager.ExternalApproverRequestListener#REQUEST_TYPE_INVITATION , or android.net.wifi.p2p.WifiP2pManager.ExternalApproverRequestListener#REQUEST_TYPE_JOIN |
config |
WifiP2pConfig: is the peer configuration. This value cannot be null . |
device |
WifiP2pDevice: is the peer information. This value cannot be null . |
onDetached
abstract fun onDetached(
deviceAddress: MacAddress,
reason: Int
): Unit
Called when an approver registration via addExternalApprover(android.net.wifi.p2p.WifiP2pManager.Channel,android.net.MacAddress,android.net.wifi.p2p.WifiP2pManager.ExternalApproverRequestListener)
has failed.
Parameters | |
---|---|
deviceAddress |
MacAddress: is the peer MAC address used in the registration. This value cannot be null . |
reason |
Int: is the failure reason. Value is android.net.wifi.p2p.WifiP2pManager.ExternalApproverRequestListener#APPROVER_DETACH_REASON_REMOVE , android.net.wifi.p2p.WifiP2pManager.ExternalApproverRequestListener#APPROVER_DETACH_REASON_FAILURE , android.net.wifi.p2p.WifiP2pManager.ExternalApproverRequestListener#APPROVER_DETACH_REASON_REPLACE , or android.net.wifi.p2p.WifiP2pManager.ExternalApproverRequestListener#APPROVER_DETACH_REASON_CLOSE |
onPinGenerated
abstract fun onPinGenerated(
deviceAddress: MacAddress,
pin: String
): Unit
Called when a PIN is generated by the WiFi service. The external approver can display the PIN, exchange the PIN via Out-Of-Band way or ask the wifi service to show the PIN as usual using the setConnectionRequestResult(android.net.wifi.p2p.WifiP2pManager.Channel,android.net.MacAddress,int,android.net.wifi.p2p.WifiP2pManager.ActionListener)
with CONNECTION_REQUEST_DEFER_SHOW_PIN_TO_SERVICE
.
Parameters | |
---|---|
deviceAddress |
MacAddress: is the peer MAC address used in the registration. This value cannot be null . |
pin |
String: is the WPS PIN. This value cannot be null . |