
    Yf                     b    d Z ddlmZmZmZ ddlmZmZ ddlm	Z	  G d de	ej
                  ZdS )z
Serial Port Protocol
    )	EIGHTBITSPARITY_NONESTOPBITS_ONE)abstractfdesc)BaseSerialPortc                   D    e Zd ZdZdZdeeedddfdZd Z	d Z
d Zd	 Zd
S )
SerialPortz>
    A select()able serial device, acting as a transport.
       i%  r   c           
      R   t           j                            | |           |                     |||||||	|
          | _        || _        |                                  |                                  || _        | j        	                    |            | 
                                 d S )N)baudratebytesizeparitystopbitstimeoutxonxoffrtscts)r   FileDescriptor__init___serialFactory_serialreactor
flushInputflushOutputprotocolmakeConnectionstartReading)selfr   deviceNameOrPortNumberr   r   r   r   r   r   r   r   s              S/var/www/html/env/lib/python3.11/site-packages/twisted/internet/_posixserialport.pyr   zSerialPort.__init__   s     	((w777**" + 	
 	
  $$T***    c                     | j         j        S )N)r   fdr   s    r    filenozSerialPort.fileno8   s    |r!   c                 P    t          j        |                                 |          S )z7
        Write some data to the serial device.
        )r   	writeToFDr%   )r   datas     r    writeSomeDatazSerialPort.writeSomeData;   s     t{{}}d333r!   c                 d    t          j        |                                 | j        j                  S )z:
        Some data's readable from serial device.
        )r   
readFromFDr%   r   dataReceivedr$   s    r    doReadzSerialPort.doReadA   s$     t}/IJJJr!   c                     t           j                            | |           | j                                         | j                            |           dS )z
        Called when the serial port disconnects.

        Will call C{connectionLost} on the protocol that is handling the
        serial data.
        N)r   r   connectionLostr   closer   )r   reasons     r    r/   zSerialPort.connectionLostG   sM     	..tV<<<$$V,,,,,r!   N)__name__
__module____qualname____doc__	connectedr   r   r   r   r%   r)   r-   r/    r!   r    r
   r
      s          I    >  4 4 4K K K	- 	- 	- 	- 	-r!   r
   N)r5   serialr   r   r   twisted.internetr   r   twisted.internet.serialportr   r   r
   r7   r!   r    <module>r;      s   
  8 7 7 7 7 7 7 7 7 7 , , , , , , , , 6 6 6 6 6 6>- >- >- >- >-!8 >- >- >- >- >-r!   