winIDEA SDK
test_create_instance.py
1# This script is licensed under BSD License, see file LICENSE.txt.
2#
3# (c) TASKING Germany GmbH, 2023
4
5import os
6import isystem.connect as ic
7import export_trace_data # see docs section Examples for link to source
8
9
10winidea_id = ''
11
12
13def test_createInstance():
14 conn_mgr = ic.ConnectionMgr()
15 conn_mgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
16
17 print("Exporting entire trace data to XML from a current trace controller... ")
18 trace_ctrl = ic.CTraceController(conn_mgr, export_trace_data.EXAMPLE_TRD_FILE, "u")
19 trace_ctrl.waitUntilLoaded(1000)
20 trace_data = ic.CTraceData.createInstance(trace_ctrl, "test_createInstance.xml", 0, 0, False)
21 trace_ctrl.closeDiscard()
22 trace_data.closeParser()
23
24 file_path = os.path.join(os.getcwd(), "test_createInstance.xml")
25 print(f"\tDone: {file_path}")
26
27 xml_file_path, bin_file_path = export_trace_data.export_data(conn_mgr)
28 print(f"Reading existing trace data XML file: {xml_file_path}")
29 trace_data = ic.CTraceData.createInstance(xml_file_path)
30 trace_data.closeParser()
31
32 print(f"Reading existing trace data BIN file: {bin_file_path}")
33 fmt = ic.CTraceBinExportFormat()
34 fmt.setHeaderVersion(ic.CTraceBinExportFormat.EHeaderVer2)
35 # ... specify other format settings as they were set when binary export file was created ...
36 trace_data = ic.CTraceData.createInstance(bin_file_path, fmt)
37 trace_data.closeParser()
38
39
40if __name__ == "__main__":
41 test_createInstance()