# WARNING: Please don't edit this file. It was generated by Python/WinRT v2.3.0

import datetime
import sys
import types
import typing
import uuid as _uuid
from builtins import property as _property

import winrt._winrt
import winrt.system
import winrt.windows.foundation as windows_foundation
import winrt.windows.storage.streams as windows_storage_streams

from winrt.windows.devices.serialcommunication import SerialError, SerialHandshake, SerialParity, SerialPinChange, SerialStopBitCount

Self = typing.TypeVar('Self')

@typing.final
class ErrorReceivedEventArgs(winrt.system.Object):
    @staticmethod
    def _from(obj: winrt.system.Object, /) -> ErrorReceivedEventArgs: ...
    @_property
    def error(self) -> SerialError: ...

@typing.final
class PinChangedEventArgs(winrt.system.Object):
    @staticmethod
    def _from(obj: winrt.system.Object, /) -> PinChangedEventArgs: ...
    @_property
    def pin_change(self) -> SerialPinChange: ...

@typing.final
class SerialDevice_Static(type):
    def from_id_async(cls, device_id: str, /) -> windows_foundation.IAsyncOperation[SerialDevice]: ...
    @typing.overload
    def get_device_selector(cls) -> str: ...
    @typing.overload
    def get_device_selector(cls, port_name: str, /) -> str: ...
    def get_device_selector_from_usb_vid_pid(cls, vendor_id: winrt.system.UInt16, product_id: winrt.system.UInt16, /) -> str: ...

@typing.final
class SerialDevice(winrt.system.Object, metaclass=SerialDevice_Static):
    def __enter__(self: Self) -> Self: ...
    def __exit__(self, *args) -> None: ...
    @staticmethod
    def _from(obj: winrt.system.Object, /) -> SerialDevice: ...
    def close(self) -> None: ...
    def add_error_received(self, report_handler: windows_foundation.TypedEventHandler[SerialDevice, ErrorReceivedEventArgs], /) -> windows_foundation.EventRegistrationToken: ...
    def remove_error_received(self, token: windows_foundation.EventRegistrationToken, /) -> None: ...
    def add_pin_changed(self, report_handler: windows_foundation.TypedEventHandler[SerialDevice, PinChangedEventArgs], /) -> windows_foundation.EventRegistrationToken: ...
    def remove_pin_changed(self, token: windows_foundation.EventRegistrationToken, /) -> None: ...
    @_property
    def is_data_terminal_ready_enabled(self) -> bool: ...
    @is_data_terminal_ready_enabled.setter
    def is_data_terminal_ready_enabled(self, value: bool) -> None: ...
    @_property
    def data_bits(self) -> winrt.system.UInt16: ...
    @data_bits.setter
    def data_bits(self, value: winrt.system.UInt16) -> None: ...
    @_property
    def handshake(self) -> SerialHandshake: ...
    @handshake.setter
    def handshake(self, value: SerialHandshake) -> None: ...
    @_property
    def break_signal_state(self) -> bool: ...
    @break_signal_state.setter
    def break_signal_state(self, value: bool) -> None: ...
    @_property
    def baud_rate(self) -> winrt.system.UInt32: ...
    @baud_rate.setter
    def baud_rate(self, value: winrt.system.UInt32) -> None: ...
    @_property
    def write_timeout(self) -> datetime.timedelta: ...
    @write_timeout.setter
    def write_timeout(self, value: datetime.timedelta) -> None: ...
    @_property
    def stop_bits(self) -> SerialStopBitCount: ...
    @stop_bits.setter
    def stop_bits(self, value: SerialStopBitCount) -> None: ...
    @_property
    def read_timeout(self) -> datetime.timedelta: ...
    @read_timeout.setter
    def read_timeout(self, value: datetime.timedelta) -> None: ...
    @_property
    def parity(self) -> SerialParity: ...
    @parity.setter
    def parity(self, value: SerialParity) -> None: ...
    @_property
    def is_request_to_send_enabled(self) -> bool: ...
    @is_request_to_send_enabled.setter
    def is_request_to_send_enabled(self, value: bool) -> None: ...
    @_property
    def bytes_received(self) -> winrt.system.UInt32: ...
    @_property
    def carrier_detect_state(self) -> bool: ...
    @_property
    def clear_to_send_state(self) -> bool: ...
    @_property
    def data_set_ready_state(self) -> bool: ...
    @_property
    def input_stream(self) -> typing.Optional[windows_storage_streams.IInputStream]: ...
    @_property
    def output_stream(self) -> typing.Optional[windows_storage_streams.IOutputStream]: ...
    @_property
    def port_name(self) -> str: ...
    @_property
    def usb_product_id(self) -> winrt.system.UInt16: ...
    @_property
    def usb_vendor_id(self) -> winrt.system.UInt16: ...

