Find all devices

 1'''
 2Find_devices - find_all_devices.py with synchronous mode.
 3
 4This example demonstrates how to find all available USB and ethernet devices.
 5
 6For other examples please check:
 7    https://github.com/WPC-Systems-Ltd/WPC_Python_driver_release/tree/main/examples
 8See README.md file to get detailed usage of this example.
 9
10Copyright (c) 2022-2025 WPC Systems Ltd. All rights reserved.
11'''
12
13## WPC
14from wpcsys import pywpc
15
16
17def main():
18    ## Get Python driver version
19    print(f'{pywpc.PKG_FULL_NAME} - Version {pywpc.__version__}')
20
21    ## Create device handle
22    dev = pywpc.DeviceFinder()
23
24    ## Connect to device
25    dev.connect()
26
27    ## Perform USB device information
28    print("Find all USB devices....")
29    try:
30        dev_2d_list = dev.Bcst_enumerateUSBDevices()
31        for device_list in dev_2d_list:
32            print(device_list)
33    except Exception as err:
34        pywpc.printGenericError(err)
35
36    ## Perform network device information
37    print("Find all network devices....")
38    try:
39        dev_2d_list = dev.Bcst_enumerateNetworkDevices()
40        for device_list in dev_2d_list:
41            print(device_list)
42    except Exception as err:
43        pywpc.printGenericError(err)
44
45    finally:
46        ## Disconnect device
47        dev.disconnect()
48
49        ## Release device handle
50        dev.close()
51
52
53if __name__ == '__main__':
54    main()