@@ -709,10 +709,10 @@ class J2534Connection(BaseConnection):
709709 :type name: string
710710 :param debug: This will enable windows debugging mode in the dll (see tactrix doc for additional information)
711711 :type debug: boolean
712- :param args: Optional parameters list (Unused right now).
713- :type args: list
714- :param kwargs: Optional parameters dictionary Unused right now).
715- :type kwargs: dict
712+ :param protocol: CAN protocol
713+ :type protocol: Protocol_ID
714+ :param baudrate: Operation bauderate
715+ :type baudrate: int
716716
717717 """
718718
@@ -727,23 +727,29 @@ class J2534Connection(BaseConnection):
727727 exit_requested : bool
728728 opened : bool
729729
730- def __init__ (self , windll : str , rxid : int , txid : int , name : Optional [str ] = None , debug : bool = False , * args , ** kwargs ):
730+ def __init__ (self ,
731+ windll : str ,
732+ rxid : int ,
733+ txid : int ,
734+ name : Optional [str ] = None ,
735+ debug : bool = False ,
736+ protocol = None ,
737+ baudrate = 500000 ,
738+ ):
731739 BaseConnection .__init__ (self , name )
732740
733- # Set up a J2534 interface using the DLL provided
734- try :
735- self .interface = J2534 (windll = windll , rxid = rxid , txid = txid )
736- except FileNotFoundError :
737- raise RuntimeError ('DLL not found' )
738-
739- # Set the protocol to ISO15765, Baud rate to 500000
740- self .protocol = Protocol_ID .ISO15765
741- self .baudrate = 500000
741+ self .protocol = protocol if protocol else Protocol_ID .ISO15765
742+ self .baudrate = baudrate
742743 self .debug = debug
743744
744745 try :
746+ # Set up a J2534 interface using the DLL provided
747+ self .interface = J2534 (windll = windll , rxid = rxid , txid = txid )
748+
745749 # Open the interface (connect to the DLL)
746750 self .result , self .devID = self .interface .PassThruOpen ()
751+ except FileNotFoundError :
752+ raise RuntimeError ('DLL not found' )
747753 except OSError as e :
748754 if e .errno in [0x16 , 0xe06d7363 ]:
749755 raise RuntimeError ('J2534 Device busy' )
@@ -771,7 +777,7 @@ def __init__(self, windll: str, rxid: int, txid: int, name: Optional[str] = None
771777 self .log_last_operation ("PassThruConnect" , with_raise = True )
772778
773779 configs = SCONFIG_LIST ([
774- (Ioctl_ID .DATA_RATE .value , 500000 ),
780+ (Ioctl_ID .DATA_RATE .value , self . baudrate ),
775781 (Ioctl_ID .LOOPBACK .value , 0 ),
776782 (Ioctl_ID .ISO15765_BS .value , 0x20 ),
777783 (Ioctl_ID .ISO15765_STMIN .value , 0 ),
0 commit comments