Viewing File: /usr/lib/python2.7/site-packages/serial/urlhandler/protocol_socket.pyo

ó
ÖõƒMc@sXddlTddlZddlZddlZiejd6ejd6ejd6ejd6Zde	fd„ƒYZ
yddlZWn*ek
r®d	e
e
fd
„ƒYZnXd	e
ejfd„ƒYZedkrTddlZed
ƒZejjdeƒejjdƒejdƒejƒejjdejdƒƒejƒndS(iÿÿÿÿ(t*NtdebugtinfotwarningterrortSocketSerialcBsÅeZdZd&Zd„Zd„Zd„Zd„Zd„Zd„Z	dd„Z
d„Zd„Zd„Z
dd„Zed„Zed „Zed!„Zd"„Zd#„Zd$„Zd%„ZRS('s-Serial port implementation for plain sockets.i2iKini†i–iÈi,iXi°ii`	iÀi€%iKi–iáiÂcCsd|_|jdkr'tdƒ‚n|jr?tdƒ‚ny;tjtjtjƒ|_|jj	|j
|jƒƒWn5tk
r±}d|_td|j|fƒ‚nX|jj
dƒ|jƒt|_|jsû|jtƒ|jtƒn|jƒ|jƒdS(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.sPort is already open.sCould not open port %s: %siN(tNonetloggert_porttSerialExceptiont_isOpentsockettAF_INETtSOCK_STREAMt_sockettconnecttfromURLtportstrt	Exceptiont
settimeoutt_reconfigurePorttTruet_rtsctstsetRTStsetDTRt
flushInputtflushOutput(tselftmsg((sE/usr/lib/python2.7/site-packages/serial/urlhandler/protocol_socket.pytopen(s&		 	
		

cCs>|jdkrtdƒ‚n|jr:|jjdƒndS(siSet communication parameters on opened port. for the socket://
        protocol all settings are ignored!sCan only operate on open portss!ignored port configuration changeN(RRR	RR(R((sE/usr/lib/python2.7/site-packages/serial/urlhandler/protocol_socket.pyRCs	cCsi|jre|jrLy$|jjtjƒ|jjƒWnnXd|_nt|_tj	dƒndS(s
Close portg333333Ó?N(
R
RtshutdownRt	SHUT_RDWRtcloseRtFalsettimetsleep(R((sE/usr/lib/python2.7/site-packages/serial/urlhandler/protocol_socket.pyR Ks			cCstdƒ‚dS(Ns2there is no sensible way to turn numbers into URLs(R	(Rtport((sE/usr/lib/python2.7/site-packages/serial/urlhandler/protocol_socket.pytmakeDeviceNameZscCsu|jƒjdƒr"|d}ny#d|krõ|jddƒ\}}x©|jdƒD]•}d|kr†|jddƒ\}}nd}|dkrÛtjƒtjdƒ|_|jjt	|ƒ|jj
dƒqYtd	|fƒ‚qYWn|jd
dƒ\}}t|ƒ}d|ko0dknsDtd
ƒ‚nWn#tk
rj}t
d|ƒ‚nX||fS(s(extract host and port from an URL strings	socket://i	t/it=tloggingspySerial.socketsenabled loggingsunknown option: %rt:iisport not in range 0...65535sRexpected a string in the form "[rfc2217://]<host>:<port>[/option[/option...]]": %sN(tlowert
startswithtsplitRR(tbasicConfigt	getLoggerRtsetLevelt
LOGGER_LEVELSRt
ValueErrortintR	(RturltoptionstoptiontvaluethostR$te((sE/usr/lib/python2.7/site-packages/serial/urlhandler/protocol_socket.pyR]s,

cCs2|jst‚n|jr.|jjdƒndS(s>Return the number of characters currently in the input buffer.s&WARNING: inWaiting returns dummy valuei(R
tportNotOpenErrorRR(R((sE/usr/lib/python2.7/site-packages/serial/urlhandler/protocol_socket.pyt	inWaiting|s
			icCsÂ|jst‚ntƒ}tjƒ|j}x‡t|ƒ|kr·tjƒ|kr·y |jj|t|ƒƒ}Wq1tj	k
rŽq1q1tj
k
r³}td|ƒ‚q1Xq1Wt|ƒS(sÀ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.sconnection failed (%s)(
R
R9t	bytearrayR"t_timeouttlenRtrecvRttimeoutRR	tbytes(RtsizetdataR?R8((sE/usr/lib/python2.7/site-packages/serial/urlhandler/protocol_socket.pytread„s			' cCsY|jst‚ny|jj|ƒWn&tjk
rN}td|ƒ‚nXt|ƒS(sœOutput the given string over the serial port. Can block if the
        connection is blocked. May raise SerialException if the connection is
        closed.ssocket connection failed: %s(R
R9RtsendallRRR	R=(RRBR8((sE/usr/lib/python2.7/site-packages/serial/urlhandler/protocol_socket.pytwrite™s		cCs2|jst‚n|jr.|jjdƒndS(s9Clear input buffer, discarding all that is in the buffer.signored flushInputN(R
R9RR(R((sE/usr/lib/python2.7/site-packages/serial/urlhandler/protocol_socket.pyR¤s			cCs2|jst‚n|jr.|jjdƒndS(sbClear output buffer, aborting the current output and
        discarding all that is in the buffer.signored flushOutputN(R
R9RR(R((sE/usr/lib/python2.7/site-packages/serial/urlhandler/protocol_socket.pyRªs			gÐ?cCs9|jst‚n|jr5|jjd|fƒndS(sPSend break condition. Timed, returns to idle state after given
        duration.signored sendBreak(%r)N(R
R9RR(Rtduration((sE/usr/lib/python2.7/site-packages/serial/urlhandler/protocol_socket.pyt	sendBreak±s			cCs9|jst‚n|jr5|jjd|fƒndS(sJSet break: Controls TXD. When active, to transmitting is
        possible.signored setBreak(%r)N(R
R9RR(Rtlevel((sE/usr/lib/python2.7/site-packages/serial/urlhandler/protocol_socket.pytsetBreak¸s			cCs9|jst‚n|jr5|jjd|fƒndS(s)Set terminal status line: Request To Sendsignored setRTS(%r)N(R
R9RR(RRH((sE/usr/lib/python2.7/site-packages/serial/urlhandler/protocol_socket.pyR¿s			cCs9|jst‚n|jr5|jjd|fƒndS(s-Set terminal status line: Data Terminal Readysignored setDTR(%r)N(R
R9RR(RRH((sE/usr/lib/python2.7/site-packages/serial/urlhandler/protocol_socket.pyRÅs			cCs2|jst‚n|jr.|jjdƒntS(s(Read terminal status line: Clear To Sendsreturning dummy for getCTS()(R
R9RRR(R((sE/usr/lib/python2.7/site-packages/serial/urlhandler/protocol_socket.pytgetCTSËs
			cCs2|jst‚n|jr.|jjdƒntS(s)Read terminal status line: Data Set Readysreturning dummy for getDSR()(R
R9RRR(R((sE/usr/lib/python2.7/site-packages/serial/urlhandler/protocol_socket.pytgetDSRÒs
			cCs2|jst‚n|jr.|jjdƒntS(s)Read terminal status line: Ring Indicatorsreturning dummy for getRI()(R
R9RRR!(R((sE/usr/lib/python2.7/site-packages/serial/urlhandler/protocol_socket.pytgetRIÙs
			cCs2|jst‚n|jr.|jjdƒntS(s)Read terminal status line: Carrier Detectsreturning dummy for getCD()(R
R9RRR(R((sE/usr/lib/python2.7/site-packages/serial/urlhandler/protocol_socket.pytgetCDàs
			(i2iKini†i–iÈi,iXi°ii`	iÀi€%iKi–iáiÂ(t__name__t
__module__t__doc__t	BAUDRATESRRR R%RR:RCRERRRGRRIRRRJRKRLRM(((sE/usr/lib/python2.7/site-packages/serial/urlhandler/protocol_socket.pyR"s*												tSerialcBseZRS((RNRO(((sE/usr/lib/python2.7/site-packages/serial/urlhandler/protocol_socket.pyRRòscBseZRS((RNRO(((sE/usr/lib/python2.7/site-packages/serial/urlhandler/protocol_socket.pyRRöst__main__ssocket://localhost:7000s%s
s	write...
shello
s	read: %s
i(tserial.serialutilR"RR(tDEBUGtINFOtWARNINGtERRORR0t
SerialBaseRtiotImportErrortFileLikeRRt	RawIOBaseRNtsystststdoutREtflushRCR (((sE/usr/lib/python2.7/site-packages/serial/urlhandler/protocol_socket.pyt<module>s.




Ì



Back to Directory File Manager