FileDocCategorySizeDatePackage
WifiDisplay.javaAPI DocAndroid 5.1 API5893Thu Mar 12 22:22:10 GMT 2015android.hardware.display

WifiDisplay

public final class WifiDisplay extends Object implements android.os.Parcelable
Describes the properties of a Wifi display.

This object is immutable.

hide

Fields Summary
private final String
mDeviceAddress
private final String
mDeviceName
private final String
mDeviceAlias
private final boolean
mIsAvailable
private final boolean
mCanConnect
private final boolean
mIsRemembered
public static final WifiDisplay[]
EMPTY_ARRAY
public static final Creator
CREATOR
Constructors Summary
public WifiDisplay(String deviceAddress, String deviceName, String deviceAlias, boolean available, boolean canConnect, boolean remembered)


          
                  
        if (deviceAddress == null) {
            throw new IllegalArgumentException("deviceAddress must not be null");
        }
        if (deviceName == null) {
            throw new IllegalArgumentException("deviceName must not be null");
        }

        mDeviceAddress = deviceAddress;
        mDeviceName = deviceName;
        mDeviceAlias = deviceAlias;
        mIsAvailable = available;
        mCanConnect = canConnect;
        mIsRemembered = remembered;
    
Methods Summary
public booleancanConnect()
Returns true if device can be connected to (not in use), false otherwise.

        return mCanConnect;
    
public intdescribeContents()

        return 0;
    
public booleanequals(android.hardware.display.WifiDisplay other)
Returns true if the two displays have the same identity (address, name and alias). This method does not compare the current status of the displays.

        return other != null
                && mDeviceAddress.equals(other.mDeviceAddress)
                && mDeviceName.equals(other.mDeviceName)
                && Objects.equal(mDeviceAlias, other.mDeviceAlias);
    
public booleanequals(java.lang.Object o)

        return o instanceof WifiDisplay && equals((WifiDisplay)o);
    
public java.lang.StringgetDeviceAddress()
Gets the MAC address of the Wifi display device.

        return mDeviceAddress;
    
public java.lang.StringgetDeviceAlias()
Gets the user-specified alias of the Wifi display device, or null if none.

The alias should be used in the UI whenever available. It is the value provided by the user when renaming the device.

        return mDeviceAlias;
    
public java.lang.StringgetDeviceName()
Gets the name of the Wifi display device.

        return mDeviceName;
    
public java.lang.StringgetFriendlyDisplayName()
Gets the name to show in the UI. Uses the device alias if available, otherwise uses the device name.

        return mDeviceAlias != null ? mDeviceAlias : mDeviceName;
    
public booleanhasSameAddress(android.hardware.display.WifiDisplay other)
Returns true if the other display is not null and has the same address as this one. Can be used to perform identity comparisons on displays ignoring properties that might change during a connection such as the name or alias.

        return other != null && mDeviceAddress.equals(other.mDeviceAddress);
    
public inthashCode()

        // The address on its own should be sufficiently unique for hashing purposes.
        return mDeviceAddress.hashCode();
    
public booleanisAvailable()
Returns true if device is available, false otherwise.

        return mIsAvailable;
    
public booleanisRemembered()
Returns true if device has been remembered, false otherwise.

        return mIsRemembered;
    
public java.lang.StringtoString()

        String result = mDeviceName + " (" + mDeviceAddress + ")";
        if (mDeviceAlias != null) {
            result += ", alias " + mDeviceAlias;
        }
        result += ", isAvailable " + mIsAvailable + ", canConnect " + mCanConnect
                + ", isRemembered " + mIsRemembered;
        return result;
    
public voidwriteToParcel(android.os.Parcel dest, int flags)

        dest.writeString(mDeviceAddress);
        dest.writeString(mDeviceName);
        dest.writeString(mDeviceAlias);
        dest.writeInt(mIsAvailable ? 1 : 0);
        dest.writeInt(mCanConnect ? 1 : 0);
        dest.writeInt(mIsRemembered ? 1 : 0);