D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
usr
/
lib
/
python3.6
/
site-packages
/
serial
/
urlhandler
/
__pycache__
/
Filename :
protocol_socket.cpython-36.pyc
back
Copy
3 M�]W�+ � @ s d dl Z d dlZd dlZd dlZd dlZyd dlZW n ek rR d dljZY nX d dl m Z mZmZm Z ejejejejd�ZdZG dd� de �Zedkr�d dlZed�Zejjd je�� ejjd � ejd� ej� ejjdjejd��� ej� dS ) � N)� SerialBase�SerialException�portNotOpenError�to_bytes)�debug�infoZwarning�error� c @ s� e Zd ZdZd:Zdd� Zdd� Zdd� Zdd� Ze dd� �Z d;dd�Zd d!� Zd"d#� Z d$d%� Zd<d'd(�Zd)d*� Zd+d,� Zd-d.� Ze d/d0� �Ze d1d2� �Ze d3d4� �Ze d5d6� �Zd7d8� Zd9S )=�Serialz-Serial port implementation for plain sockets.�2 �K �n � � �� �, �X � � �` � �% � K � � � � � � c C s� d| _ | jdkrtd��| jr&td��ytj| j| j�td�| _ W n: t k r| } zd| _ tdj| j|���W Y dd}~X nX | j� d| _| j s�| j� | js�| j� | j� | j� 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.)�timeoutzCould not open port {}: {}T)�loggerZ_portr �is_open�socketZcreate_connection�from_urlZportstr�POLL_TIMEOUT�_socket� Exception�format�_reconfigure_portZ_dsrdtr�_update_dtr_stateZ_rtscts�_update_rts_state�reset_input_buffer�reset_output_buffer)�self�msg� r, �%/usr/lib/python3.6/protocol_socket.py�open0 s$ $zSerial.openc C s( | j dkrtd��| jr$| jjd� dS )zz Set communication parameters on opened port. For the socket:// protocol all settings are ignored! NzCan only operate on open portsz!ignored port configuration change)r"