WifiP2pGroup
open class WifiP2pGroup : Parcelable
| kotlin.Any | |
| ↳ | 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.
Summary
| Constants | |
|---|---|
| static Int |
The persistent network id. |
| static Int |
The temporary network id. |
| static Int |
The definition of security type unknown. |
| static Int |
The definition of security type WPA2-PSK. |
| static Int |
The definition of security type WPA3-Compatibility Mode. |
| static Int |
The definition of security type WPA3-SAE. |
| Inherited constants | |
|---|---|
| Public constructors | |
|---|---|
WifiP2pGroup(source: WifiP2pGroup!)copy constructor |
|
| Public methods | |
|---|---|
| open Int |
Implement the Parcelable interface |
| open MutableCollection<WifiP2pDevice!>! |
Get the list of clients currently part of the p2p group |
| open Int |
Get the operating frequency (in MHz) of the p2p group |
| open MacAddress? |
Returns the BSSID, if this device is the group owner of the P2P group supporting Wi-Fi Direct R2 protocol. |
| open String! |
Get the interface name on which the group is created |
| open Int |
The network ID of the P2P group in wpa_supplicant. |
| open String! |
Get the network name (SSID) of the group. |
| open WifiP2pDevice! |
getOwner()Get the details of the group owner as a |
| open String! |
Get the passphrase of the group. |
| open Int |
Get the security type of the group. |
| open WifiP2pConnectionInfo? |
Gets the P2P connection information for this device if it is a client in the group. |
| open Boolean |
Check whether this device is the group owner of the created p2p group |
| open String |
toString()Returns a string representation of the object. |
| open Unit |
writeToParcel(dest: Parcel, flags: Int)Implement the Parcelable interface |
| Properties | |
|---|---|
| static Parcelable.Creator<WifiP2pGroup!> |
Implement the Parcelable interface |
Constants
NETWORK_ID_PERSISTENT
static val NETWORK_ID_PERSISTENT: Int
The persistent network id. If a matching persistent profile is found, use it. Otherwise, create a new persistent profile.
Value: -2See Also
NETWORK_ID_TEMPORARY
static val NETWORK_ID_TEMPORARY: Int
The temporary network id.
Value: -1See Also
SECURITY_TYPE_UNKNOWN
static val SECURITY_TYPE_UNKNOWN: Int
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.
Value: -1SECURITY_TYPE_WPA2_PSK
static val SECURITY_TYPE_WPA2_PSK: Int
The definition of security type WPA2-PSK.
Value: 0SECURITY_TYPE_WPA3_COMPATIBILITY
static val SECURITY_TYPE_WPA3_COMPATIBILITY: Int
The definition of security type WPA3-Compatibility Mode.
Value: 1SECURITY_TYPE_WPA3_SAE
static val SECURITY_TYPE_WPA3_SAE: Int
The definition of security type WPA3-SAE.
Value: 2Public constructors
Public methods
describeContents
open fun describeContents(): Int
Implement the Parcelable interface
| Return | |
|---|---|
Int |
a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or
|
getClientList
open fun getClientList(): MutableCollection<WifiP2pDevice!>!
Get the list of clients currently part of the p2p group
getFrequency
open fun getFrequency(): Int
Get the operating frequency (in MHz) of the p2p group
getGroupOwnerBssid
open fun getGroupOwnerBssid(): MacAddress?
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.
| Return | |
|---|---|
MacAddress? |
the BSSID. |
getInterface
open fun getInterface(): String!
Get the interface name on which the group is created
getNetworkId
open fun getNetworkId(): Int
The network ID of the P2P group in wpa_supplicant.
getNetworkName
open fun getNetworkName(): String!
Get the network name (SSID) of the group. Legacy Wi-Fi clients will discover the p2p group using the network name.
getOwner
open fun getOwner(): WifiP2pDevice!
Get the details of the group owner as a WifiP2pDevice object
getPassphrase
open fun getPassphrase(): String!
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
getSecurityType
open fun getSecurityType(): Int
Get the security type of the group.
| Return | |
|---|---|
Int |
One of the SECURITY_TYPE_*. Value is one of the following: |
getWifiP2pGroupClientConnectionInfo
open fun getWifiP2pGroupClientConnectionInfo(): WifiP2pConnectionInfo?
Gets the P2P connection information for this device if it is a client in the group. If this device is the Group Owner, this will return null.
To get the most up-to-date information, an application should listen for the WifiP2pManager.WIFI_P2P_CONNECTION_CHANGED_ACTION broadcast. When this device joins a group as a client, the system updates the connection information and broadcasts the new group details in the WifiP2pManager.EXTRA_WIFI_P2P_GROUP extra.
Alternatively, an application can call WifiP2pManager.requestGroupInfo to get the latest group details.
| Return | |
|---|---|
WifiP2pConnectionInfo? |
A WifiP2pConnectionInfo object if this device is a client, or null if it is the Group Owner. |
isGroupOwner
open fun isGroupOwner(): Boolean
Check whether this device is the group owner of the created p2p group
toString
open fun toString(): String
Returns a string representation of the object.
| Return | |
|---|---|
String |
a string representation of the object. |
writeToParcel
open fun writeToParcel(
dest: Parcel,
flags: Int
): Unit
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_WRITE_RETURN_VALUE. Value is either 0 or a combination of the following:
|
Properties
CREATOR
static val CREATOR: Parcelable.Creator<WifiP2pGroup!>
Implement the Parcelable interface