Fields Summary |
---|
public static final int | TEMPORARY_NET_IDThe temporary network id.
{@hide} |
public static final int | PERSISTENT_NET_IDThe persistent network id.
If a matching persistent profile is found, use it.
Otherwise, create a new persistent profile.
{@hide} |
private String | mNetworkNameThe network name |
private WifiP2pDevice | mOwnerGroup owner |
private boolean | mIsGroupOwnerDevice is group owner |
private List | mClientsGroup clients |
private String | mPassphraseThe passphrase used for WPA2-PSK |
private String | mInterface |
private int | mNetIdThe network id in the wpa_supplicant |
private static final Pattern | groupStartedPatternP2P group started string pattern |
public static final Creator | CREATORImplement the Parcelable interface |
Methods Summary |
---|
public void | addClient(WifiP2pDevice device)
for (WifiP2pDevice client : mClients) {
if (client.equals(device)) return;
}
mClients.add(device);
|
public void | addClient(java.lang.String address)
addClient(new WifiP2pDevice(address));
|
public boolean | contains(WifiP2pDevice device)
if (mOwner.equals(device) || mClients.contains(device)) return true;
return false;
|
public int | describeContents()Implement the Parcelable interface
return 0;
|
public java.util.Collection | getClientList()Get the list of clients currently part of the p2p group
return Collections.unmodifiableCollection(mClients);
|
public java.lang.String | getInterface()Get the interface name on which the group is created
return mInterface;
|
public int | getNetworkId()
return mNetId;
|
public java.lang.String | getNetworkName()Get the network name (SSID) of the group. Legacy Wi-Fi clients will discover
the p2p group using the network name.
return mNetworkName;
|
public WifiP2pDevice | getOwner()Get the details of the group owner as a {@link WifiP2pDevice} object
return mOwner;
|
public java.lang.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 {@link #getNetworkName()} to join the group
return mPassphrase;
|
public boolean | isClientListEmpty()
return mClients.size() == 0;
|
public boolean | isGroupOwner()Check whether this device is the group owner of the created p2p group
return mIsGroupOwner;
|
public boolean | removeClient(java.lang.String address)
return mClients.remove(new WifiP2pDevice(address));
|
public boolean | removeClient(WifiP2pDevice device)
return mClients.remove(device);
|
public void | setInterface(java.lang.String intf)
mInterface = intf;
|
public void | setIsGroupOwner(boolean isGo)
mIsGroupOwner = isGo;
|
public void | setNetworkId(int netId)
this.mNetId = netId;
|
public void | setNetworkName(java.lang.String networkName)
mNetworkName = networkName;
|
public void | setOwner(WifiP2pDevice device)
mOwner = device;
|
public void | setPassphrase(java.lang.String passphrase)
mPassphrase = passphrase;
|
public java.lang.String | toString()
StringBuffer sbuf = new StringBuffer();
sbuf.append("network: ").append(mNetworkName);
sbuf.append("\n isGO: ").append(mIsGroupOwner);
sbuf.append("\n GO: ").append(mOwner);
for (WifiP2pDevice client : mClients) {
sbuf.append("\n Client: ").append(client);
}
sbuf.append("\n interface: ").append(mInterface);
sbuf.append("\n networkId: ").append(mNetId);
return sbuf.toString();
|
public void | writeToParcel(android.os.Parcel dest, int flags)Implement the Parcelable interface
dest.writeString(mNetworkName);
dest.writeParcelable(mOwner, flags);
dest.writeByte(mIsGroupOwner ? (byte) 1: (byte) 0);
dest.writeInt(mClients.size());
for (WifiP2pDevice client : mClients) {
dest.writeParcelable(client, flags);
}
dest.writeString(mPassphrase);
dest.writeString(mInterface);
dest.writeInt(mNetId);
|