Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/serial/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/serial/loopback_connection.pyc


*Jc@sXddlTddlZddlZddlZiejd6ejd6ejd6ejd6Zde	fdYZ
yddlZWn*ek
rd	e
e
fd
YZnXd	e
ejfdYZedkrTddlZed
ZejjdeejjdejdejejjdejdejndS(i(t*NtdebugtinfotwarningterrortLoopbackSerialcBseZdZd&ZdZdZdZdZdZdZ	ddZ
dZdZdZ
ddZedZed Zed!Zd"Zd#Zd$Zd%ZRS('s-Serial port implementation for plain sockets.i2iKiniiii,iXiii`	ii%iKiiicCsd|_tj|_t|_t|_t|_	|j
dkrTtdn|j|j
|jt|_|js|jt|jtn|j|jdS(sjOpen port with current settings. This may throw a SerialException
           if the port cannot be opened.s.Port must be configured before it can be used.N(tNonetloggert	threadingtLocktbuffer_lockt	bytearraytloop_buffertFalsetctstdsrt_porttSerialExceptiontfromURLtportt_reconfigurePorttTruet_isOpent_rtsctstsetRTStsetDTRt
flushInputtflushOutput(tself((s>/usr/lib/python2.7/dist-packages/serial/loopback_connection.pytopen&s			
		

cCsot|jttfs9d|jko3dknrOtd|jn|jrk|jjdndS(sgSet communication parameters on opened port. for the loop://
        protocol all settings are ignored!iii sinvalid baudrate: %rs_reconfigurePort()NI(t
isinstancet	_baudratetinttlongt
ValueErrorRR(R((s>/usr/lib/python2.7/dist-packages/serial/loopback_connection.pyR?s9	cCs&|jr"t|_tjdndS(s
Close portg333333?N(RR
ttimetsleep(R((s>/usr/lib/python2.7/dist-packages/serial/loopback_connection.pytcloseHs		cCstddS(Ns2there is no sensible way to turn numbers into URLs(R(RR((s>/usr/lib/python2.7/dist-packages/serial/loopback_connection.pytmakeDeviceNameOscCs|jjdr"|d}nyx|jdD]}d|krb|jdd\}}nd}|sqq5|dkrtjtjd|_|jjt	||jj
dq5td	|fq5WWn#tk
r}td
|nXdS(s(extract host and port from an URL stringsloop://it/t=itloggings
pySerial.loopsenabled loggingsunknown option: %rsAexpected a string in the form "[loop://][option[/option...]]": %sN(
tlowert
startswithtsplitRR)tbasicConfigt	getLoggerRtsetLevelt
LOGGER_LEVELSRR"R(Rturltoptiontvaluete((s>/usr/lib/python2.7/dist-packages/serial/loopback_connection.pyRRs"

cCsK|jstn|jr>|jjdt|jfnt|jS(s>Return the number of characters currently in the input buffer.sinWaiting() -> %d(RtportNotOpenErrorRRtlenR(R((s>/usr/lib/python2.7/dist-packages/serial/loopback_connection.pyt	inWaitingjs
			#icCs|jstn|jdk	r7tj|j}nd}t}x{t||kr|jjz!t	|j
| }|j
|4Wd|jjX||7}|rItj|krIPqIqIWt|S(sRead 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.N(
RR5t_timeoutRR#RR6R
tacquiretto_bytesRtreleasetbytes(Rtsizettimeouttdatatblock((s>/usr/lib/python2.7/dist-packages/serial/loopback_connection.pytreadss 			

cCs|jstndt||j}|jdk	r`||jkr`tj|jtn|j	j
z|jt|7_Wd|j	j
Xt|S(sOutput the given string over the serial port. Can block if the
        connection is blocked. May raise SerialException if the connection is
        closed.g$@N(RR5R6Rt
_writeTimeoutRR#R$twriteTimeoutErrorR
R9RR<R;(RR?ttime_used_to_send((s>/usr/lib/python2.7/dist-packages/serial/loopback_connection.pytwrites			
cCs[|jstn|jr.|jjdn|jjz|j2Wd|jjXdS(s9Clear input buffer, discarding all that is in the buffer.sflushInput()N(RR5RRR
R9RR;(R((s>/usr/lib/python2.7/dist-packages/serial/loopback_connection.pyRs			
cCs2|jstn|jr.|jjdndS(sbClear output buffer, aborting the current output and
        discarding all that is in the buffer.s
flushOutput()N(RR5RR(R((s>/usr/lib/python2.7/dist-packages/serial/loopback_connection.pyRs			g?cCs|jstndS(sPSend break condition. Timed, returns to idle state after given
        duration.N(RR5(Rtduration((s>/usr/lib/python2.7/dist-packages/serial/loopback_connection.pyt	sendBreaks	cCs9|jstn|jr5|jjd|fndS(sJSet break: Controls TXD. When active, to transmitting is
        possible.ssetBreak(%r)N(RR5RR(Rtlevel((s>/usr/lib/python2.7/dist-packages/serial/loopback_connection.pytsetBreaks			cCsB|jstn|jr5|jjd|fn||_dS(s)Set terminal status line: Request To SendssetRTS(%r) -> state of CTSN(RR5RRR(RRH((s>/usr/lib/python2.7/dist-packages/serial/loopback_connection.pyRs
			cCsB|jstn|jr5|jjd|fn||_dS(s-Set terminal status line: Data Terminal ReadyssetDTR(%r) -> state of DSRN(RR5RRR(RRH((s>/usr/lib/python2.7/dist-packages/serial/loopback_connection.pyRs
			cCs?|jstn|jr8|jjd|jfn|jS(s(Read terminal status line: Clear To SendsgetCTS() -> state of RTS (%r)(RR5RRR(R((s>/usr/lib/python2.7/dist-packages/serial/loopback_connection.pytgetCTSs
			cCs?|jstn|jr8|jjd|jfn|jS(s)Read terminal status line: Data Set ReadysgetDSR() -> state of DTR (%r)(RR5RRR(R((s>/usr/lib/python2.7/dist-packages/serial/loopback_connection.pytgetDSRs
			cCs2|jstn|jr.|jjdntS(s)Read terminal status line: Ring Indicatorsreturning dummy for getRI()(RR5RRR
(R((s>/usr/lib/python2.7/dist-packages/serial/loopback_connection.pytgetRIs
			cCs2|jstn|jr.|jjdntS(s)Read terminal status line: Carrier Detectsreturning dummy for getCD()(RR5RRR(R((s>/usr/lib/python2.7/dist-packages/serial/loopback_connection.pytgetCDs
			(i2iKiniiii,iXiii`	ii%iKiii(t__name__t
__module__t__doc__t	BAUDRATESRRR%R&RR7RARERRRGRRIRRRJRKRLRM(((s>/usr/lib/python2.7/dist-packages/serial/loopback_connection.pyR s*														tSerialcBseZRS((RNRO(((s>/usr/lib/python2.7/dist-packages/serial/loopback_connection.pyRRscBseZRS((RNRO(((s>/usr/lib/python2.7/dist-packages/serial/loopback_connection.pyRRst__main__ssocket://localhost:7000s%s
s	write...
shello
s	read: %s
i(t
serialutilRR#R)tDEBUGtINFOtWARNINGtERRORR0t
SerialBaseRtiotImportErrortFileLikeRRt	RawIOBaseRNtsystststdoutREtflushRAR%(((s>/usr/lib/python2.7/dist-packages/serial/loopback_connection.pyt<module>s.