import typing

import android.app
import android.os
import java
import java.chaquopy
import java.io
import java.lang
import java.nio
import java.util

class UsbAccessory(android.os.Parcelable):
    CREATOR: typing.ClassVar[android.os.Parcelable.Creator[UsbAccessory]] = ...
    def describeContents(self) -> int: ...
    def equals(self, obj: java.lang.Object | int | bool | float | str, /) -> bool: ...
    def getDescription(self) -> str | None: ...
    def getManufacturer(self) -> str: ...
    def getModel(self) -> str: ...
    def getSerial(self) -> str | None: ...
    def getUri(self) -> str | None: ...
    def getVersion(self) -> str | None: ...
    def hashCode(self) -> int: ...
    def toString(self) -> str: ...
    def writeToParcel(self, parcel: android.os.Parcel, flags: int | java.jint | java.lang.Integer, /) -> None: ...

class UsbConfiguration(android.os.Parcelable):
    CREATOR: typing.ClassVar[android.os.Parcelable.Creator[UsbConfiguration]] = ...
    def describeContents(self) -> int: ...
    def getId(self) -> int: ...
    def getInterface(self, index: int | java.jint | java.lang.Integer, /) -> UsbInterface: ...
    def getInterfaceCount(self) -> int: ...
    def getMaxPower(self) -> int: ...
    def getName(self) -> str | None: ...
    def isRemoteWakeup(self) -> bool: ...
    def isSelfPowered(self) -> bool: ...
    def toString(self) -> str: ...
    def writeToParcel(self, parcel: android.os.Parcel, flags: int | java.jint | java.lang.Integer, /) -> None: ...

class UsbConstants(java.lang.Object):
    USB_CLASS_APP_SPEC: typing.ClassVar[int] = ...
    USB_CLASS_AUDIO: typing.ClassVar[int] = ...
    USB_CLASS_CDC_DATA: typing.ClassVar[int] = ...
    USB_CLASS_COMM: typing.ClassVar[int] = ...
    USB_CLASS_CONTENT_SEC: typing.ClassVar[int] = ...
    USB_CLASS_CSCID: typing.ClassVar[int] = ...
    USB_CLASS_HID: typing.ClassVar[int] = ...
    USB_CLASS_HUB: typing.ClassVar[int] = ...
    USB_CLASS_MASS_STORAGE: typing.ClassVar[int] = ...
    USB_CLASS_MISC: typing.ClassVar[int] = ...
    USB_CLASS_PER_INTERFACE: typing.ClassVar[int] = ...
    USB_CLASS_PHYSICA: typing.ClassVar[int] = ...
    USB_CLASS_PRINTER: typing.ClassVar[int] = ...
    USB_CLASS_STILL_IMAGE: typing.ClassVar[int] = ...
    USB_CLASS_VENDOR_SPEC: typing.ClassVar[int] = ...
    USB_CLASS_VIDEO: typing.ClassVar[int] = ...
    USB_CLASS_WIRELESS_CONTROLLER: typing.ClassVar[int] = ...
    USB_DIR_IN: typing.ClassVar[int] = ...
    USB_DIR_OUT: typing.ClassVar[int] = ...
    USB_ENDPOINT_DIR_MASK: typing.ClassVar[int] = ...
    USB_ENDPOINT_NUMBER_MASK: typing.ClassVar[int] = ...
    USB_ENDPOINT_XFERTYPE_MASK: typing.ClassVar[int] = ...
    USB_ENDPOINT_XFER_BULK: typing.ClassVar[int] = ...
    USB_ENDPOINT_XFER_CONTROL: typing.ClassVar[int] = ...
    USB_ENDPOINT_XFER_INT: typing.ClassVar[int] = ...
    USB_ENDPOINT_XFER_ISOC: typing.ClassVar[int] = ...
    USB_INTERFACE_SUBCLASS_BOOT: typing.ClassVar[int] = ...
    USB_SUBCLASS_VENDOR_SPEC: typing.ClassVar[int] = ...
    USB_TYPE_CLASS: typing.ClassVar[int] = ...
    USB_TYPE_MASK: typing.ClassVar[int] = ...
    USB_TYPE_RESERVED: typing.ClassVar[int] = ...
    USB_TYPE_STANDARD: typing.ClassVar[int] = ...
    USB_TYPE_VENDOR: typing.ClassVar[int] = ...
    def __init__(self) -> None: ...

class UsbDevice(android.os.Parcelable):
    CREATOR: typing.ClassVar[android.os.Parcelable.Creator[UsbDevice]] = ...
    def describeContents(self) -> int: ...
    def equals(self, o: java.lang.Object | int | bool | float | str, /) -> bool: ...
    def getConfiguration(self, index: int | java.jint | java.lang.Integer, /) -> UsbConfiguration: ...
    def getConfigurationCount(self) -> int: ...
    def getDeviceClass(self) -> int: ...
    @typing.overload
    def getDeviceId(self) -> int: ...
    @typing.overload
    @staticmethod
    def getDeviceId(name: str | java.lang.String, /) -> int: ...
    @typing.overload
    def getDeviceName(self) -> str: ...
    @typing.overload
    @staticmethod
    def getDeviceName(id: int | java.jint | java.lang.Integer, /) -> str: ...
    def getDeviceProtocol(self) -> int: ...
    def getDeviceSubclass(self) -> int: ...
    def getInterface(self, index: int | java.jint | java.lang.Integer, /) -> UsbInterface: ...
    def getInterfaceCount(self) -> int: ...
    def getManufacturerName(self) -> str | None: ...
    def getProductId(self) -> int: ...
    def getProductName(self) -> str | None: ...
    def getSerialNumber(self) -> str | None: ...
    def getVendorId(self) -> int: ...
    def getVersion(self) -> str: ...
    def hashCode(self) -> int: ...
    def toString(self) -> str: ...
    def writeToParcel(self, parcel: android.os.Parcel, flags: int | java.jint | java.lang.Integer, /) -> None: ...

class UsbDeviceConnection(java.lang.Object):
    @typing.overload
    def bulkTransfer(self, endpoint: UsbEndpoint, buffer: java.chaquopy.JavaArrayJByte, length: int | java.jint | java.lang.Integer, timeout: int | java.jint | java.lang.Integer, /) -> int: ...
    @typing.overload
    def bulkTransfer(self, endpoint: UsbEndpoint, buffer: java.chaquopy.JavaArrayJByte, offset: int | java.jint | java.lang.Integer, length: int | java.jint | java.lang.Integer, timeout: int | java.jint | java.lang.Integer, /) -> int: ...
    def claimInterface(self, intf: UsbInterface, force: bool | java.jboolean | java.lang.Boolean, /) -> bool: ...
    def close(self) -> None: ...
    @typing.overload
    def controlTransfer(self, requestType: int | java.jint | java.lang.Integer, request: int | java.jint | java.lang.Integer, value: int | java.jint | java.lang.Integer, index: int | java.jint | java.lang.Integer, buffer: java.chaquopy.JavaArrayJByte, length: int | java.jint | java.lang.Integer, timeout: int | java.jint | java.lang.Integer, /) -> int: ...
    @typing.overload
    def controlTransfer(self, requestType: int | java.jint | java.lang.Integer, request: int | java.jint | java.lang.Integer, value: int | java.jint | java.lang.Integer, index: int | java.jint | java.lang.Integer, buffer: java.chaquopy.JavaArrayJByte, offset: int | java.jint | java.lang.Integer, length: int | java.jint | java.lang.Integer, timeout: int | java.jint | java.lang.Integer, /) -> int: ...
    def finalize(self) -> None: ...
    def getFileDescriptor(self) -> int: ...
    def getRawDescriptors(self) -> java.chaquopy.JavaArrayJByte: ...
    def getSerial(self) -> str: ...
    def releaseInterface(self, intf: UsbInterface, /) -> bool: ...
    @typing.overload
    def requestWait(self) -> UsbRequest | None: ...
    @typing.overload
    def requestWait(self, timeout: int | java.jlong | java.lang.Long, /) -> UsbRequest | None: ...
    def setConfiguration(self, configuration: UsbConfiguration, /) -> bool: ...
    def setInterface(self, intf: UsbInterface, /) -> bool: ...

class UsbEndpoint(android.os.Parcelable):
    CREATOR: typing.ClassVar[android.os.Parcelable.Creator[UsbEndpoint]] = ...
    def describeContents(self) -> int: ...
    def getAddress(self) -> int: ...
    def getAttributes(self) -> int: ...
    def getDirection(self) -> int: ...
    def getEndpointNumber(self) -> int: ...
    def getInterval(self) -> int: ...
    def getMaxPacketSize(self) -> int: ...
    def getType(self) -> int: ...
    def toString(self) -> str: ...
    def writeToParcel(self, parcel: android.os.Parcel, flags: int | java.jint | java.lang.Integer, /) -> None: ...

class UsbInterface(android.os.Parcelable):
    CREATOR: typing.ClassVar[android.os.Parcelable.Creator[UsbInterface]] = ...
    def describeContents(self) -> int: ...
    def getAlternateSetting(self) -> int: ...
    def getEndpoint(self, index: int | java.jint | java.lang.Integer, /) -> UsbEndpoint: ...
    def getEndpointCount(self) -> int: ...
    def getId(self) -> int: ...
    def getInterfaceClass(self) -> int: ...
    def getInterfaceProtocol(self) -> int: ...
    def getInterfaceSubclass(self) -> int: ...
    def getName(self) -> str | None: ...
    def toString(self) -> str: ...
    def writeToParcel(self, parcel: android.os.Parcel, flags: int | java.jint | java.lang.Integer, /) -> None: ...

class UsbManager(java.lang.Object):
    ACTION_USB_ACCESSORY_ATTACHED: typing.ClassVar[str] = ...
    ACTION_USB_ACCESSORY_DETACHED: typing.ClassVar[str] = ...
    ACTION_USB_DEVICE_ATTACHED: typing.ClassVar[str] = ...
    ACTION_USB_DEVICE_DETACHED: typing.ClassVar[str] = ...
    EXTRA_ACCESSORY: typing.ClassVar[str] = ...
    EXTRA_DEVICE: typing.ClassVar[str] = ...
    EXTRA_PERMISSION_GRANTED: typing.ClassVar[str] = ...
    def getAccessoryList(self) -> java.chaquopy.JavaArray[UsbAccessory] | None: ...
    def getDeviceList(self) -> java.util.HashMap[java.lang.String, UsbDevice]: ...
    @typing.overload
    def hasPermission(self, accessory: UsbAccessory, /) -> bool: ...
    @typing.overload
    def hasPermission(self, device: UsbDevice, /) -> bool: ...
    def openAccessory(self, accessory: UsbAccessory, /) -> android.os.ParcelFileDescriptor | None: ...
    def openAccessoryInputStream(self, accessory: UsbAccessory, /) -> java.io.InputStream: ...
    def openAccessoryOutputStream(self, accessory: UsbAccessory, /) -> java.io.OutputStream: ...
    def openDevice(self, device: UsbDevice, /) -> UsbDeviceConnection: ...
    @typing.overload
    def requestPermission(self, accessory: UsbAccessory, pi: android.app.PendingIntent, /) -> None: ...
    @typing.overload
    def requestPermission(self, device: UsbDevice, pi: android.app.PendingIntent, /) -> None: ...

class UsbRequest(java.lang.Object):
    def __init__(self) -> None: ...
    def cancel(self) -> bool: ...
    def close(self) -> None: ...
    def finalize(self) -> None: ...
    def getClientData(self) -> java.lang.Object: ...
    def getEndpoint(self) -> UsbEndpoint: ...
    def initialize(self, connection: UsbDeviceConnection, endpoint: UsbEndpoint, /) -> bool: ...
    @typing.overload
    def queue(self, buffer: java.nio.ByteBuffer, /) -> bool: ...
    @typing.overload
    def queue(self, buffer: java.nio.ByteBuffer, length: int | java.jint | java.lang.Integer, /) -> bool: ...
    def setClientData(self, data: java.lang.Object | int | bool | float | str, /) -> None: ...
