1'''
2Find_devices - find_network_devices_blink.py with synchronous mode.
3
4This example demonstrates how to find ethernet devices and blink.
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-2024 WPC Systems Ltd. All rights reserved.
11'''
12
13## Python
14import time
15
16## WPC
17
18from wpcsys import pywpc
19
20def main():
21 ## Get Python driver version
22 print(f'{pywpc.PKG_FULL_NAME} - Version {pywpc.__version__}')
23
24 ## Create device handle
25 dev = pywpc.DeviceFinder()
26
27 ## Connect to device
28 dev.connect()
29
30 ## Perform network device information
31 print("Find all network devices....")
32 try:
33 dev_2d_list = dev.Bcst_enumerateNetworkDevices()
34 for device_list in dev_2d_list:
35 print(device_list)
36 mac_num = device_list[2]
37
38 ## Check MAC and let LED blink
39 err = dev.Bcst_checkMACAndRing(mac_num)
40 print(f"Bcst_checkMACAndRing, status: {err}")
41
42 except Exception as err:
43 pywpc.printGenericError(err)
44
45 ## Disconnect to device
46 dev.disconnect()
47
48 ## Release device handle
49 dev.close()
50
51 return
52
53if __name__ == '__main__':
54 main()