"""
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()