g hdZddlmZddlZddlZGddeZGddejZdS)zThe settings for RS485 are stored in a dedicated object that can be applied to serial ports (where supported). NOTE: Some implementations may only support a subset of the settings. )absolute_importNc eZdZ ddZdS) RS485SettingsTFNcL||_||_||_||_||_dSN)rts_level_for_txrts_level_for_rxloopbackdelay_before_txdelay_before_rx)selfrr r r r s \/home/jenkins/workspace/simtester-sanitize/venv/lib/python3.11/site-packages/serial/rs485.py__init__zRS485Settings.__init__s1!1 0  ..)TFFNN)__name__ __module__ __qualname__rrrrrs9""  / / / / / /rrcbeZdZdZfdZfdZedZejdZxZ S)RS485a5 A subclass that replaces the write method with one that toggles RTS according to the RS485 settings. NOTE: This may work unreliably on some serial ports (control signals not synchronized or delayed compared to data). Using delays may be unreliable (varying times, larger than expected) as the OS may not support very fine grained delays (no smaller than in the order of tens of milliseconds). NOTE: Some implementations support this natively. Better performance can be expected when the native version is used. NOTE: The loopback property is ignored by this implementation. The actual behavior depends on the used hardware. Usage: ser = RS485(...) ser.rs485_mode = RS485Settings(...) ser.write(b'hello') cVtt|j|i|d|_dSr)superrr_alternate_rs485_settings)r argskwargs __class__s rrzRS485.__init__=s3#eT#T4V444)-&&&rc,|j||jj|jjt j|jjt t||t t| |jj t j|jj ||jj dSt t||dS)z=Write to port, controlling RTS before and after transmitting.N) rsetRTSrr timesleeprrwriteflushr r )r brs rr!z RS485.writeAs  ) 5 KK6G H H H-=I 49IJJJ %   $ $Q ' ' ' %   $ $ & & &-=I 49IJJJ KK6G H H H H H %   $ $Q ' ' ' ' 'rc|jS)z Enable RS485 mode and apply new settings, set to None to disable. See serial.rs485.RS485Settings for more info about the value. r)r s r rs485_modezRS485.rs485_modeTs --rc||_dSrr%)r rs485_settingss rr&zRS485.rs485_mode\s)7&&&r) rrr__doc__rr!propertyr&setter __classcell__)rs@rrr%s......(((((&..X.8888888rr) r) __future__rrserialobjectrSerialrrrrr1s '&&&&&  / / / / /F / / /9898989898FM9898989898r