winIDEA SDK
test_data_evaluate.py
1# This script is licensed under BSD License, see file LICENSE.txt.
2# (c) TASKING Germany GmbH, 2023
3#
4# This Python script focuses on the CDataController2.evaluateComposite() function, which handles arrays and structures regardless of its size.
5# It enables the retrieval and inspection of complex composite variables like g_complexStruct.
6
7import isystem.connect as ic
8
9
10winidea_id = ''
11
12
13def test_evaluate():
14 connMgr = ic.ConnectionMgr()
15 connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
16
17 dataCtrl = ic.CDataController(connMgr)
18
19 print(f"Getting data of 'main_loop_counter' variable:")
20 value = dataCtrl.evaluate(ic.IConnectDebug.fRealTime, "main_loop_counter")
21 print(f"\tBit size: {value.getBitSize()}")
22 print(f"\tValue (double): {value.getDouble()}")
23 print(f"\tValue (int): {value.getInt()}")
24 print(f"\tValue (str): {value.getResult()}")
25
26 # NOTE: Returned object is `ic.CValueType` object, explore other available methods.
27
28
29if __name__ == "__main__":
30 test_evaluate()