| Server IP : 138.197.176.125 / Your IP : 216.73.217.54 Web Server : Apache/2.4.41 (Ubuntu) System : Linux SuiteCRM-8 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.3.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /lib/python3/dist-packages/serial/urlhandler/__pycache__/ |
Upload File : |
U
=Y27 � @ s d dl Z d dlZd dlZd dlZd dlZzd dlZW n ek
rT d dlmZ Y nX d dl m
Z
mZmZm
Z
mZmZ ejejejejd�ZdZG dd� de
�Zedk�r
d dlZed�Zej�d �e�� ej�d
� e�d� e�� ej�d�e�d��� e�� dS )
� N)�
SerialBase�SerialException�to_bytes�portNotOpenError�writeTimeoutError�Timeout)�debug�infoZwarning�error� c @ s� e Zd ZdZdZdd� Zdd� Zdd� Zd d
� Ze dd� �Z
d*dd�Zdd� Zdd� Z
dd� Zd+dd�Zdd� Zdd� Zdd� Ze dd � �Ze d!d"� �Ze d#d$� �Ze d%d&� �Zd'd(� Zd)S ),�Serialz-Serial port implementation for plain sockets.)�2 �K �n � � �� i, iX i� i i` i� i�% i K i � i � i � c
C s� d| _ | jdkrtd��| jr&td��ztj| �| j�td�| _ W n: t
k
r| } zd| _ td�| j|���W 5 d}~X Y nX | j �d� | �
� 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.)�timeoutzCould not open port {}: {}FT)�loggerZ_portr �is_open�socketZcreate_connection�from_urlZportstr�POLL_TIMEOUT�_socket� Exception�formatZsetblocking�_reconfigure_portZ_dsrdtr�_update_dtr_stateZ_rtscts�_update_rts_state�reset_input_buffer�reset_output_buffer)�self�msg� r# �C/usr/lib/python3/dist-packages/serial/urlhandler/protocol_socket.py�open1 s&