%PDF- %PDF-
Direktori : /snap/core20/2379/lib/python3/dist-packages/serial/__pycache__/ |
Current File : //snap/core20/2379/lib/python3/dist-packages/serial/__pycache__/serialcli.cpython-38.pyc |
U z�YW�# � @ s@ d dl Z d dlZ d dlT e je j Zdd� ZG dd� de�ZdS )� N)�*c C s t dd� | D ��S )Nc S s g | ]}t |��qS � )�ord)�.0�xr r �2/usr/lib/python3/dist-packages/serial/serialcli.py� <listcomp> s z!as_byte_array.<locals>.<listcomp>)�sab)�stringr r r � as_byte_array s r c @ s� e Zd ZdZdZdd� Zdd� Zdd� Zed d � �Z d#dd �Z dd� Zdd� Zdd� Z dd� Zdd� Zdd� Zedd� �Zedd� �Zedd� �Zed d!� �Zd"S )$�Serialz)Serial port implementation for .NET/Mono.)�2 �K �n � � �� i, iX i� i i` i� i�% i K i � i � i � c C s� | j dkrtd��| jr td��ztjj�| j�| _W n: t k rp } zd| _td| j|f ��W 5 d}~X Y nX | j dkr�d| _ | jdkr�d| _| �� | j� � d| _| js�| �� | js�| �� | �� dS )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 %s: %sT)Z_port�SerialException�is_open�System�IO�Ports� SerialPortZportstr�_port_handle� Exception� _rts_state� _dtr_state�_reconfigure_portZOpenZ_dsrdtr�_update_dtr_state�_rtscts�_update_rts_state�reset_input_buffer)�self�msgr r r �open s* $ zSerial.openc C s� | j std��| jdkr*tjjjj| j _nt | jd �| j _| j dkrXtjjjj| j _nt | j d �| j _z| j| j _ W n. tk r� } ztt|���W 5 d}~X Y nX | jtkr�d| j _nJ| jtkr�d| j _n6| jtkr�d| j _n"| jtkr�d| j _ntd| j ��| jtk�r(ttjjjd �| j _n�| jtk�rFtjjjj| j _nh| jtk�rdtjjjj| j _nJ| jtk�r�tjjjj | j _n,| jt!k�r�tjjjj"| j _ntd | j ��| j#t$k�r�tjjj%j&| j _%nJ| j#t'k�r�tjjj%j(| j _%n,| j#t)k�rtjjj%j*| j _%ntd| j# ��| j+�r8| j,�r8tjjj-j.| j _-nH| j+�rRtjjj-j/| j _-n.| j,�rltjjj-j0| j _-nttjjj-d �| j _-dS )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)1r r Z_timeoutr r r r ZInfiniteTimeoutZReadTimeout�intZ_write_timeoutZWriteTimeoutZ _baudrateZBaudRate�IOError� ValueError�strZ _bytesizeZFIVEBITSZDataBitsZSIXBITSZ SEVENBITSZ EIGHTBITSZ_parityZPARITY_NONE�getattrZParityZPARITY_EVENZEvenZ PARITY_ODDZOddZPARITY_MARKZMarkZPARITY_SPACEZSpaceZ _stopbitsZSTOPBITS_ONEZStopBitsZOneZSTOPBITS_ONE_POINT_FIVEZOnePointFiveZSTOPBITS_TWOZTwor Z_xonxoffZ HandshakeZRequestToSendXOnXOffZ RequestToSendZXOnXOff)r"