winIDEA SDK
test_is_connected.py
1# This script is licensed under BSD License, see file LICENSE.txt.
2#
3# (c) TASKING Germany GmbH, 2023
4
5import isystem.connect as ic
6
7
8winidea_id = ''
9
10
11def test_isConnected():
12 connMgr = ic.ConnectionMgr()
13 connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
14
15 mConnMgr = ic.CMulticoreConnectionMgr()
16 print(f"Is primary core connected? {mConnMgr.isConnected('')}")
17
18 print("Creating connection to the primary winIDEA...")
19 logParams = ic.StrVector()
20 wksFilePath = ic.CIDEController(connMgr).getPath(ic.CIDEController.WORKSPACE_FILE_NAME)
21 mConnMgr.connectPrimaryCore(logParams, wksFilePath, False, "", "")
22 print(f"\tIs primary core connected? {mConnMgr.isConnected('')}")
23
24 print("Creating connection to secondary core (ID: 'SDK_TESTS_DEMO_CORE1')...")
25 sConnMgr = mConnMgr.connectCore(1, "SDK_TESTS_DEMO_CORE1")
26 print(f"\tIs secondary core connected? {mConnMgr.isConnected('SDK_TESTS_DEMO_CORE1')}")
27
28 print("Closing secondary core...")
29 sConnMgr.disconnect_close(bSaveAll=False)
30
31
32if __name__ == "__main__":
33 test_isConnected()