Added in API level 12

UsbInterface

open class UsbInterface : Parcelable
kotlin.Any
   ↳ android.hardware.usb.UsbInterface

A class representing an interface on a UsbDevice. USB devices 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 UsbEndpoints, which are the channels by which the host transfers data with the device.

Summary

Inherited constants
Public methods
open Int

open Int

Returns the interface's bAlternateSetting field.

open UsbEndpoint!
getEndpoint(index: Int)

Returns the android.hardware.usb.UsbEndpoint at the given index.

open Int

Returns the number of android.hardware.usb.UsbEndpoints this interface contains.

open Int

Returns the interface's bInterfaceNumber field.

open Int

Returns the interface's class field.

open Int

Returns the interface's protocol field.

open Int

Returns the interface's subclass field.

open String?

Returns the interface's name.

open String

open Unit
writeToParcel(parcel: Parcel, flags: Int)

Properties
static Parcelable.Creator<UsbInterface!>

Public methods

describeContents

Added in API level 12
open fun describeContents(): Int
Return
Int a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR

getAlternateSetting

Added in API level 21
open fun getAlternateSetting(): Int

Returns the interface's bAlternateSetting field. This is an integer that along with the ID uniquely identifies the interface on the device. UsbDeviceConnection#setInterface can be used to switch between two interfaces with the same ID but different alternate setting.

Return
Int the interface's alternate setting

getEndpoint

Added in API level 12
open fun getEndpoint(index: Int): UsbEndpoint!

Returns the android.hardware.usb.UsbEndpoint at the given index.

Return
UsbEndpoint! the endpoint

getEndpointCount

Added in API level 12
open fun getEndpointCount(): Int

Returns the number of android.hardware.usb.UsbEndpoints this interface contains.

Return
Int the number of endpoints

getId

Added in API level 12
open fun getId(): Int

Returns the interface's bInterfaceNumber field. This is an integer that along with the alternate setting uniquely identifies the interface on the device.

Return
Int the interface's ID

getInterfaceClass

Added in API level 12
open fun getInterfaceClass(): Int

Returns the interface's class field. Some useful constants for USB classes can be found in UsbConstants

Return
Int the interface's class

getInterfaceProtocol

Added in API level 12
open fun getInterfaceProtocol(): Int

Returns the interface's protocol field.

Return
Int the interface's protocol

getInterfaceSubclass

Added in API level 12
open fun getInterfaceSubclass(): Int

Returns the interface's subclass field.

Return
Int the interface's subclass

getName

Added in API level 21
open fun getName(): String?

Returns the interface's name.

Return
String? the interface's name, or null if the property could not be read

toString

Added in API level 12
open fun toString(): String
Return
String a string representation of the object.

writeToParcel

Added in API level 12
open fun writeToParcel(
    parcel: Parcel,
    flags: Int
): Unit
Parameters
dest The Parcel in which the object should be written. This value cannot be null.
flags Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES

Properties

CREATOR

Added in API level 12
static val CREATOR: Parcelable.Creator<UsbInterface!>