%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/twisted/internet/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/twisted/internet/__pycache__/_win32serialport.cpython-312.pyc

�

Ϫ�f���|�dZddlZddlZddlmZmZmZddlmZddl	m
Z
ddlmZGd�dee
j�Zy)	zB
Serial port support for Windows.

Requires PySerial and pywin32.
�N)�	EIGHTBITS�PARITY_NONE�STOPBITS_ONE)�to_bytes)�abstract)�BaseSerialPortc�L�eZdZdZdZdeeeddfd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zy)
�
SerialPortz@A serial device, acting as a transport, that uses a win32 event.�i�%rc

��|j|||||d||	��|_|j�|j�||_||_g|_d|_d|_d|_	||_tj�|_tjdddd�|j_tj�|_tjdddd�|j _|jj#|jj|d�|jj#|j j|d�|j
j%|�|j'�y)N)�baudrate�bytesize�parity�stopbits�timeout�xonxoff�rtsctsrr�serialReadEvent�serialWriteEvent)�_serialFactory�_serial�
flushInput�flushOutput�reactor�protocol�outQueue�closed�closedNotifies�writeInProgress�	win32file�
OVERLAPPED�_overlappedRead�
win32event�CreateEvent�hEvent�_overlappedWrite�addEvent�makeConnection�_finishPortSetup)
�selfr�deviceNameOrPortNumberrr
rrrrrs
          �C/usr/lib/python3/dist-packages/twisted/internet/_win32serialport.py�__init__zSerialPort.__init__ sB���*�*�"��������+�	
���	
����������� ��
���
������� ��� ��
�(�3�3�5���&0�&<�&<�T�1�a��&N����#� )� 4� 4� 6���'1�'=�'=�d�A�q�$�'O����$������d�2�2�9�9�4�AR�S������d�3�3�:�:�D�BT�U��
�
�$�$�T�*�����c���|j�\}}tj|jjtj
d�|j�\}|_y)zn
        Finish setting up the serial port.

        This is a separate method to facilitate testing.
        rN)�_clearCommErrorr �ReadFiler�_port_handle�AllocateReadBufferr"�read_buf)r*�flags�comstat�rcs    r,r)zSerialPort._finishPortSetupKsQ���-�-�/���w�%�.�.��L�L�%�%��(�(��+�� � �
���D�Mr.c�T�tj|jj�S)N)r �ClearCommErrorrr2)r*s r,r0zSerialPort._clearCommErrorXs���'�'����(A�(A�B�Br.c��tj|jj|jd�}t|jd|�}|j�\}}|jr�tj|jj�tj|jjtj|j�|j�\}}tj|jj|jd�}|jj|t|d|�z�n|jj|�tj|jj�tj|jjtjd�|j�\}|_y)Nrr)r �GetOverlappedResultrr2r"rr4r0�cbInQuer#�
ResetEventr%r1r3r�dataReceived)r*�n�firstr5r6r7�bufs       r,rzSerialPort.serialReadEvent[sg���)�)��L�L�%�%�t�';�';�Q�
������r��*�+���-�-�/���w��?�?��!�!�$�"6�"6�"=�"=�>��(�(����)�)��,�,�W�_�_�=��$�$��G�B��
�-�-����)�)�4�+?�+?���A�
�M�M�&�&�u�x��B�Q��/@�'@�A�
�M�M�&�&�u�-�	���d�2�2�9�9�:�%�.�.��L�L�%�%��(�(��+�� � �
���D�Mr.c���|re|jr|jj|�yd|_tj|j
j||j�yy)Nr)rr�appendr �	WriteFilerr2r&)r*�datas  r,�writezSerialPort.write{sR����#�#��
�
�$�$�T�*�'(��$��#�#��L�L�-�-�t�T�5J�5J��r.c���	|jjd�}tj|jj
||j�y#t$r
d|_YywxYw)Nr)	r�popr rDrr2r&�
IndexErrorr)r*�dataToWrites  r,rzSerialPort.serialWriteEvent�s^��	��-�-�+�+�A�.�K�

������)�)�;��8M�8M�
��	�	�#$�D� ��	�s�A�A&�%A&c�j�|jj|jj�|jj|jj�t
jj||�|jj�|jj|�y)z�
        Called when the serial port disconnects.

        Will call C{connectionLost} on the protocol that is handling the
        serial data.
        N)r�removeEventr"r%r&r�FileDescriptor�connectionLostr�closer)r*�reasons  r,rNzSerialPort.connectionLost�sx��	
��� � ��!5�!5�!<�!<�=���� � ��!6�!6�!=�!=�>����.�.�t�V�<��������
�
�$�$�V�,r.N)�__name__�
__module__�__qualname__�__doc__�	connectedrrrr-r)r0rrFrrN�r.r,r
r
sD��J��I�������) �V
�C�
�@�	�-r.r
)rTr#r �serialrrr�serial.serialutilr�twisted.internetr�twisted.internet.serialportrrMr
rVr.r,�<module>r[s=�����8�7�&�&�7�@-���!8�!8�@-r.

Zerion Mini Shell 1.0