Server IP : 209.38.156.173 / Your IP : 216.73.216.122 [ Web Server : Apache/2.4.52 (Ubuntu) System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.1.2-1ubuntu2.22 Disable Function : NONE Domains : 2 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /lib/python3/dist-packages/serial/threaded/__pycache__/ |
Upload File : |
o ��^g$ � @ sF d Z ddlmZ ddlZddlZG dd� de�ZG dd� de�ZG dd � d e�ZG d d� de�Z G dd � d ej �Zedkr�ddl Z ddlZddlZdZG dd� de �Zejeddd�Zeee��Ze�d� e�d� W d � n1 suw Y ejeddd�Zeee�Ze�� e�� \ZZe�d� e�d� e�� dS dS )z%Support threading with serial ports. � )�absolute_importNc @ 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 � dS )z$Called when reader thread is startedN� ��self� transportr r �:/usr/lib/python3/dist-packages/serial/threaded/__init__.py�connection_made � zProtocol.connection_madec C r )z2Called with snippets received from the serial portNr �r �datar r r � data_received r 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__1 s zPacketizer.__init__c C � || _ dS �zStore transportN�r r r r r r 5 � zPacketizer.connection_madec s d| _ tt| ��|� dS )�Forget transportN)r �superr r r �� __class__r r r 9 s zPacketizer.connection_lostc C sL | j �|� | j| j v r$| j �| jd�\}| _ | �|� | j| j v sdS dS )z9Buffer received data, find TERMINATOR, call handle_packet� N)r �extend� TERMINATOR�split� handle_packet)r r �packetr r r r >