Methods Summary |
---|
public boolean | clear()Clear the list @hide
if (mDevices.isEmpty()) return false;
mDevices.clear();
return true;
|
public int | describeContents()Implement the Parcelable interface
return 0;
|
public android.net.wifi.p2p.WifiP2pDevice | get(java.lang.String deviceAddress)Fetch a device from the list
validateDeviceAddress(deviceAddress);
return mDevices.get(deviceAddress);
|
public java.util.Collection | getDeviceList()Get the list of devices
return Collections.unmodifiableCollection(mDevices.values());
|
public boolean | isGroupOwner(java.lang.String deviceAddress)
validateDeviceAddress(deviceAddress);
WifiP2pDevice device = mDevices.get(deviceAddress);
if (device == null) {
throw new IllegalArgumentException("Device not found " + deviceAddress);
}
return device.isGroupOwner();
|
public boolean | remove(android.net.wifi.p2p.WifiP2pDevice device)
validateDevice(device);
return mDevices.remove(device.deviceAddress) != null;
|
public android.net.wifi.p2p.WifiP2pDevice | remove(java.lang.String deviceAddress)Remove a device from the list
validateDeviceAddress(deviceAddress);
return mDevices.remove(deviceAddress);
|
public boolean | remove(android.net.wifi.p2p.WifiP2pDeviceList list)Returns true if any device the list was removed @hide
boolean ret = false;
for (WifiP2pDevice d : list.mDevices.values()) {
if (remove(d)) ret = true;
}
return ret;
|
public java.lang.String | toString()
StringBuffer sbuf = new StringBuffer();
for (WifiP2pDevice device : mDevices.values()) {
sbuf.append("\n").append(device);
}
return sbuf.toString();
|
public void | update(android.net.wifi.p2p.WifiP2pDevice device)Add/update a device to the list. If the device is not found, a new device entry
is created. If the device is already found, the device details are updated
updateSupplicantDetails(device);
mDevices.get(device.deviceAddress).status = device.status;
|
public void | updateGroupCapability(java.lang.String deviceAddress, int groupCapab)
validateDeviceAddress(deviceAddress);
WifiP2pDevice d = mDevices.get(deviceAddress);
if (d != null) {
d.groupCapability = groupCapab;
}
|
public void | updateStatus(java.lang.String deviceAddress, int status)
validateDeviceAddress(deviceAddress);
WifiP2pDevice d = mDevices.get(deviceAddress);
if (d != null) {
d.status = status;
}
|
public void | updateSupplicantDetails(android.net.wifi.p2p.WifiP2pDevice device)Only updates details fetched from the supplicant @hide
validateDevice(device);
WifiP2pDevice d = mDevices.get(device.deviceAddress);
if (d != null) {
d.deviceName = device.deviceName;
d.primaryDeviceType = device.primaryDeviceType;
d.secondaryDeviceType = device.secondaryDeviceType;
d.wpsConfigMethodsSupported = device.wpsConfigMethodsSupported;
d.deviceCapability = device.deviceCapability;
d.groupCapability = device.groupCapability;
d.wfdInfo = device.wfdInfo;
return;
}
//Not found, add a new one
mDevices.put(device.deviceAddress, device);
|
private void | validateDevice(android.net.wifi.p2p.WifiP2pDevice device)
if (device == null) throw new IllegalArgumentException("Null device");
if (TextUtils.isEmpty(device.deviceAddress)) {
throw new IllegalArgumentException("Empty deviceAddress");
}
|
private void | validateDeviceAddress(java.lang.String deviceAddress)
if (TextUtils.isEmpty(deviceAddress)) {
throw new IllegalArgumentException("Empty deviceAddress");
}
|
public void | writeToParcel(android.os.Parcel dest, int flags)Implement the Parcelable interface
dest.writeInt(mDevices.size());
for(WifiP2pDevice device : mDevices.values()) {
dest.writeParcelable(device, flags);
}
|