示例#1
0
    def __init__(self, parent):
        self.parent = parent
        self.bus = None

        self.Repro_numTotal = 0
        self.Repro_num = 0
        self.Repro_completeflag = False
        self.statusText = ''

        self.Func_addr = None
        self.Func_stack = None
        self.Func_conn = None

        self.Phys_addr = None
        self.Phys_stack = None
        self.Phys_conn = None

        # Vector Bus
        try:
            self.bus = VectorBus(channel=0,
                                 app_name='SANY SJB Reprogram',
                                 bitrate=250000)  # Link Layer (CAN protocol)
        except:
            self.set_statusText(
                color='red',
                text='CAN Open fail. Check the vector Hardware Configuration.')
        else:
            udsoncan.setup_logging('logging.conf')
            self.set_statusText(color='green', text='CAN Open Success.')
            self.parent.canOpenSuccess()
示例#2
0
import udsoncan
udsoncan.setup_logging(
)  # Use default logging file that redirect unit test logging to null
示例#3
0
import can
import isotp
import udsoncan
from udsoncan.connections import PythonIsoTpConnection
from udsoncan.client import Client
from udsoncan.exceptions import *
from udsoncan.services import *

udsoncan.setup_logging()

bus = can.interface.Bus(bustype="cantact", channel="0", bitrate=500000)
addr = isotp.Address(addressing_mode=isotp.AddressingMode.Normal_11bits,
                     txid=0x123,
                     rxid=0x456)
tp = isotp.CanStack(bus, address=addr)
conn = PythonIsoTpConnection(tp)
client = Client(conn)

conn.open()
client.ecu_reset(ECUReset.ResetType.hardReset)
print("done")
conn.close()