�
Ϫ�f� � � � d Z g d�ZddlZddlmZmZmZmZmZmZm Z m
Z
mZ ddlm
Z
G d� d� Z e
j � rddlmZ yddlmZ y) z
Serial Port Protocol
)�serial�
PARITY_ODD�PARITY_EVEN�PARITY_NONE�STOPBITS_TWO�STOPBITS_ONE�FIVEBITS� EIGHTBITS� SEVENBITS�SIXBITS�
SerialPort� N) r r r r r r
r r r )�platformc �n � e Zd ZdZej
Zd� Zd� Zd� Z d� Z
d� Zd� Zd� Z
d � Zd
� Zdd�Zdd�Zy
)�BaseSerialPortaV
Base class for Windows and POSIX serial ports.
@ivar _serialFactory: a pyserial C{serial.Serial} factory, used to create
the instance stored in C{self._serial}. Overrideable to enable easier
testing.
@ivar _serial: a pyserial C{serial.Serial} instance used to manage the
options on the serial port.
c � � t | j d� r| j j |� y | j j |� y )N�setBaudrate)�hasattr�_serialr �setBaudRate)�self�baudrates �=/usr/lib/python3/dist-packages/twisted/internet/serialport.pyr zBaseSerialPort.setBaudRate; s4 � ��4�<�<��/��L�L�$�$�X�.��L�L�$�$�X�.� c �6 � | j j � S �N)r � inWaiting�r s r r zBaseSerialPort.inWaitingA s � ��|�|�%�%�'�'r c �8 � | j j � y r )r �
flushInputr s r r zBaseSerialPort.flushInputD s � ������!r c �8 � | j j � y r )r �flushOutputr s r r! zBaseSerialPort.flushOutputG s � ���� � �"r c �8 � | j j � y r )r � sendBreakr s r r# zBaseSerialPort.sendBreakJ s � ������ r c �6 � | j j � S r )r �getDSRr s r r% zBaseSerialPort.getDSRM � � ��|�|�"�"�$�$r c �6 � | j j � S r )r �getCDr s r r( zBaseSerialPort.getCDP � � ��|�|�!�!�#�#r c �6 � | j j � S r )r �getRIr s r r+ zBaseSerialPort.getRIS r) r c �6 � | j j � S r )r �getCTSr s r r- zBaseSerialPort.getCTSV r& |