import isystem.connect as ic
winidea_id = ''
def test_readWriteValue():
connMgr = ic.ConnectionMgr()
connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
dataCtrl = ic.CDataController(connMgr)
addCtrl = ic.CAddressController(connMgr)
address = addCtrl.getVariableAddress("mainLoopCounter").getAddress()
print(f"Writing value '{42}' to address: '{hex(address)}'...")
valType = ic.SType()
valType.m_byType = ic.SType.tUnsigned
valType.m_byBitSize = 32
cVal = ic.CValueType(valType, 42)
dataCtrl.writeValue(ic.IConnectDebug.fRealTime,
ic.maPhysicalTriCore,
address,
cVal)
print(f"Reading back value...")
value = dataCtrl.readValue(ic.IConnectDebug.fRealTime,
ic.maPhysicalTriCore,
address,
valType)
print(f"\tValue: '{value.getInt()}'")
print(f"Alternatively, value can be written without updating winIDEA GUI (faster method)...")
dataCtrl.writeValue(ic.IConnectDebug.fRealTime,
False,
ic.maPhysicalTriCore,
address,
cVal)
if __name__ == "__main__":
test_readWriteValue()