10This script demonstrates different use cases for CAN/LIN Add-on module.
11More information can be found in the winIDEA Help.
15import isystem.connect
as ic
18conn_mgr = ic.ConnectionMgr()
19conn_mgr.connect(ic.CConnectionConfig())
28FNet_ctrl = ic.CFNetCtrl(conn_mgr)
29CAN1_ctrl = FNet_ctrl.CAN(
"CAN2LIN2.CAN1")
30CAN1_cfg = CAN1_ctrl.cfg()
31CAN1_cfg.set(
"Databases[0].Path",
"../../common/AOM/CAN.dbc")
32CAN1_cfg.set_mode(ic.ECAN_CAN)
33CAN1_cfg.set_allow_injection(
True)
34CAN1_cfg.set_arbitration(nBaudrate_kbps=500, nBitSamplingPoint=70)
37session_ctrl = ic.CSessionCtrl(conn_mgr)
39session_ctrl.begin_reset()
44CAN1_op = CAN1_ctrl.op()
45CAN1_op.set_record_all_received(
True)
46CAN1_op.set_record_all_injected(
True)
49CAN1_op.set_comparator(nComparator=0, bRecord=
True, nFTrig=4, eLength=ic.ECAN_Standard,
50 nID=0x555, nMask=0xFFFFFFFF, eType=ic.ECAN_Both)
53CAN1_op.set_action(nAction=0, nFTrig=4, eLength=ic.ECAN_Standard, nID=0x123,
54 bFD=
False, bBRS=
False, bESI=
False, bRequest=
False, rstrData=
"00000000")
57profiler = ic.CProfilerController2(conn_mgr, fileName=
'CANLIN_use_case.trd', mode=
'w')
61exec_ctrl = ic.CExecutionController(conn_mgr)
68CAN1_ctrl.ctrl_inject(eLength=ic.ECAN_Standard, nID=0x45, bFD=
False,
69 bBRS=
False, bESI=
False, bRequest=
False, rstrData=
"00000000")
75bc_ctrl = ic.CBreakpointController(conn_mgr)
76bc_ctrl.setBP(
"Runnable_Core0_1000ms")
77exec_ctrl.run(ic.CExecutionController.TOUT_INF)
78CAN1_ctrl.ctrl_inject(eLength=ic.ECAN_Standard, nID=0xBB, bFD=
False,
79 bBRS=
False, bESI=
False, bRequest=
False, rstrData=
"00000000")
83export_cfg = ic.CProfilerExportConfig()
84export_cfg.setFileName(
'CANLIN_use_case.xml') \
85 .setSaveTimeline(
True)
86profiler.exportData(export_cfg)
89profiler_export_file = export_cfg.getFileName()
90profiler_data = ic.CProfilerData2.createInstance(export_cfg.getFileName(),
False)
93warnings = profiler_data.getParserWarnings()
95 print(f
"WARNING(S): {warnings}")
98if profiler_data.hasArea(ic.CProfilerArea2.EAUX,
'Signal_Rx8bit_Cyclic'):
99 signal_area = profiler_data.getArea(ic.CProfilerArea2.EAUX,
'Signal_Rx8bit_Cyclic')
100 timelineIterator = profiler_data.getTimelineIterator(ic.CProfilerTimeEvent.EEvAny,
101 signal_area.getHandle())
103 while timelineIterator.hasNext():
104 timeEvent = timelineIterator.next()
105 print(timeEvent.toString())