Sequenceablepublic final class WifiP2pConfig extends Object implements Sequenceable
With the Wi-Fi P2P configuration,
you can use WifiP2pController#createGroup(WifiP2pConfig, WifiP2pCallback) to create a P2P group
and use WifiP2pController#connect(WifiP2pConfig, WifiP2pCallback) to initiate a connection to a device.
The Wi-Fi P2P configuration contains the device address, passphrase, and band of the P2P group owner.
Sequenceable.Producer<T>| 限定符和类型 | 字段 | 说明 |
|---|---|---|
static int |
GO_BAND_2G |
Indicates that the group owner can use the 2.4 GHz band.
|
static int |
GO_BAND_5G |
Indicates that the group owner can use the 5 GHz band.
|
static int |
GO_BAND_AUTO |
Indicates that the group owner can use any of all the supported bands.
|
| 构造器 | 说明 |
|---|---|
WifiP2pConfig(String groupName,
String passphrase) |
A constructor used to create a
WifiP2pConfig instance with the specified group name and passphrase. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
String |
getDeviceAddress() |
Obtains the device address of this
WifiP2pConfig instance. |
String |
getGroupName() |
Obtains the group name of this
WifiP2pConfig instance. |
int |
getGroupOwnerBand() |
Obtains the band value for the group owner of this
WifiP2pConfig instance. |
String |
getPassphrase() |
Obtains the passphrase of this
WifiP2pConfig instance. |
boolean |
marshalling(Parcel out) |
Writes a
Sequenceable object into a Parcel. |
void |
setDeviceAddress(String deviceAddress) |
Sets the device address of this
WifiP2pConfig instance. |
void |
setGroupName(String groupName) |
Sets the group name of this
WifiP2pConfig instance. |
void |
setGroupOwnerBand(int groupOwnerBand) |
Sets the band value for the group owner of this
WifiP2pConfig instance. |
void |
setPassphrase(String passphrase) |
Sets the passphrase of this
WifiP2pConfig instance. |
boolean |
unmarshalling(Parcel in) |
Restores a
Sequenceable object from a Parcel. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waithasFileDescriptorpublic static final int GO_BAND_2G
public static final int GO_BAND_5G
public static final int GO_BAND_AUTO
public WifiP2pConfig(String groupName, String passphrase)
WifiP2pConfig instance with the specified group name and passphrase.groupName - Indicates the group name used to create the WifiP2pConfig instance.passphrase - Indicates the passphrase used to create the WifiP2pConfig instance.public String getDeviceAddress()
WifiP2pConfig instance.
The device address is in the XX:XX:XX:XX:XX:XX format by default.
WifiP2pConfig instance;
returns 02:00:00:00:00:00 if the device address is not specified.public void setDeviceAddress(String deviceAddress)
WifiP2pConfig instance.deviceAddress - Indicates the device address to set.public String getGroupName()
WifiP2pConfig instance.WifiP2pConfig instance.public void setGroupName(String groupName)
WifiP2pConfig instance.groupName - Indicates the group name to set.public String getPassphrase()
WifiP2pConfig instance.WifiP2pConfig instance.public void setPassphrase(String passphrase)
WifiP2pConfig instance.passphrase - Indicates the passphrase to set.public int getGroupOwnerBand()
WifiP2pConfig instance.
The band value determines which bands can be used. GO_BAND_AUTO
indicates that all supported bands can be used,
GO_BAND_2G indicates that the 2.4 GHz band can be used,
and GO_BAND_5G indicates that the 5 GHz band can be used.
WifiP2pConfig instance.public void setGroupOwnerBand(int groupOwnerBand)
WifiP2pConfig instance.groupOwnerBand - Indicates the band value to set.
The value can be GO_BAND_AUTO, GO_BAND_2G, or GO_BAND_5G.public boolean marshalling(Parcel out)
Sequenceable object into a Parcel.marshalling 在接口中 Sequenceableout - Indicates the Parcel object to which the Sequenceable
object will be written.true if the marshalling is successful; returns false otherwise.public boolean unmarshalling(Parcel in)
Sequenceable object from a Parcel.unmarshalling 在接口中 Sequenceablein - Indicates the Parcel object into which the Sequenceable
object has been written.true if the unmarshalling is successful; returns false otherwise.