WifiP2pGroup
public class WifiP2pGroup
extends Object implements Parcelable
| java.lang.Object | |
| ↳ | android.net.wifi.p2p.WifiP2pGroup |
A class representing a Wi-Fi P2p group. A p2p group consists of a single group owner and one or more clients. In the case of a group with only two devices, one will be the group owner and the other will be a group client.
See also:
Summary
Constants | |
|---|---|
int | NETWORK_ID_PERSISTENT The persistent network id. |
int | NETWORK_ID_TEMPORARY The temporary network id. |
int | SECURITY_TYPE_UNKNOWN The definition of security type unknown. |
int | SECURITY_TYPE_WPA2_PSK The definition of security type WPA2-PSK. |
int | SECURITY_TYPE_WPA3_COMPATIBILITY The definition of security type WPA3-Compatibility Mode. |
int | SECURITY_TYPE_WPA3_SAE The definition of security type WPA3-SAE. |
Inherited constants |
|---|
Fields | |
|---|---|
public static final Creator<WifiP2pGroup> | CREATOR Implement the Parcelable interface |
Public constructors | |
|---|---|
WifiP2pGroup() | |
WifiP2pGroup(WifiP2pGroup source) copy constructor | |
Public methods | |
|---|---|
int | describeContents() Implement the Parcelable interface |
Collection<WifiP2pDevice> | getClientList() Get the list of clients currently part of the p2p group |
int | getFrequency() Get the operating frequency (in MHz) of the p2p group |
MacAddress | getGroupOwnerBssid() Returns the BSSID, if this device is the group owner of the P2P group supporting Wi-Fi Direct R2 protocol. |
String | getInterface() Get the interface name on which the group is created |
int | getNetworkId() The network ID of the P2P group in wpa_supplicant. |
String | getNetworkName() Get the network name (SSID) of the group. |
WifiP2pDevice | getOwner() Get the details of the group owner as a |
String | getPassphrase() Get the passphrase of the group. |
int | getSecurityType() Get the security type of the group. |
boolean | isGroupOwner() Check whether this device is the group owner of the created p2p group |
String | toString() Returns a string representation of the object. |
void | writeToParcel(Parcel dest, int flags) Implement the Parcelable interface |
Inherited methods | |
|---|---|
Constants
NETWORK_ID_PERSISTENT
public static final int NETWORK_ID_PERSISTENT
The persistent network id. If a matching persistent profile is found, use it. Otherwise, create a new persistent profile.
See also:
Constant Value: -2 (0xfffffffe)
NETWORK_ID_TEMPORARY
public static final int NETWORK_ID_TEMPORARY
The temporary network id.
See also:
Constant Value: -1 (0xffffffff)
SECURITY_TYPE_UNKNOWN
public static final int SECURITY_TYPE_UNKNOWN
The definition of security type unknown. It is set when framework fails to derive the security type from the authentication key management provided by wpa_supplicant.
Constant Value: -1 (0xffffffff)
SECURITY_TYPE_WPA2_PSK
public static final int SECURITY_TYPE_WPA2_PSK
The definition of security type WPA2-PSK.
Constant Value: 0 (0x00000000)
SECURITY_TYPE_WPA3_COMPATIBILITY
public static final int SECURITY_TYPE_WPA3_COMPATIBILITY
The definition of security type WPA3-Compatibility Mode.
Constant Value: 1 (0x00000001)
SECURITY_TYPE_WPA3_SAE
public static final int SECURITY_TYPE_WPA3_SAE
The definition of security type WPA3-SAE.
Constant Value: 2 (0x00000002)
Fields
CREATOR
public static final Creator<WifiP2pGroup> CREATOR
Implement the Parcelable interface
Public constructors
WifiP2pGroup
public WifiP2pGroup (WifiP2pGroup source)
copy constructor
| Parameters | |
|---|---|
source | WifiP2pGroup |
Public methods
describeContents
public int describeContents ()
Implement the Parcelable interface
| Returns | |
|---|---|
int | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or CONTENTS_FILE_DESCRIPTOR |
getClientList
public Collection<WifiP2pDevice> getClientList ()
Get the list of clients currently part of the p2p group
| Returns | |
|---|---|
Collection<WifiP2pDevice> | |
getFrequency
public int getFrequency ()
Get the operating frequency (in MHz) of the p2p group
| Returns | |
|---|---|
int | |
getGroupOwnerBssid
public MacAddress getGroupOwnerBssid ()
Returns the BSSID, if this device is the group owner of the P2P group supporting Wi-Fi Direct R2 protocol.
The interface address of a Wi-Fi Direct R2 supported device is randomized. So for every group owner session a randomized interface address will be returned.
The BSSID returned will be null, if this device is a client device or a group owner which doesn't support Wi-Fi Direct R2 protocol.
| Returns | |
|---|---|
MacAddress | the BSSID. |
getInterface
public String getInterface ()
Get the interface name on which the group is created
| Returns | |
|---|---|
String | |
getNetworkId
public int getNetworkId ()
The network ID of the P2P group in wpa_supplicant.
| Returns | |
|---|---|
int | |
getNetworkName
public String getNetworkName ()
Get the network name (SSID) of the group. Legacy Wi-Fi clients will discover the p2p group using the network name.
| Returns | |
|---|---|
String | |
getOwner
public WifiP2pDevice getOwner ()
Get the details of the group owner as a WifiP2pDevice object
| Returns | |
|---|---|
WifiP2pDevice | |
getPassphrase
public String getPassphrase ()
Get the passphrase of the group. This function will return a valid passphrase only at the group owner. Legacy Wi-Fi clients will need this passphrase alongside network name obtained from getNetworkName() to join the group
| Returns | |
|---|---|
String | |
getSecurityType
public int getSecurityType ()
Get the security type of the group.
| Returns | |
|---|---|
int | One of the SECURITY_TYPE_*. Value is SECURITY_TYPE_UNKNOWN, SECURITY_TYPE_WPA2_PSK, SECURITY_TYPE_WPA3_COMPATIBILITY, or SECURITY_TYPE_WPA3_SAE |
isGroupOwner
public boolean isGroupOwner ()
Check whether this device is the group owner of the created p2p group
| Returns | |
|---|---|
boolean | |
toString
public String toString ()
Returns a string representation of the object.
| Returns | |
|---|---|
String | a string representation of the object. |
writeToParcel
public void writeToParcel (Parcel dest, int flags)
Implement the Parcelable interface
| Parameters | |
|---|---|
dest | Parcel: The Parcel in which the object should be written. This value cannot be null. |
flags | int: Additional flags about how the object should be written. May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of Parcelable.PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |