Methods Summary |
---|
public int | describeContents()
return 0;
|
public boolean | equals(java.lang.Object o)
if (o instanceof UsbDevice) {
return ((UsbDevice)o).mName.equals(mName);
} else if (o instanceof String) {
return ((String)o).equals(mName);
} else {
return false;
}
|
public UsbConfiguration | getConfiguration(int index)Returns the {@link UsbConfiguration} at the given index.
return (UsbConfiguration)mConfigurations[index];
|
public int | getConfigurationCount()Returns the number of {@link UsbConfiguration}s this device contains.
return mConfigurations.length;
|
public int | getDeviceClass()Returns the devices's class field.
Some useful constants for USB device classes can be found in {@link UsbConstants}.
return mClass;
|
public static int | getDeviceId(java.lang.String name)
return native_get_device_id(name);
|
public int | getDeviceId()Returns a unique integer ID for the device.
This is a convenience for clients that want to use an integer to represent
the device, rather than the device name.
IDs are not persistent across USB disconnects.
return getDeviceId(mName);
|
public java.lang.String | getDeviceName()Returns the name of the device.
In the standard implementation, this is the path of the device file
for the device in the usbfs file system.
return mName;
|
public static java.lang.String | getDeviceName(int id)
return native_get_device_name(id);
|
public int | getDeviceProtocol()Returns the device's protocol field.
return mProtocol;
|
public int | getDeviceSubclass()Returns the device's subclass field.
return mSubclass;
|
public UsbInterface | getInterface(int index)Returns the {@link UsbInterface} at the given index.
For devices with multiple configurations, you will probably want to use
{@link UsbConfiguration#getInterface} instead.
return getInterfaceList()[index];
|
public int | getInterfaceCount()Returns the number of {@link UsbInterface}s this device contains.
For devices with multiple configurations, you will probably want to use
{@link UsbConfiguration#getInterfaceCount} instead.
return getInterfaceList().length;
|
private UsbInterface[] | getInterfaceList()
if (mInterfaces == null) {
int configurationCount = mConfigurations.length;
int interfaceCount = 0;
for (int i = 0; i < configurationCount; i++) {
UsbConfiguration configuration = (UsbConfiguration)mConfigurations[i];
interfaceCount += configuration.getInterfaceCount();
}
mInterfaces = new UsbInterface[interfaceCount];
int offset = 0;
for (int i = 0; i < configurationCount; i++) {
UsbConfiguration configuration = (UsbConfiguration)mConfigurations[i];
interfaceCount = configuration.getInterfaceCount();
for (int j = 0; j < interfaceCount; j++) {
mInterfaces[offset++] = configuration.getInterface(j);
}
}
}
return mInterfaces;
|
public java.lang.String | getManufacturerName()Returns the manufacturer name of the device.
return mManufacturerName;
|
public int | getProductId()Returns a product ID for the device.
return mProductId;
|
public java.lang.String | getProductName()Returns the product name of the device.
return mProductName;
|
public java.lang.String | getSerialNumber()Returns the serial number of the device.
return mSerialNumber;
|
public int | getVendorId()Returns a vendor ID for the device.
return mVendorId;
|
public int | hashCode()
return mName.hashCode();
|
private static native int | native_get_device_id(java.lang.String name)
|
private static native java.lang.String | native_get_device_name(int id)
|
public void | setConfigurations(android.os.Parcelable[] configuration)Only used by UsbService implementation
mConfigurations = configuration;
|
public java.lang.String | toString()
StringBuilder builder = new StringBuilder("UsbDevice[mName=" + mName +
",mVendorId=" + mVendorId + ",mProductId=" + mProductId +
",mClass=" + mClass + ",mSubclass=" + mSubclass + ",mProtocol=" + mProtocol +
",mManufacturerName=" + mManufacturerName + ",mProductName=" + mProductName +
",mSerialNumber=" + mSerialNumber + ",mConfigurations=[");
for (int i = 0; i < mConfigurations.length; i++) {
builder.append("\n");
builder.append(mConfigurations[i].toString());
}
builder.append("]");
return builder.toString();
|
public void | writeToParcel(android.os.Parcel parcel, int flags)
parcel.writeString(mName);
parcel.writeInt(mVendorId);
parcel.writeInt(mProductId);
parcel.writeInt(mClass);
parcel.writeInt(mSubclass);
parcel.writeInt(mProtocol);
parcel.writeString(mManufacturerName);
parcel.writeString(mProductName);
parcel.writeString(mSerialNumber);
parcel.writeParcelableArray(mConfigurations, 0);
|