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

import enum
import datetime
import sys
import types
import typing

import winsdk.system
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(winsdk.system.Object):
    chip_select_line_count: winsdk.system.Int32
    max_clock_frequency: winsdk.system.Int32
    min_clock_frequency: winsdk.system.Int32
    supported_data_bit_lengths: typing.Optional[winsdk.windows.foundation.collections.IVectorView[winsdk.system.Int32]]
    @staticmethod
    def _from(obj: winsdk.system.Object) -> SpiBusInfo: ...

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

class SpiController(winsdk.system.Object):
    @staticmethod
    def _from(obj: winsdk.system.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(winsdk.system.Object):
    connection_settings: typing.Optional[SpiConnectionSettings]
    device_id: str
    def __enter__(self: Self) -> Self: ...
    def __exit__(self, *args) -> None: ...
    @staticmethod
    def _from(obj: winsdk.system.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: winsdk.system.Array[winsdk.system.UInt8]) -> None: ...
    def transfer_full_duplex(self, write_buffer: winsdk.system.Array[winsdk.system.UInt8], read_buffer: winsdk.system.Array[winsdk.system.UInt8]) -> None: ...
    def transfer_sequential(self, write_buffer: winsdk.system.Array[winsdk.system.UInt8], read_buffer: winsdk.system.Array[winsdk.system.UInt8]) -> None: ...
    def write(self, buffer: winsdk.system.Array[winsdk.system.UInt8]) -> None: ...

class ISpiDeviceStatics(winsdk.system.Object):
    @staticmethod
    def _from(obj: winsdk.system.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: ...

