Methods Summary |
---|
public void | add(WifiP2pGroup group)Add the specified group to this group list.
mGroups.put(group.getNetworkId(), group);
|
public boolean | clear()Clear the group.
if (mGroups.size() == 0) return false;
isClearCalled = true;
mGroups.evictAll();
isClearCalled = false;
return true;
|
public boolean | contains(int netId)Return true if this group list contains the specified network id.
This function does NOT update LRU information.
It means the internal queue is NOT reordered.
final Collection<WifiP2pGroup> groups = mGroups.snapshot().values();
for (WifiP2pGroup grp: groups) {
if (netId == grp.getNetworkId()) {
return true;
}
}
return false;
|
public int | describeContents()Implement the Parcelable interface
return 0;
|
public java.util.Collection | getGroupList()Return the list of p2p group.
return mGroups.snapshot().values();
|
public int | getNetworkId(java.lang.String deviceAddress)Return the network id of the group owner profile with the specified p2p device
address.
If more than one persistent group of the same address is present in the list,
return the first one.
if (deviceAddress == null) return -1;
final Collection<WifiP2pGroup> groups = mGroups.snapshot().values();
for (WifiP2pGroup grp: groups) {
if (deviceAddress.equalsIgnoreCase(grp.getOwner().deviceAddress)) {
// update cache ordered.
mGroups.get(grp.getNetworkId());
return grp.getNetworkId();
}
}
return -1;
|
public int | getNetworkId(java.lang.String deviceAddress, java.lang.String ssid)Return the network id of the group with the specified p2p device address
and the ssid.
if (deviceAddress == null || ssid == null) {
return -1;
}
final Collection<WifiP2pGroup> groups = mGroups.snapshot().values();
for (WifiP2pGroup grp: groups) {
if (deviceAddress.equalsIgnoreCase(grp.getOwner().deviceAddress) &&
ssid.equals(grp.getNetworkName())) {
// update cache ordered.
mGroups.get(grp.getNetworkId());
return grp.getNetworkId();
}
}
return -1;
|
public java.lang.String | getOwnerAddr(int netId)Return the group owner address of the group with the specified network id
WifiP2pGroup grp = mGroups.get(netId);
if (grp != null) {
return grp.getOwner().deviceAddress;
}
return null;
|
public void | remove(int netId)Remove the group with the specified network id from this group list.
mGroups.remove(netId);
|
void | remove(java.lang.String deviceAddress)Remove the group with the specified device address from this group list.
remove(getNetworkId(deviceAddress));
|
public java.lang.String | toString()
StringBuffer sbuf = new StringBuffer();
final Collection<WifiP2pGroup> groups = mGroups.snapshot().values();
for (WifiP2pGroup grp: groups) {
sbuf.append(grp).append("\n");
}
return sbuf.toString();
|
public void | writeToParcel(android.os.Parcel dest, int flags)Implement the Parcelable interface
final Collection<WifiP2pGroup> groups = mGroups.snapshot().values();
dest.writeInt(groups.size());
for(WifiP2pGroup group : groups) {
dest.writeParcelable(group, flags);
}
|