winIDEA SDK
test_storage_get_device_index.py
1# This script is licensed under BSD License, see file LICENSE.txt.
2#
3# (c) TASKING Germany GmbH, 2023
4
5"""
6Uses Option Contoller to find index
7"""
8
9winidea_id = ''
10
11import isystem.connect as ic
12
13
14def test_getDeviceIndex():
15 connMgr = ic.ConnectionMgr()
16 connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
17 devName = "eMMCtest"
18 optCtrl = ic.COptionController(connMgr, ic.CStorageDeviceFactory.DEVICES_OPT_URL)
19
20 index = optCtrl.index_of("Name", devName)
21 print(f"Device with name {devName} index: {index}")
22
23 index = optCtrl.index_of("Name",'unknown device')
24 print(f"Device with name 'unknown device', does not exist, exception not raised: {index}")
25
26
27if __name__ == "__main__":
28 test_getDeviceIndex()