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

import enum
import datetime
import sys
import types
import typing

import winsdk._winrt as _winrt
import winsdk.windows.devices.spi.provider
import winsdk.windows.foundation
import winsdk.windows.foundation.collections

class SpiMode(enum.IntEnum):
    MODE0 = 0
    MODE1 = 1
    MODE2 = 2
    MODE3 = 3

class SpiSharingMode(enum.IntEnum):
    EXCLUSIVE = 0
    SHARED = 1

Self = typing.TypeVar('Self')

class SpiBusInfo(_winrt.Object):
    chip_select_line_count: _winrt.Int32
    max_clock_frequency: _winrt.Int32
    min_clock_frequency: _winrt.Int32
    supported_data_bit_lengths: typing.Optional[winsdk.windows.foundation.collections.IVectorView[_winrt.Int32]]
    @staticmethod
    def _from(obj: _winrt.Object) -> SpiBusInfo: ...

class SpiConnectionSettings(_winrt.Object):
    sharing_mode: SpiSharingMode
    mode: SpiMode
    data_bit_length: _winrt.Int32
    clock_frequency: _winrt.Int32
    chip_select_line: _winrt.Int32
    @staticmethod
    def _from(obj: _winrt.Object) -> SpiConnectionSettings: ...
    def __new__(cls: typing.Type[SpiConnectionSettings], chip_select_line: _winrt.Int32) -> SpiConnectionSettings:...

class SpiController(_winrt.Object):
    @staticmethod
    def _from(obj: _winrt.Object) -> SpiController: ...
    @staticmethod
    def get_controllers_async(provider: typing.Optional[winsdk.windows.devices.spi.provider.ISpiProvider]) -> winsdk.windows.foundation.IAsyncOperation[winsdk.windows.foundation.collections.IVectorView[SpiController]]: ...
    @staticmethod
    def get_default_async() -> winsdk.windows.foundation.IAsyncOperation[SpiController]: ...
    def get_device(self, settings: typing.Optional[SpiConnectionSettings]) -> typing.Optional[SpiDevice]: ...

class SpiDevice(_winrt.Object):
    connection_settings: typing.Optional[SpiConnectionSettings]
    device_id: str
    def __enter__(self: Self) -> Self: ...
    def __exit__(self, *args) -> None: ...
    @staticmethod
    def _from(obj: _winrt.Object) -> SpiDevice: ...
    def close(self) -> None: ...
    @staticmethod
    def from_id_async(bus_id: str, settings: typing.Optional[SpiConnectionSettings]) -> winsdk.windows.foundation.IAsyncOperation[SpiDevice]: ...
    @staticmethod
    def get_bus_info(bus_id: str) -> typing.Optional[SpiBusInfo]: ...
    @typing.overload
    @staticmethod
    def get_device_selector() -> str: ...
    @typing.overload
    @staticmethod
    def get_device_selector(friendly_name: str) -> str: ...
    def read(self, buffer_size: _winrt.UInt32) -> typing.List[_winrt.UInt8]: ...
    def transfer_full_duplex(self, write_buffer: typing.Sequence[_winrt.UInt8], read_buffer_size: _winrt.UInt32) -> typing.List[_winrt.UInt8]: ...
    def transfer_sequential(self, write_buffer: typing.Sequence[_winrt.UInt8], read_buffer_size: _winrt.UInt32) -> typing.List[_winrt.UInt8]: ...
    def write(self, buffer: typing.Sequence[_winrt.UInt8]) -> None: ...

class ISpiDeviceStatics(_winrt.Object):
    @staticmethod
    def _from(obj: _winrt.Object) -> ISpiDeviceStatics: ...
    def from_id_async(self, bus_id: str, settings: typing.Optional[SpiConnectionSettings]) -> winsdk.windows.foundation.IAsyncOperation[SpiDevice]: ...
    def get_bus_info(self, bus_id: str) -> typing.Optional[SpiBusInfo]: ...
    @typing.overload
    def get_device_selector(self) -> str: ...
    @typing.overload
    def get_device_selector(self, friendly_name: str) -> str: ...

