FileDocCategorySizeDatePackage
WifiP2pWfdInfo.javaAPI DocAndroid 5.1 API5932Thu Mar 12 22:22:44 GMT 2015android.net.wifi.p2p

WifiP2pWfdInfo

public class WifiP2pWfdInfo extends Object implements android.os.Parcelable
A class representing Wifi Display information for a device
hide

Fields Summary
private static final String
TAG
private boolean
mWfdEnabled
private int
mDeviceInfo
public static final int
WFD_SOURCE
public static final int
PRIMARY_SINK
public static final int
SECONDARY_SINK
public static final int
SOURCE_OR_PRIMARY_SINK
private static final int
DEVICE_TYPE
One of {@link #WFD_SOURCE}, {@link #PRIMARY_SINK}, {@link #SECONDARY_SINK} or {@link #SOURCE_OR_PRIMARY_SINK}
private static final int
COUPLED_SINK_SUPPORT_AT_SOURCE
private static final int
COUPLED_SINK_SUPPORT_AT_SINK
private static final int
SESSION_AVAILABLE
private static final int
SESSION_AVAILABLE_BIT1
private static final int
SESSION_AVAILABLE_BIT2
private int
mCtrlPort
private int
mMaxThroughput
public static final Creator
CREATOR
Implement the Parcelable interface
Constructors Summary
public WifiP2pWfdInfo()


      
    
public WifiP2pWfdInfo(int devInfo, int ctrlPort, int maxTput)

        mWfdEnabled = true;
        mDeviceInfo = devInfo;
        mCtrlPort = ctrlPort;
        mMaxThroughput = maxTput;
    
public WifiP2pWfdInfo(WifiP2pWfdInfo source)
copy constructor

        if (source != null) {
            mWfdEnabled = source.mWfdEnabled;
            mDeviceInfo = source.mDeviceInfo;
            mCtrlPort = source.mCtrlPort;
            mMaxThroughput = source.mMaxThroughput;
        }
    
Methods Summary
public intdescribeContents()
Implement the Parcelable interface

        return 0;
    
public intgetControlPort()

        return mCtrlPort;
    
public java.lang.StringgetDeviceInfoHex()

        return String.format(
                Locale.US, "%04x%04x%04x%04x", 6, mDeviceInfo, mCtrlPort, mMaxThroughput);
    
public intgetDeviceType()

        return (mDeviceInfo & DEVICE_TYPE);
    
public intgetMaxThroughput()

        return mMaxThroughput;
    
public booleanisCoupledSinkSupportedAtSink()

        return (mDeviceInfo & COUPLED_SINK_SUPPORT_AT_SINK) != 0;
    
public booleanisCoupledSinkSupportedAtSource()

        return (mDeviceInfo & COUPLED_SINK_SUPPORT_AT_SINK) != 0;
    
public booleanisSessionAvailable()

        return (mDeviceInfo & SESSION_AVAILABLE) != 0;
    
public booleanisWfdEnabled()

        return mWfdEnabled;
    
public voidreadFromParcel(android.os.Parcel in)

        mWfdEnabled = (in.readInt() == 1);
        mDeviceInfo = in.readInt();
        mCtrlPort = in.readInt();
        mMaxThroughput = in.readInt();
    
public voidsetControlPort(int port)

        mCtrlPort = port;
    
public voidsetCoupledSinkSupportAtSink(boolean enabled)

        if (enabled ) {
            mDeviceInfo |= COUPLED_SINK_SUPPORT_AT_SINK;
        } else {
            mDeviceInfo &= ~COUPLED_SINK_SUPPORT_AT_SINK;
        }
    
public voidsetCoupledSinkSupportAtSource(boolean enabled)

        if (enabled ) {
            mDeviceInfo |= COUPLED_SINK_SUPPORT_AT_SINK;
        } else {
            mDeviceInfo &= ~COUPLED_SINK_SUPPORT_AT_SINK;
        }
    
public booleansetDeviceType(int deviceType)

        if (deviceType >= WFD_SOURCE && deviceType <= SOURCE_OR_PRIMARY_SINK) {
            mDeviceInfo |= deviceType;
            return true;
        }
        return false;
    
public voidsetMaxThroughput(int maxThroughput)

        mMaxThroughput = maxThroughput;
    
public voidsetSessionAvailable(boolean enabled)

        if (enabled) {
            mDeviceInfo |= SESSION_AVAILABLE_BIT1;
            mDeviceInfo &= ~SESSION_AVAILABLE_BIT2;
        } else {
            mDeviceInfo &= ~SESSION_AVAILABLE;
        }
    
public voidsetWfdEnabled(boolean enabled)

        mWfdEnabled = enabled;
    
public java.lang.StringtoString()

        StringBuffer sbuf = new StringBuffer();
        sbuf.append("WFD enabled: ").append(mWfdEnabled);
        sbuf.append("WFD DeviceInfo: ").append(mDeviceInfo);
        sbuf.append("\n WFD CtrlPort: ").append(mCtrlPort);
        sbuf.append("\n WFD MaxThroughput: ").append(mMaxThroughput);
        return sbuf.toString();
    
public voidwriteToParcel(android.os.Parcel dest, int flags)
Implement the Parcelable interface

        dest.writeInt(mWfdEnabled ? 1 : 0);
        dest.writeInt(mDeviceInfo);
        dest.writeInt(mCtrlPort);
        dest.writeInt(mMaxThroughput);