import isystem.connect as ic
winidea_id = ''
def test_readHash():
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)
print(f"Device with index {devIndex} yield a MURMUR2 hash:")
data = ic.VectorBYTE(4)
storageCtrl.readHash(data)
for index in range(4):
print(f"{data[index]} ", end="")
print(f"\nDevice with index {devIndex} yield a MURMUR2 hash (0x08000000, 16 bytes):")
data = ic.VectorBYTE(4)
storageCtrl.readHash(ic.IConnectUMI.wProgDevice, 0x08000000, 16, data)
storageCtrl.readHash(data)
for index in range(4):
print(f"{data[index]} ", end="")
if __name__ == "__main__":
test_readHash()