winIDEA SDK
Loading...
Searching...
No Matches
test_storage_get_device_index.py
# This script is licensed under BSD License, see file LICENSE.txt, or search for `License` in the SDK online help.
#
# (c) TASKING Germany GmbH, 2023
"""
Uses Option Contoller to find index
"""
winidea_id = ''
import isystem.connect as ic
def test_getDeviceIndex():
connMgr = ic.ConnectionMgr()
connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
devName = "eMMCtest"
optCtrl = ic.COptionController(connMgr, ic.CStorageDeviceFactory.DEVICES_OPT_URL)
index = optCtrl.index_of("Name", devName)
print(f"Device with name {devName} index: {index}")
index = optCtrl.index_of("Name",'unknown device')
print(f"Device with name 'unknown device', does not exist, exception not raised: {index}")
if __name__ == "__main__":
test_getDeviceIndex()