%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/serial/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/serial/__pycache__/serialcli.cpython-312.pyc

�

��^_�#��x�ddlmZddlZddlZddl�ej
ejZd�ZGd�de	�Z
y)�)�absolute_importN)�*c�P�t|D�cgc]
}t|���c}�Scc}w)N)�sab�ord)�string�xs  �2/usr/lib/python3/dist-packages/serial/serialcli.py�
as_byte_arrayrs����'�1��A��'�(�(��'s�#c��eZdZdZdZd�Zd�Zd�Zed��Z	dd�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�Zed��Zed��Zed��Zed��Zy)�Serialz)Serial port implementation for .NET/Mono.)�2�K�n����i,iXi�ii`	i�i�%iKi�i�i�c�v�|j�td��|jrtd��	tjj
j
|j�|_|j�d|_
|j�d|_|j�|jj�d|_|js|j�|j s|j#�|j%�y#t$r'}d|_td|j�d|����d}~wwxYw)zx        Open port with current settings. This may throw a SerialException
        if the port cannot be opened.
        Nz.Port must be configured before it can be used.zPort is already open.zcould not open port z: T)�_port�SerialException�is_open�System�IO�Ports�
SerialPort�portstr�_port_handle�	Exception�
_rts_state�
_dtr_state�_reconfigure_port�Open�_dsrdtr�_update_dtr_state�_rtscts�_update_rts_state�reset_input_buffer)�self�msgs  r
�openzSerial.opens���
�:�:��!�"R�S�S��<�<�!�"9�:�:�	V� &�	�	��� :� :�4�<�<� H�D���?�?�"�"�D�O��?�?�"�"�D�O���� ������ �����|�|��"�"�$��|�|��"�"�$����!��#�	V� $�D��!�$�,�,�PS�"T�U�U��	V�s�8D�	D8�"D3�3D8c��|jstd��|j�>tjj
jj|j_n't|jdz�|j_|j�>tjj
jj|j_n't|jdz�|j_	|j|j_
|j"t$k(rd|j_n�|j"t(k(rd|j_nb|j"t*k(rd|j_n=|j"t,k(rd|j_ntd|j"z��|j.t0k(r?t3tjj
j4d	�|j_�n]|j.t6k(r?tjj
j4j8|j_�n|j.t:k(r>tjj
j4j<|j_n�|j.t>k(r>tjj
j4j@|j_ni|j.tBk(r>tjj
j4jD|j_ntd
|j.z��|jFtHk(r>tjj
jJjL|j_%n�|jFtNk(r>tjj
jJjP|j_%ni|jFtRk(r>tjj
jJjT|j_%ntd|jFz��|jVrJ|jXr>tjj
jZj\|j_-y|jVr>tjj
jZj^|j_-y|jXr>tjj
jZj`|j_-yt3tjj
jZd	�|j_-y#t$r}tt!|���d}~wwxYw)z,Set communication parameters on opened port.z'Can only operate on a valid port handleNi�����z#Unsupported number of data bits: %r�NonezUnsupported parity mode: %rz#Unsupported number of stop bits: %r)1rr�_timeoutrrrr�InfiniteTimeout�ReadTimeout�int�_write_timeout�WriteTimeout�	_baudrate�BaudRate�IOError�
ValueError�str�	_bytesize�FIVEBITS�DataBits�SIXBITS�	SEVENBITS�	EIGHTBITS�_parity�PARITY_NONE�getattr�Parity�PARITY_EVEN�Even�
PARITY_ODD�Odd�PARITY_MARK�Mark�PARITY_SPACE�Space�	_stopbits�STOPBITS_ONE�StopBits�One�STOPBITS_ONE_POINT_FIVE�OnePointFive�STOPBITS_TWO�Twor%�_xonxoff�	Handshake�RequestToSendXOnXOff�
RequestToSend�XOnXOff)r(�es  r
r!zSerial._reconfigure_port=s���� � �!�"K�L�L��=�=� �,2�I�I�O�O�,F�,F�,V�,V�D���)�,/��
�
��0D�,E�D���)�
���&�-3�Y�Y�_�_�-G�-G�-W�-W�D���*�-0��1D�1D�t�1K�-L�D���*�	%�)-���D���&�
�>�>�X�%�)*�D���&�
�^�^�w�
&�)*�D���&�
�^�^�y�
(�)*�D���&�
�^�^�y�
(�)*�D���&��B�T�^�^�S�T�T��<�<�;�&�'.�v�y�y���/E�/E�v�'N�D���$�
�\�\�[�
(�'-�y�y���'=�'=�'B�'B�D���$�
�\�\�Z�
'�'-�y�y���'=�'=�'A�'A�D���$�
�\�\�[�
(�'-�y�y���'=�'=�'B�'B�D���$�
�\�\�\�
)�'-�y�y���'=�'=�'C�'C�D���$��:�T�\�\�I�J�J��>�>�\�)�)/�����)A�)A�)E�)E�D���&�
�^�^�6�
6�)/�����)A�)A�)N�)N�D���&�
�^�^�|�
+�)/�����)A�)A�)E�)E�D���&��B�T�^�^�S�T�T��<�<�D�M�M�*0�)�)�/�/�*C�*C�*X�*X�D���'�
�\�\�*0�)�)�/�/�*C�*C�*Q�*Q�D���'�
�]�]�*0�)�)�/�/�*C�*C�*K�*K�D���'�*1�&�)�)�/�/�2K�2K�V�*T�D���'��Y�	%��S��V�$�$��	%�s�;V$�$	W�-W�Wc���|jr6|jr"	|jj�d|_d|_yy#tjj
j$rY�9wxYw)z
Close portNF)rr�Closerrr�InvalidOperationException�r(s r
�closezSerial.close�sa���<�<�� � ���%�%�+�+�-�%)��!� �D�L����y�y���@�@����s�A�'A.�-A.c�Z�|js
t��|jjS)z>Return the number of characters currently in the input buffer.)r�PortNotOpenErrorr�BytesToReadr_s r
�
in_waitingzSerial.in_waiting�s&���|�|�"�$�$�� � �,�,�,�c��|js
t��t�}|r2	|j|jj��|dz}|r�2t|�S#tj$r
Yt|�SwxYw)z�        Read size bytes from the serial port. If a timeout is set it may
        return less characters as requested. With no timeout it will block
        until the requested number of bytes is read.
        �)	rrb�	bytearray�appendr�ReadByter�TimeoutException�bytes)r(�size�datas   r
�readzSerial.read�s����|�|�"�$�$��{���
����D�-�-�6�6�8�9���	��
��T�{���	�*�*�
���T�{��	
�s�)A � B�?Bc���|js
t��	|jjt	|�dt|��t|�S#tj$rtd��wxYw)z-Output the given string over the serial port.rz
Write timeout)	rrbr�Writer�lenrrk�SerialTimeoutException)r(rns  r
�writezSerial.write�sh���|�|�"�$�$�	:�
���#�#�M�$�$7��C��I�F��4�y����&�&�	:�(��9�9�	:�s�/A�A1c�d�|js
t��|jj�y)z9Clear input buffer, discarding all that is in the buffer.N)rrbr�DiscardInBufferr_s r
r'zSerial.reset_input_buffer�s$���|�|�"�$�$����)�)�+rec�d�|js
t��|jj�y)zs        Clear output buffer, aborting the current output and
        discarding all that is in the buffer.
        N)rrbr�DiscardOutBufferr_s r
�reset_output_bufferzSerial.reset_output_buffer�s&��
�|�|�"�$�$����*�*�,rec�x�|js
t��t|j�|j_y)zT
        Set break: Controls TXD. When active, to transmitting is possible.
        N)rrb�bool�_break_stater�
BreakStater_s r
�_update_break_statezSerial._update_break_state�s-���|�|�"�$�$�'+�D�,=�,=�'>����$rec�x�|js
t��t|j�|j_y)z)Set terminal status line: Request To SendN)rrbr{rr�	RtsEnabler_s r
r&zSerial._update_rts_state��)���|�|�"�$�$�&*�4�?�?�&;����#rec�x�|js
t��t|j�|j_y)z-Set terminal status line: Data Terminal ReadyN)rrbr{r r�	DtrEnabler_s r
r$zSerial._update_dtr_state�r�rec�Z�|js
t��|jjS)z(Read terminal status line: Clear To Send)rrbr�
CtsHoldingr_s r
�ctsz
Serial.cts��&���|�|�"�$�$�� � �+�+�+rec�Z�|js
t��|jjS)z)Read terminal status line: Data Set Ready)rrbr�
DsrHoldingr_s r
�dsrz
Serial.dsr�r�rec�0�|js
t��y)z)Read terminal status line: Ring IndicatorF)rrbr_s r
�riz	Serial.ri�s���|�|�"�$�$�rec�Z�|js
t��|jjS)z)Read terminal status line: Carrier Detect)rrbr�	CDHoldingr_s r
�cdz	Serial.cd�s&���|�|�"�$�$�� � �*�*�*reN)rg)�__name__�
__module__�__qualname__�__doc__�	BAUDRATESr*r!r`�propertyrdrortr'ryr~r&r$r�r�r�r��rer
r
r
s���3�4�I�"�<CU�P
!��-��-��(�,�-�?�<�<��,��,��,��,������+��+rer
)�
__future__rr�System.IO.Ports�serial.serialutil�Array�Byterr�
SerialBaser
r�rer
�<module>r�s:��'�
���
�l�l�6�;�;���)�a+�Z�a+re

Zerion Mini Shell 1.0