import isystem.connect as ic
winidea_id = ''
def test_readState():
connMgr = ic.ConnectionMgr()
connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
devName = "ST STM32C0x6 (32 kB)"
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)
print(f"Programed state (0x80000000, 16 bytes):")
data = ic.VectorBYTE(16)
storageCtrl.readState(ic.IConnectUMI.wProgDevice, 0x80000000, 16, data)
for index in range(16):
print(f"\tByte {index}, is programmed: {bool(data[index])}")
if __name__ == "__main__":
test_readState()