�
��^_�# � �x � d dl mZ d dlZd dlZd dl� ej
ej Zd� Z G d� de � Z
y)� )�absolute_importN)�*c �P � t | D �cg c]
}t |� �� c}� S c c}w )N)�sab�ord)�string�xs �2/usr/lib/python3/dist-packages/serial/serialcli.py�
as_byte_arrayr s � ���'�1��A��'�(�(��'s �#c � � e Zd ZdZdZd� Zd� Zd� Zed� � Z dd�Z
d� Zd � Zd
� Z
d� Zd� Zd
� Zed� � Zed� � Zed� � Zed� � Zy)�Serialz)Serial port implementation for .NET/Mono.)�2 �K �n � � �� i, iX i� i i` i� i�% i K i � i � i � c �v � | j �t d� �| j rt d� � t j j
j
| j � | _ | j �d| _
| j �d| _ | j � | j j � d| _ | j s| j � | j s| j# � | j% � y# t $ r'}d| _ t d| j �d|��� �d}~ww xY w)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.open s� � �
�:�:��!�"R�S�S��<�<�!�"9�:�:� V� &� � ��� :� :�4�<�<� H�D�� �?�?�"�"�D�O��?�?�"�"�D�O���� ������ �����|�|��"�"�$��|�|��"�"�$����!��# � V� $�D��!�$�,�,�PS�"T�U�U�� V�s �8D � D8�"D3�3D8c � � | j st d� �| j �>t j j
j j | j _ n't | j dz � | j _ | j �>t j j
j j | j _ n't | j dz � | j _ | j | j _
| j" |