#NEWLINE# def __init__( self , port , baudrate , prn_lock , config ) : #NEWLINE# #INDENT# self . port = port #NEWLINE# self . baudrate = int ( baudrate ) #NEWLINE# self . timeout = 0 #NEWLINE# self . prn_lock = prn_lock #NEWLINE# self . config = config #NEWLINE# self . logger = HtrunLogger ( prn_lock , 'SERI' ) #NEWLINE# self . LAST_ERROR = None #NEWLINE# self . logger . prn_inf ( ( 'serial(port=%s, baudrate=%d)' % ( self . port , self . baudrate ) ) ) #NEWLINE# try : #NEWLINE# #INDENT# self . serial = Serial ( port , baudrate = baudrate , timeout = self . timeout ) #NEWLINE# #UNINDENT# except SerialException as e : #NEWLINE# #INDENT# self . serial = None #NEWLINE# self . LAST_ERROR = ( 'connection lost, serial.Serial(%s. %d, %d): %s' % ( self . port , self . baudrate , self . timeout , str ( e ) ) ) #NEWLINE# self . logger . prn_err ( str ( e ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . reset_dev_via_serial ( )