# WARNING: Please don't edit this file. It was generated by Python/WinRT v1.0.0-beta.2

import enum
import sys
import types
import typing
import uuid

import winsdk._winrt as _winrt

try:
    import winsdk.windows.foundation
except Exception:
    pass

try:
    import winsdk.windows.foundation.collections
except Exception:
    pass

try:
    import winsdk.windows.storage.streams
except Exception:
    pass

class UsbControlRecipient(enum.IntEnum):
    DEVICE = 0
    SPECIFIED_INTERFACE = 1
    ENDPOINT = 2
    OTHER = 3
    DEFAULT_INTERFACE = 4

class UsbControlTransferType(enum.IntEnum):
    STANDARD = 0
    CLASS = 1
    VENDOR = 2

class UsbEndpointType(enum.IntEnum):
    CONTROL = 0
    ISOCHRONOUS = 1
    BULK = 2
    INTERRUPT = 3

class UsbReadOptions(enum.IntFlag):
    NONE = 0
    AUTO_CLEAR_STALL = 0x1
    OVERRIDE_AUTOMATIC_BUFFER_MANAGEMENT = 0x2
    IGNORE_SHORT_PACKET = 0x4
    ALLOW_PARTIAL_READS = 0x8

class UsbTransferDirection(enum.IntEnum):
    OUT = 0
    IN = 1

class UsbWriteOptions(enum.IntFlag):
    NONE = 0
    AUTO_CLEAR_STALL = 0x1
    SHORT_PACKET_TERMINATE = 0x2

class UsbBulkInEndpointDescriptor(_winrt.Object):
    endpoint_number: _winrt.UInt8
    max_packet_size: _winrt.UInt32
    pipe: UsbBulkInPipe
    @staticmethod
    def _from(obj: _winrt.Object) -> UsbBulkInEndpointDescriptor: ...

class UsbBulkInPipe(_winrt.Object):
    read_options: UsbReadOptions
    endpoint_descriptor: UsbBulkInEndpointDescriptor
    input_stream: winsdk.windows.storage.streams.IInputStream
    max_transfer_size_bytes: _winrt.UInt32
    @staticmethod
    def _from(obj: _winrt.Object) -> UsbBulkInPipe: ...
    @typing.overload
    def clear_stall_async(self) -> winsdk.windows.foundation.IAsyncAction: ...
    @typing.overload
    def flush_buffer(self) -> None: ...

class UsbBulkOutEndpointDescriptor(_winrt.Object):
    endpoint_number: _winrt.UInt8
    max_packet_size: _winrt.UInt32
    pipe: UsbBulkOutPipe
    @staticmethod
    def _from(obj: _winrt.Object) -> UsbBulkOutEndpointDescriptor: ...

class UsbBulkOutPipe(_winrt.Object):
    write_options: UsbWriteOptions
    endpoint_descriptor: UsbBulkOutEndpointDescriptor
    output_stream: winsdk.windows.storage.streams.IOutputStream
    @staticmethod
    def _from(obj: _winrt.Object) -> UsbBulkOutPipe: ...
    @typing.overload
    def clear_stall_async(self) -> winsdk.windows.foundation.IAsyncAction: ...

class UsbConfiguration(_winrt.Object):
    configuration_descriptor: UsbConfigurationDescriptor
    descriptors: winsdk.windows.foundation.collections.IVectorView[UsbDescriptor]
    usb_interfaces: winsdk.windows.foundation.collections.IVectorView[UsbInterface]
    @staticmethod
    def _from(obj: _winrt.Object) -> UsbConfiguration: ...

class UsbConfigurationDescriptor(_winrt.Object):
    configuration_value: _winrt.UInt8
    max_power_milliamps: _winrt.UInt32
    remote_wakeup: _winrt.Boolean
    self_powered: _winrt.Boolean
    @staticmethod
    def _from(obj: _winrt.Object) -> UsbConfigurationDescriptor: ...
    @typing.overload
    @staticmethod
    def parse(descriptor: UsbDescriptor) -> UsbConfigurationDescriptor: ...
    @typing.overload
    @staticmethod
    def try_parse(descriptor: UsbDescriptor) -> typing.Tuple[_winrt.Boolean, UsbConfigurationDescriptor]: ...

class UsbControlRequestType(_winrt.Object):
    recipient: UsbControlRecipient
    direction: UsbTransferDirection
    control_transfer_type: UsbControlTransferType
    as_byte: _winrt.UInt8
    @staticmethod
    def _from(obj: _winrt.Object) -> UsbControlRequestType: ...
    @typing.overload
    def __init__(self) -> None: ...

class UsbDescriptor(_winrt.Object):
    descriptor_type: _winrt.UInt8
    length: _winrt.UInt8
    @staticmethod
    def _from(obj: _winrt.Object) -> UsbDescriptor: ...
    @typing.overload
    def read_descriptor_buffer(self, buffer: winsdk.windows.storage.streams.IBuffer) -> None: ...

class UsbDevice(winsdk.windows.foundation.IClosable, _winrt.Object):
    configuration: UsbConfiguration
    default_interface: UsbInterface
    device_descriptor: UsbDeviceDescriptor
    @staticmethod
    def _from(obj: _winrt.Object) -> UsbDevice: ...
    @typing.overload
    def close(self) -> None: ...
    @typing.overload
    @staticmethod
    def from_id_async(device_id: str) -> winsdk.windows.foundation.IAsyncOperation[UsbDevice]: ...
    @typing.overload
    @staticmethod
    def get_device_class_selector(usb_class: UsbDeviceClass) -> str: ...
    @typing.overload
    @staticmethod
    def get_device_selector(win_usb_interface_class: uuid.UUID) -> str: ...
    @typing.overload
    @staticmethod
    def get_device_selector(vendor_id: _winrt.UInt32, product_id: _winrt.UInt32) -> str: ...
    @typing.overload
    @staticmethod
    def get_device_selector(vendor_id: _winrt.UInt32, product_id: _winrt.UInt32, win_usb_interface_class: uuid.UUID) -> str: ...
    @typing.overload
    def send_control_in_transfer_async(self, setup_packet: UsbSetupPacket) -> winsdk.windows.foundation.IAsyncOperation[winsdk.windows.storage.streams.IBuffer]: ...
    @typing.overload
    def send_control_in_transfer_async(self, setup_packet: UsbSetupPacket, buffer: winsdk.windows.storage.streams.IBuffer) -> winsdk.windows.foundation.IAsyncOperation[winsdk.windows.storage.streams.IBuffer]: ...
    @typing.overload
    def send_control_out_transfer_async(self, setup_packet: UsbSetupPacket) -> winsdk.windows.foundation.IAsyncOperation[_winrt.UInt32]: ...
    @typing.overload
    def send_control_out_transfer_async(self, setup_packet: UsbSetupPacket, buffer: winsdk.windows.storage.streams.IBuffer) -> winsdk.windows.foundation.IAsyncOperation[_winrt.UInt32]: ...

class UsbDeviceClass(_winrt.Object):
    subclass_code: typing.Optional[_winrt.UInt8]
    protocol_code: typing.Optional[_winrt.UInt8]
    class_code: _winrt.UInt8
    @staticmethod
    def _from(obj: _winrt.Object) -> UsbDeviceClass: ...
    @typing.overload
    def __init__(self) -> None: ...

class UsbDeviceClasses(_winrt.Object):
    active_sync: UsbDeviceClass
    cdc_control: UsbDeviceClass
    device_firmware_update: UsbDeviceClass
    irda: UsbDeviceClass
    measurement: UsbDeviceClass
    palm_sync: UsbDeviceClass
    personal_healthcare: UsbDeviceClass
    physical: UsbDeviceClass
    vendor_specific: UsbDeviceClass
    @staticmethod
    def _from(obj: _winrt.Object) -> UsbDeviceClasses: ...

class UsbDeviceDescriptor(_winrt.Object):
    bcd_device_revision: _winrt.UInt32
    bcd_usb: _winrt.UInt32
    max_packet_size0: _winrt.UInt8
    number_of_configurations: _winrt.UInt8
    product_id: _winrt.UInt32
    vendor_id: _winrt.UInt32
    @staticmethod
    def _from(obj: _winrt.Object) -> UsbDeviceDescriptor: ...

class UsbEndpointDescriptor(_winrt.Object):
    as_bulk_in_endpoint_descriptor: UsbBulkInEndpointDescriptor
    as_bulk_out_endpoint_descriptor: UsbBulkOutEndpointDescriptor
    as_interrupt_in_endpoint_descriptor: UsbInterruptInEndpointDescriptor
    as_interrupt_out_endpoint_descriptor: UsbInterruptOutEndpointDescriptor
    direction: UsbTransferDirection
    endpoint_number: _winrt.UInt8
    endpoint_type: UsbEndpointType
    @staticmethod
    def _from(obj: _winrt.Object) -> UsbEndpointDescriptor: ...
    @typing.overload
    @staticmethod
    def parse(descriptor: UsbDescriptor) -> UsbEndpointDescriptor: ...
    @typing.overload
    @staticmethod
    def try_parse(descriptor: UsbDescriptor) -> typing.Tuple[_winrt.Boolean, UsbEndpointDescriptor]: ...

class UsbInterface(_winrt.Object):
    bulk_in_pipes: winsdk.windows.foundation.collections.IVectorView[UsbBulkInPipe]
    bulk_out_pipes: winsdk.windows.foundation.collections.IVectorView[UsbBulkOutPipe]
    descriptors: winsdk.windows.foundation.collections.IVectorView[UsbDescriptor]
    interface_number: _winrt.UInt8
    interface_settings: winsdk.windows.foundation.collections.IVectorView[UsbInterfaceSetting]
    interrupt_in_pipes: winsdk.windows.foundation.collections.IVectorView[UsbInterruptInPipe]
    interrupt_out_pipes: winsdk.windows.foundation.collections.IVectorView[UsbInterruptOutPipe]
    @staticmethod
    def _from(obj: _winrt.Object) -> UsbInterface: ...

class UsbInterfaceDescriptor(_winrt.Object):
    alternate_setting_number: _winrt.UInt8
    class_code: _winrt.UInt8
    interface_number: _winrt.UInt8
    protocol_code: _winrt.UInt8
    subclass_code: _winrt.UInt8
    @staticmethod
    def _from(obj: _winrt.Object) -> UsbInterfaceDescriptor: ...
    @typing.overload
    @staticmethod
    def parse(descriptor: UsbDescriptor) -> UsbInterfaceDescriptor: ...
    @typing.overload
    @staticmethod
    def try_parse(descriptor: UsbDescriptor) -> typing.Tuple[_winrt.Boolean, UsbInterfaceDescriptor]: ...

class UsbInterfaceSetting(_winrt.Object):
    bulk_in_endpoints: winsdk.windows.foundation.collections.IVectorView[UsbBulkInEndpointDescriptor]
    bulk_out_endpoints: winsdk.windows.foundation.collections.IVectorView[UsbBulkOutEndpointDescriptor]
    descriptors: winsdk.windows.foundation.collections.IVectorView[UsbDescriptor]
    interface_descriptor: UsbInterfaceDescriptor
    interrupt_in_endpoints: winsdk.windows.foundation.collections.IVectorView[UsbInterruptInEndpointDescriptor]
    interrupt_out_endpoints: winsdk.windows.foundation.collections.IVectorView[UsbInterruptOutEndpointDescriptor]
    selected: _winrt.Boolean
    @staticmethod
    def _from(obj: _winrt.Object) -> UsbInterfaceSetting: ...
    @typing.overload
    def select_setting_async(self) -> winsdk.windows.foundation.IAsyncAction: ...

class UsbInterruptInEndpointDescriptor(_winrt.Object):
    endpoint_number: _winrt.UInt8
    interval: winsdk.windows.foundation.TimeSpan
    max_packet_size: _winrt.UInt32
    pipe: UsbInterruptInPipe
    @staticmethod
    def _from(obj: _winrt.Object) -> UsbInterruptInEndpointDescriptor: ...

class UsbInterruptInEventArgs(_winrt.Object):
    interrupt_data: winsdk.windows.storage.streams.IBuffer
    @staticmethod
    def _from(obj: _winrt.Object) -> UsbInterruptInEventArgs: ...

class UsbInterruptInPipe(_winrt.Object):
    endpoint_descriptor: UsbInterruptInEndpointDescriptor
    @staticmethod
    def _from(obj: _winrt.Object) -> UsbInterruptInPipe: ...
    @typing.overload
    def clear_stall_async(self) -> winsdk.windows.foundation.IAsyncAction: ...
    @typing.overload
    def add_data_received(self, handler: winsdk.windows.foundation.TypedEventHandler[UsbInterruptInPipe, UsbInterruptInEventArgs]) -> winsdk.windows.foundation.EventRegistrationToken: ...
    @typing.overload
    def remove_data_received(self, token: winsdk.windows.foundation.EventRegistrationToken) -> None: ...

class UsbInterruptOutEndpointDescriptor(_winrt.Object):
    endpoint_number: _winrt.UInt8
    interval: winsdk.windows.foundation.TimeSpan
    max_packet_size: _winrt.UInt32
    pipe: UsbInterruptOutPipe
    @staticmethod
    def _from(obj: _winrt.Object) -> UsbInterruptOutEndpointDescriptor: ...

class UsbInterruptOutPipe(_winrt.Object):
    write_options: UsbWriteOptions
    endpoint_descriptor: UsbInterruptOutEndpointDescriptor
    output_stream: winsdk.windows.storage.streams.IOutputStream
    @staticmethod
    def _from(obj: _winrt.Object) -> UsbInterruptOutPipe: ...
    @typing.overload
    def clear_stall_async(self) -> winsdk.windows.foundation.IAsyncAction: ...

class UsbSetupPacket(_winrt.Object):
    value: _winrt.UInt32
    request_type: UsbControlRequestType
    request: _winrt.UInt8
    length: _winrt.UInt32
    index: _winrt.UInt32
    @staticmethod
    def _from(obj: _winrt.Object) -> UsbSetupPacket: ...
    @typing.overload
    def __init__(self, eight_byte_buffer: winsdk.windows.storage.streams.IBuffer) -> None: ...
    @typing.overload
    def __init__(self) -> None: ...

