WifiP2pManager.ExternalApproverRequestListener
public
static
interface
WifiP2pManager.ExternalApproverRequestListener
android.net.wifi.p2p.WifiP2pManager.ExternalApproverRequestListener |
Interface for callback invocation when an incoming request is received.
This callback is registered by
WifiP2pManager.addExternalApprover(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.MacAddress, android.net.wifi.p2p.WifiP2pManager.ExternalApproverRequestListener)
.
Summary
Constants | |
---|---|
int |
APPROVER_DETACH_REASON_CLOSE
Detached since the |
int |
APPROVER_DETACH_REASON_FAILURE
Detached due to a framework failure. |
int |
APPROVER_DETACH_REASON_REMOVE
Detached by a call to
|
int |
APPROVER_DETACH_REASON_REPLACE
Detached when a new approver replaces an old one. |
int |
REQUEST_TYPE_INVITATION
This device received an invitation request from GO to join the group. |
int |
REQUEST_TYPE_JOIN
This GO device received a request from a peer to join the group. |
int |
REQUEST_TYPE_NEGOTIATION
This device received a negotiation request from another peer. |
Constants
APPROVER_DETACH_REASON_CLOSE
public static final int APPROVER_DETACH_REASON_CLOSE
Detached since the WifiP2pManager
channel was closed, e.g.
by using Channel#close()
method.
Used in onDetached(android.net.MacAddress, int)
.
Constant Value: 3 (0x00000003)
APPROVER_DETACH_REASON_FAILURE
public static final int APPROVER_DETACH_REASON_FAILURE
Detached due to a framework failure.
Used in onDetached(android.net.MacAddress, int)
.
Constant Value: 1 (0x00000001)
APPROVER_DETACH_REASON_REMOVE
public static final int APPROVER_DETACH_REASON_REMOVE
Detached by a call to
WifiP2pManager.removeExternalApprover(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.MacAddress, android.net.wifi.p2p.WifiP2pManager.ActionListener)
.
Used in onDetached(android.net.MacAddress, int)
.
Constant Value: 0 (0x00000000)
APPROVER_DETACH_REASON_REPLACE
public static final int APPROVER_DETACH_REASON_REPLACE
Detached when a new approver replaces an old one.
Used in onDetached(android.net.MacAddress, int)
.
Constant Value: 2 (0x00000002)
REQUEST_TYPE_INVITATION
public static final int REQUEST_TYPE_INVITATION
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)
.
Constant Value: 1 (0x00000001)
REQUEST_TYPE_JOIN
public static final int REQUEST_TYPE_JOIN
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)
.
Constant Value: 2 (0x00000002)
REQUEST_TYPE_NEGOTIATION
public static final int REQUEST_TYPE_NEGOTIATION
This device received a negotiation request from another peer.
Used in onConnectionRequested(int, android.net.wifi.p2p.WifiP2pConfig, android.net.wifi.p2p.WifiP2pDevice)
.
Constant Value: 0 (0x00000000)
Public methods
onAttached
public abstract void onAttached (MacAddress deviceAddress)
Called when an approver registration via
WifiP2pManager.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
public abstract void onConnectionRequested (int requestType, WifiP2pConfig config, WifiP2pDevice device)
Called when there is an incoming connection request
which matches a peer (identified by its MacAddress
) registered by the external
approver through
WifiP2pManager.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
WifiP2pManager.setConnectionRequestResult(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.MacAddress, int, android.net.wifi.p2p.WifiP2pManager.ActionListener)
with
WifiP2pManager.CONNECTION_REQUEST_ACCEPT
, WifiP2pManager.CONNECTION_REQUEST_REJECT
, or
WifiP2pManager.CONNECTION_REQUEST_DEFER_TO_SERVICE
.
Parameters | |
---|---|
requestType |
int : is one of REQUEST_TYPE_NEGOTIATION ,
REQUEST_TYPE_INVITATION , and REQUEST_TYPE_JOIN .
Value is REQUEST_TYPE_NEGOTIATION , REQUEST_TYPE_INVITATION , or 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
public abstract void onDetached (MacAddress deviceAddress, int reason)
Called when an approver registration via
WifiP2pManager.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 APPROVER_DETACH_REASON_REMOVE , APPROVER_DETACH_REASON_FAILURE , APPROVER_DETACH_REASON_REPLACE , or APPROVER_DETACH_REASON_CLOSE |
onPinGenerated
public abstract void onPinGenerated (MacAddress deviceAddress, String pin)
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
WifiP2pManager.setConnectionRequestResult(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.MacAddress, int, android.net.wifi.p2p.WifiP2pManager.ActionListener)
with WifiP2pManager.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 . |