#coding:utf-8 import J2534 from J2534.Define import * import sys J2534.SetErrorLog(True) devices = J2534.getDevices() try: index = int(sys.argv[1], base=10) except: index = 0 J2534.setDevice(index) ret, deviceID = J2534.ptOpen() # connect one channel of the device # set the baudrate to 500K ret, channelID = J2534.ptConnect(deviceID, ProtocolID.CAN, 0, BaudRate.B500K) print(channelID) ret = J2534.ptDisconnect(channelID) ret = J2534.ptClose(deviceID)
#coding:utf-8 import J2534 from J2534.Define import * import sys J2534.SetErrorLog(True) import time try: index = int(sys.argv[1], base=10) except: index = 0 J2534.setDevice(index) J2534.setDevice(key=index) ret, id1 = J2534.ptOpen() ret, ch1 = J2534.ptConnect(id1, ProtocolID.ISO15765, 0, 500000) msg = J2534.ptTxMsg(ProtocolID.ISO15765, 32) data = [2, 10, 3, 0, 0, 0, 0, 0, 0] #data = data + [0]*padding(len(data)) msg.setIDandData(0x241, data) maskMsg = J2534.ptMskMsg(16) maskMsg.setID(0xffffffff) patternMsg = J2534.ptPatternMsg(16) patternMsg.setID(0x641) flowcontrolMsg = J2534.ptPatternMsg(16)