Server IP : 23.254.227.96 / Your IP : 216.73.216.7 Web Server : Apache/2.4.62 (Unix) OpenSSL/1.1.1k System : Linux hwsrv-1277026.hostwindsdns.com 4.18.0-477.13.1.el8_8.x86_64 #1 SMP Tue May 30 14:53:41 EDT 2023 x86_64 User : viralblo ( 1001) PHP Version : 8.1.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/lib/python3.6/site-packages/serial/threaded/__pycache__/ |
Upload File : |
3 M�]W$ � @ s$ d Z ddlZddlZG dd� de�ZG dd� de�ZG dd� de�ZG d d � d e�ZG dd� dej�Z e d k�r ddlZddlZddl Z dZG dd� de�Zejeddd�Ze ee��Zejd� ejd� W dQ R X ejeddd�Ze ee�Zej� ej� \ZZejd� ejd� ej� dS )z%Support threading with serial ports. � Nc @ s( e Zd ZdZdd� Zdd� Zdd� ZdS ) �Protocolzq Protocol as used by the ReaderThread. This base class provides empty implementations of all methods. c C s dS )z$Called when reader thread is startedN� )�self� transportr r �/usr/lib/python3.6/__init__.py�connection_made s zProtocol.connection_madec C s dS )z2Called with snippets received from the serial portNr )r �datar r r � data_received s zProtocol.data_receivedc C s t |t�r|�dS )zg Called when the serial port is closed or the reader loop terminated otherwise. N)� isinstance� Exception)r �excr r r �connection_lost s zProtocol.connection_lostN)�__name__� __module__�__qualname__�__doc__r r r r r r r r s r c sD e Zd ZdZdZdd� Zdd� Z� fdd�Zd d � Zdd� Z � Z S ) � Packetizerz� Read binary packets from serial port. Packets are expected to be terminated with a TERMINATOR byte (null byte by default). The class also keeps track of the transport. � c C s t � | _d | _d S )N)� bytearray�bufferr )r r r r �__init__/ s zPacketizer.__init__c C s || _ dS )zStore transportN)r )r r r r r r 3 s zPacketizer.connection_madec s d| _ tt| �j|� dS )zForget transportN)r �superr r )r r )� __class__r r r 7 s zPacketizer.connection_lostc C sB | j j|� x0| j| j kr<| j j| jd�\}| _ | j|� qW dS )z9Buffer received data, find TERMINATOR, call handle_packet� N)r �extend� TERMINATOR�split� handle_packet)r r �packetr r r r <