o ^_#@sLddlmZddlZddlZddlTejejZddZGddde Z dS))absolute_importN)*cCstdd|DS)NcSsg|]}t|qS)ord).0xrr2/usr/lib/python3/dist-packages/serial/serialcli.py sz!as_byte_array..)sab)stringrrr as_byte_arraysr c@seZdZdZdZddZddZddZed d Z d#d d Z ddZ ddZ ddZ ddZddZddZeddZeddZeddZed d!Zd"S)$Serialz)Serial port implementation for .NET/Mono.)2Kni,iXiii` ii%iKiiic Cs|jdur td|jrtdz tjj|j|_Wnt y3}z d|_td|j|fd}~ww|j durReturn the number of characters currently in the input buffer.)rPortNotOpenErrorr BytesToReadr\rrr in_waitingzSerial.in_waitingcCsZ|jstt}|r)z ||jWn tjy"Yt|Sw|d8}|s t|S)z Read size bytes from the serial port. If a timeout is set it may return less characters as requested. With no timeout it will block until the requested number of bytes is read. rc) rr_ bytearrayappendrReadByterTimeoutExceptionbytes)r'sizedatarrrreadsz Serial.readcCsH|jstz|jt|dt|Wt|Stjy#tdw)z-Output the given string over the serial port.rz Write timeout) rr_rWriter lenrrgSerialTimeoutException)r'rjrrrwritesz Serial.writecC|jst|jdS)z9Clear input buffer, discarding all that is in the buffer.N)rr_rDiscardInBufferr\rrrr&szSerial.reset_input_buffercCrp)zs Clear output buffer, aborting the current output and discarding all that is in the buffer. N)rr_rDiscardOutBufferr\rrrreset_output_bufferszSerial.reset_output_buffercC|jstt|j|j_dS)zT Set break: Controls TXD. When active, to transmitting is possible. N)rr_bool _break_stater BreakStater\rrr_update_break_stateszSerial._update_break_statecCrt)z)Set terminal status line: Request To SendN)rr_rurr RtsEnabler\rrrr%zSerial._update_rts_statecCrt)z-Set terminal status line: Data Terminal ReadyN)rr_rurr DtrEnabler\rrrr#rzzSerial._update_dtr_statecCr^)z(Read terminal status line: Clear To Send)rr_r CtsHoldingr\rrrctsrbz Serial.ctscCr^)z)Read terminal status line: Data Set Ready)rr_r DsrHoldingr\rrrdsrrbz Serial.dsrcCs|jstdS)z)Read terminal status line: Ring IndicatorF)rr_r\rrrrisz Serial.ricCr^)z)Read terminal status line: Carrier Detect)rr_r CDHoldingr\rrrcdrbz Serial.cdN)rc)__name__ __module__ __qualname____doc__ BAUDRATESr)r r]propertyrarkror&rsrxr%r#r}rrrrrrrr s.H      r ) __future__rrSystem.IO.Portsserial.serialutilArrayByter r SerialBaser rrrrs