import isystem.connect as ic
winidea_id = ''
def test_getLastError():
connMgr = ic.ConnectionMgr()
connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
devName = "ST STM32F4xxxG_1024KB"
optCtrl = ic.COptionController(connMgr, ic.CStorageDeviceFactory.DEVICES_OPT_URL)
devIndex = optCtrl.index_of("Name", devName)
print("Index of the item whose 'Name' attribute has value " + devName + f": {devIndex}")
storageCtrl = ic.CStorageDeviceFactory.makeDevice(connMgr, ic.EStorageDevice_EmbeddedFlashDevice, devIndex)
storageCtrl.write(ic.IConnectUMI.wProgDevice)
error = storageCtrl.getLastError()
if error == "":
print(f"Last UMI operation failed: {error}")
else:
print(f"Last UMI operation succeeded without errors.")
if __name__ == "__main__":
test_getLastError()