winIDEA SDK
test_conn_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
6import subprocess
7import time
8
9TIMEOUT_S = 15
10POLL_INTERVAL_S = 0.5
11
12
13def test_isConnected():
14 print("Connecting...")
15 cfg = ic.CConnectionConfig()
16 cfg.start_always()
17 conn_mgr = ic.ConnectionMgr()
18
19 conn_mgr.connect(cfg)
20
21 print(f"\tIs connected: {conn_mgr.isConnected()}")
22
23 print("Disconnecting...")
24 conn_mgr.disconnect_close(bSaveAll=False)
25 print(f"\tIs connected: {conn_mgr.isConnected()}")
26
27 # NOTE: 'isConnected()' will return False until 'disconnect()' is called, regardless of
28 # actual winIDEA state (might be closed before).
29
30
31if __name__ == "__main__":
32 test_isConnected()