File "serialjava.cpython-36.pyc"

Full Path: /home/attunedd/public_html/byp/izo/con7ext_sym404/rintoar.txt/usr/lib/python3.6/site-packages/serial/__pycache__/serialjava.cpython-36.pyc
File size: 7.08 KB
MIME-type: text/x-bytecode.python
Charset: 8 bit

3

M]W @s@ddlTddZddZeddgZdd	ZGd
ddeZdS)
)*cCs6t|}|jd}x|ddD]}t||}q W|S)N.)
__import__splitgetattr)namemodZ
componentscompr /usr/lib/python3.6/serialjava.py	my_import
s

r
c
CsFx8|D]0}yt|}|j|Sttfk
r4YqXqWtddS)z1try given list of modules and return that importsz/No Java Communications API implementation foundN)r

SerialPortImportErrorAttributeError)namesrr	rrrdetect_java_comms

rz
javax.commzgnu.iocCsJtjj}g}x.|jr<|j}|jtjjkr|j|qW||jS)z%Turn a port number into a device name)	commCommPortIdentifierZgetPortIdentifiersZhasMoreElementsZnextElementZgetPortTypeZPORT_SERIALappendZgetName)Z
portnumberenumZportsZelrrrdevice*s

rc@seZdZdZddZddZddZedd	Zd%ddZ	d
dZ
ddZddZd&ddZ
ddZddZddZeddZeddZed d!Zed"d#Zd$S)'Serialz    Serial port class, implemented with Java Communications API and
    thus usable with jython and the appropriate java extension.
    cCs|jdkrtd|jr tdt|jtdkrBtjj|j}ntjjt|j}y|jdd|_	Wn4t
k
r}zd|_	td|WYdd}~XnX|j|j	j|_
|j	j|_d|_dS)	zx        Open port with current settings. This may throw a SerialException
        if the port cannot be opened.
        Nz.Port must be configured before it can be used.zPort is already open.zpython serial module
zCould not open port: %sT)Z_portSerialExceptionis_opentyperrZgetPortIdentifierropensPort	Exception_reconfigurePortZgetInputStream	_instreamZgetOutputStream
_outstream)selfZportIdmsgrrrr;s 
zSerial.opencCs|jstd|jjd|jtkr.tjj}nJ|jtkrBtjj	}n6|jt
krVtjj}n"|jtkrjtjj
}ntd|j|jtkrtjj}n6|jtkrtjj}n"|jtkrtjj}ntd|j|jtkrtjj}nd|jtkrtjj}nP|jtkrtjj}n:|jtkrtjj}n$|jtkr,tjj}ntd|jd}}|jrb|tjjO}|tjjO}|jr|tjj O}|tjj!O}|jj"|j#||||jj$||B|j%dkr|jjt&|j%dn
|jj'dS)	z,Set communication parameters on opened port.z'Can only operate on a valid port handlezunsupported bytesize: %rz"unsupported number of stopbits: %rzunsupported parity type: %rriN)(rrZenableReceiveTimeoutZ	_bytesizeZFIVEBITSrrZ
DATABITS_5ZSIXBITSZ
DATABITS_6Z	SEVENBITSZ
DATABITS_7Z	EIGHTBITSZ
DATABITS_8
ValueErrorZ	_stopbitsZSTOPBITS_ONEZ
STOPBITS_1ZSTOPBITS_ONE_POINT_FIVEZSTOPBITS_1_5ZSTOPBITS_TWOZ
STOPBITS_2Z_parityZPARITY_NONEZPARITY_EVENZ
PARITY_ODDZPARITY_MARKZPARITY_SPACEZ_rtsctsZFLOWCONTROL_RTSCTS_INZFLOWCONTROL_RTSCTS_OUTZ_xonxoffZFLOWCONTROL_XONXOFF_INZFLOWCONTROL_XONXOFF_OUTZsetSerialPortParamsZ	_baudrateZsetFlowControlModeZ_timeoutintZdisableReceiveTimeout)r$Z	jdatabitsZ	jstopbitsZjparityZjflowinZjflowoutrrrr!RsT




















zSerial._reconfigurePortcCs:|jr6|jr0|jj|jj|jjd|_d|_dS)z
Close portNF)rrr"closer#)r$rrrr)s


zSerial.closecCs|js
t|jjS)z>Return the number of characters currently in the input buffer.)rportNotOpenErrorr"	available)r$rrr
in_waitingszSerial.in_waitingrcCs\|js
tt}|dkrTx:t||krR|jj}|dkrF|jdkrPPq|j|qWt|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.
        rr)	rr*	bytearraylenr"readZtimeoutrbytes)r$sizer0xrrrr0s

zSerial.readcCs@|js
tt|ttfs,tdtt|f|jj|t	|S)z-Output the given string over the serial port.z expected %s or bytearray, got %s)
rr*
isinstancer1r.	TypeErrorrr#writer/)r$datarrrr6szSerial.writecCs |js
t|jj|jjdS)z9Clear input buffer, discarding all that is in the buffer.N)rr*r"skipr+)r$rrrreset_input_bufferszSerial.reset_input_buffercCs|js
t|jjdS)zs        Clear output buffer, aborting the current output and
        discarding all that is in the buffer.
        N)rr*r#flush)r$rrrreset_output_bufferszSerial.reset_output_buffer?cCs|js
t|jj|ddS)zHSend break condition. Timed, returns to idle state after given duration.g@@N)rr*Z	sendBreak)r$Zdurationrrr
send_breakszSerial.send_breakcCs|jdkrttddS)zBSet break: Controls TXD. When active, to transmitting is possible.Nz<The _update_break_state function is not implemented in java.)fdr*r)r$rrr_update_break_states
zSerial._update_break_statecCs|js
t|jj|jdS)z)Set terminal status line: Request To SendN)rr*ZsetRTSZ
_rts_state)r$rrr_update_rts_stateszSerial._update_rts_statecCs|js
t|jj|jdS)z-Set terminal status line: Data Terminal ReadyN)rr*ZsetDTRZ
_dtr_state)r$rrr_update_dtr_stateszSerial._update_dtr_statecCs|js
t|jjdS)z(Read terminal status line: Clear To SendN)rr*ZisCTS)r$rrrctssz
Serial.ctscCs|js
t|jjdS)z)Read terminal status line: Data Set ReadyN)rr*ZisDSR)r$rrrdsrsz
Serial.dsrcCs|js
t|jjdS)z)Read terminal status line: Ring IndicatorN)rr*ZisRI)r$rrrrisz	Serial.ricCs|js
t|jjdS)z)Read terminal status line: Carrier DetectN)rr*ZisCD)r$rrrcdsz	Serial.cdN)r)r<)__name__
__module____qualname____doc__rr!r)propertyr,r0r6r9r;r=r?r@rArBrCrDrErrrrr5s"7
		
rN)Zserial.serialutilr
rrrZ
SerialBaserrrrr<module>
s