관리-도구
편집 파일: serialcli.cpython-39.opt-1.pyc
a ����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����4/usr/lib/python3.9/site-packages/serial/serialcli.py� <listcomp>��������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�du�rtd��|�jr td��ztjj�|�j�|�_W�n<�t yr�}�z$d|�_td|�j|f���W�Y�d}~n d}~0�0�|�j du�r�d|�_ |�jdu�r�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��|�jdu�r*tjjjj|�j�_nt |�jd��|�j�_|�j du�rXtjjjj|�j�_nt |�j d��|�j�_z|�j|�j�_ W�n0�ty��}�ztt|���W�Y�d}~n d}~0�0�|�jtkr�d|�j�_nJ|�jtkr�d|�j�_n6|�jtkr�d|�j�_n"|�jtkr�d|�j�_ntd|�j���|�jtk�r*ttjjjd �|�j�_n�|�jtk�rHtjjjj|�j�_nh|�jtk�rftjjjj|�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�r tjjj%j*|�j�_%ntd|�j#���|�j+�r:|�j,�r:tjjj-j.|�j�_-nH|�j+�rTtjjj-j/|�j�_-n.|�j,�rntjjj-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����_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#����er���r���r���r���;���s\���� " zSerial._reconfigure_portc�����������������C���sD���|�j�r@|�jr:z|�j����W�n�tjjjy2���Y�n0�d|�_d|�_�dS�)z Close portNF)r���r���ZCloser���r���r���ZInvalidOperationException�r#���r���r���r����close����s����zSerial.closec�����������������C���s���|�j�s t�|�jjS�)z>Return the number of characters currently in the input buffer.)r����portNotOpenErrorr���ZBytesToReadr2���r���r���r���� in_waiting����s����zSerial.in_waiting����c�����������������C���sT���|�j�s t�t��}|rLz|�|�j�����W�n�tjy@���Y�qLY�q0�|d8�}qt|�S�)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. r6���) r���r4���� bytearray�appendr���ZReadByter����TimeoutException�bytes)r#����size�datar���r���r����read����s���� zSerial.readc�����������������C���sH���|�j�s t�z|�j�t|�dt|���W�n�tjy>���t�Y�n0�t|�S�)z-Output the given string over the serial port.r���) r���r4���r���ZWriter����lenr���r9���ZwriteTimeoutError)r#���r<���r���r���r����write����s���� zSerial.writec�����������������C���s���|�j�s t�|�j����dS�)z9Clear input buffer, discarding all that is in the buffer.N)r���r4���r���ZDiscardInBufferr2���r���r���r���r"�������s����zSerial.reset_input_bufferc�����������������C���s���|�j�s t�|�j����dS�)zs Clear output buffer, aborting the current output and discarding all that is in the buffer. N)r���r4���r���ZDiscardOutBufferr2���r���r���r����reset_output_buffer����s����zSerial.reset_output_bufferc�����������������C���s���|�j�s t�t|�j�|�j_dS�)zT Set break: Controls TXD. When active, to transmitting is possible. N)r���r4����boolZ_break_stater���Z BreakStater2���r���r���r����_update_break_state����s����zSerial._update_break_statec�����������������C���s���|�j�s t�t|�j�|�j_dS�)z)Set terminal status line: Request To SendN)r���r4���rA���r���r���Z RtsEnabler2���r���r���r���r!�������s����zSerial._update_rts_statec�����������������C���s���|�j�s t�t|�j�|�j_dS�)z-Set terminal status line: Data Terminal ReadyN)r���r4���rA���r���r���Z DtrEnabler2���r���r���r���r�������s����zSerial._update_dtr_statec�����������������C���s���|�j�s t�|�jjS�)z(Read terminal status line: Clear To Send)r���r4���r���Z CtsHoldingr2���r���r���r����cts����s����z Serial.ctsc�����������������C���s���|�j�s t�|�jjS�)z)Read terminal status line: Data Set Ready)r���r4���r���Z DsrHoldingr2���r���r���r����dsr����s����z Serial.dsrc�����������������C���s���|�j�s t�dS�)z)Read terminal status line: Ring IndicatorF)r���r4���r2���r���r���r����ri����s����z Serial.ric�����������������C���s���|�j�s t�|�jjS�)z)Read terminal status line: Carrier Detect)r���r4���r���Z CDHoldingr2���r���r���r����cd����s����z Serial.cdN)r6���)�__name__� __module__�__qualname__�__doc__Z BAUDRATESr%���r���r3����propertyr5���r=���r?���r"���r@���rB���r!���r���rC���rD���rE���rF���r���r���r���r���r ������s,���H r ���) r���ZSystem.IO.PortsZserial.serialutilZArrayZByter ���r���Z SerialBaser ���r���r���r���r����<module> ���s ���