FileDocCategorySizeDatePackage
UsbConfiguration.javaAPI DocAndroid 5.1 API5663Thu Mar 12 22:22:10 GMT 2015android.hardware.usb

UsbConfiguration

public class UsbConfiguration extends Object implements android.os.Parcelable
A class representing a configuration on a {@link UsbDevice}. A USB configuration can have one or more interfaces, each one providing a different piece of functionality, separate from the other interfaces. An interface will have one or more {@link UsbEndpoint}s, which are the channels by which the host transfers data with the device.

Developer Guides

For more information about communicating with USB hardware, read the USB developer guide.

Fields Summary
private final int
mId
private final String
mName
private final int
mAttributes
private final int
mMaxPower
private android.os.Parcelable[]
mInterfaces
private static final int
ATTR_SELF_POWERED
Mask for "self-powered" bit in the configuration's attributes.
private static final int
ATTR_REMOTE_WAKEUP
Mask for "remote wakeup" bit in the configuration's attributes.
public static final Parcelable.Creator
CREATOR
Constructors Summary
public UsbConfiguration(int id, String name, int attributes, int maxPower)
UsbConfiguration should only be instantiated by UsbService implementation

hide


                  
             
        mId = id;
        mName = name;
        mAttributes = attributes;
        mMaxPower = maxPower;
    
Methods Summary
public intdescribeContents()


       
        return 0;
    
public intgetId()
Returns the configuration's ID field. This is an integer that uniquely identifies the configuration on the device.

return
the configuration's ID

        return mId;
    
public UsbInterfacegetInterface(int index)
Returns the {@link UsbInterface} at the given index.

return
the interface

        return (UsbInterface)mInterfaces[index];
    
public intgetInterfaceCount()
Returns the number of {@link UsbInterface}s this configuration contains.

return
the number of endpoints

        return mInterfaces.length;
    
public intgetMaxPower()
Returns the configuration's max power consumption, in milliamps.

return
the configuration's max power

        return mMaxPower * 2;
    
public java.lang.StringgetName()
Returns the configuration's name.

return
the configuration's name

        return mName;
    
public booleanisRemoteWakeup()
Returns the remote-wakeup attribute value configuration's attributes field. This attributes that the device may signal the host to wake from suspend.

return
the configuration's remote-wakeup attribute

        return (mAttributes & ATTR_REMOTE_WAKEUP) != 0;
    
public booleanisSelfPowered()
Returns the self-powered attribute value configuration's attributes field. This attribute indicates that the device has a power source other than the USB connection.

return
the configuration's self-powered attribute

        return (mAttributes & ATTR_SELF_POWERED) != 0;
    
public voidsetInterfaces(android.os.Parcelable[] interfaces)
Only used by UsbService implementation

hide

        mInterfaces = interfaces;
    
public java.lang.StringtoString()

        StringBuilder builder = new StringBuilder("UsbConfiguration[mId=" + mId +
                ",mName=" + mName + ",mAttributes=" + mAttributes +
                ",mMaxPower=" + mMaxPower + ",mInterfaces=[");
        for (int i = 0; i < mInterfaces.length; i++) {
            builder.append("\n");
            builder.append(mInterfaces[i].toString());
        }
        builder.append("]");
        return builder.toString();
    
public voidwriteToParcel(android.os.Parcel parcel, int flags)

        parcel.writeInt(mId);
        parcel.writeString(mName);
        parcel.writeInt(mAttributes);
        parcel.writeInt(mMaxPower);
        parcel.writeParcelableArray(mInterfaces, 0);