<s> """<STR_LIT>""" <EOL> import sys <EOL> import logging <EOL> from bacpypes . debugging import bacpypes_debugging , ModuleLogger <EOL> from bacpypes . consolelogging import ArgumentParser <EOL> from bacpypes . core import run <EOL> from bacpypes . comm import PDU , Client , bind , ApplicationServiceElement <EOL> from bacpypes . tcp import TCPServerDirector <EOL> _debug = <NUM_LIT:0> <EOL> _log = ModuleLogger ( globals ( ) ) <EOL> server_address = None <EOL> default_server_host = '<STR_LIT:127.0.0.1>' <EOL> default_server_port = <NUM_LIT> <EOL> class EchoMaster ( Client ) : <EOL> def confirmation ( self , pdu ) : <EOL> if _debug : EchoMaster . _debug ( '<STR_LIT>' , pdu ) <EOL> self . request ( PDU ( pdu . pduData , destination = pdu . pduSource ) ) <EOL> bacpypes_debugging ( EchoMaster ) <EOL> class MiddleManASE ( ApplicationServiceElement ) : <EOL> def indication ( self , addPeer = None , delPeer = None ) : <EOL> """<STR_LIT>""" <EOL> if _debug : MiddleManASE . _debug ( '<STR_LIT>' , addPeer , delPeer ) <EOL> if addPeer : <EOL> if _debug : MiddleManASE . _debug ( "<STR_LIT>" , addPeer ) <EOL> if delPeer : <EOL> if _debug : MiddleManASE . _debug ( "<STR_LIT>" , delPeer ) <EOL> bacpypes_debugging ( MiddleManASE ) <EOL> def main ( ) : <EOL> parser = ArgumentParser ( description = __doc__ ) <EOL> parser . add_argument ( <EOL> "<STR_LIT>" , nargs = '<STR_LIT:?>' , <EOL> help = "<STR_LIT>" , <EOL> default = default_server_host , <EOL> ) <EOL> parser . add_argument ( <EOL> "<STR_LIT>" , nargs = '<STR_LIT:?>' , type = int , <EOL> help = "<STR_LIT>" , <EOL> default = default_server_port , <EOL> ) <EOL> args = parser . parse_args ( ) <EOL> if _debug : _log . debug ( "<STR_LIT>" ) <EOL> if _debug : _log . debug ( "<STR_LIT>" , args ) <EOL> host = args . host <EOL> if host == "<STR_LIT>" : <EOL> host = '<STR_LIT>' <EOL> port = args . port <EOL> server_address = ( host , port ) <EOL> if _debug : _log . debug ( "<STR_LIT>" , server_address ) <EOL> this_director = TCPServerDirector ( server_address ) <EOL> if _debug : _log . debug ( "<STR_LIT>" , this_director ) <EOL> echo_master = EchoMaster ( ) <EOL> if _debug : _log . debug ( "<STR_LIT>" , echo_master ) <EOL> bind ( echo_master , this_director ) <EOL> bind ( MiddleManASE ( ) , this_director ) <EOL> _log . debug ( "<STR_LIT>" ) <EOL> run ( ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> main ( ) </s>
