UsbAccessoryBulkTransportpublic class UsbAccessoryBulkTransport extends com.android.accessorydisplay.common.Transport Sends or receives messages using bulk endpoints associated with a {@link UsbDevice}
that represents a USB accessory. |
Fields Summary |
---|
private static final int | TIMEOUT_MILLIS | private android.hardware.usb.UsbDeviceConnection | mConnection | private android.hardware.usb.UsbEndpoint | mBulkInEndpoint | private android.hardware.usb.UsbEndpoint | mBulkOutEndpoint |
Methods Summary |
---|
protected void | ioClose()
mConnection = null;
mBulkInEndpoint = null;
mBulkOutEndpoint = null;
| protected int | ioRead(byte[] buffer, int offset, int count)
if (mConnection == null) {
throw new IOException("Connection was closed.");
}
return mConnection.bulkTransfer(mBulkInEndpoint, buffer, offset, count, -1);
| protected void | ioWrite(byte[] buffer, int offset, int count)
if (mConnection == null) {
throw new IOException("Connection was closed.");
}
int result = mConnection.bulkTransfer(mBulkOutEndpoint,
buffer, offset, count, TIMEOUT_MILLIS);
if (result < 0) {
throw new IOException("Bulk transfer failed.");
}
|
|