diff --git a/OPC_UA_Clients/Release2/IJT_Web_Client/Javascripts/Views/AddressSpace/AddressSpaceGraphics.mjs b/OPC_UA_Clients/Release2/IJT_Web_Client/Javascripts/Views/AddressSpace/AddressSpaceGraphics.mjs index 1510266..a7bb5e4 100644 --- a/OPC_UA_Clients/Release2/IJT_Web_Client/Javascripts/Views/AddressSpace/AddressSpaceGraphics.mjs +++ b/OPC_UA_Clients/Release2/IJT_Web_Client/Javascripts/Views/AddressSpace/AddressSpaceGraphics.mjs @@ -177,7 +177,7 @@ export default class AddressSpaceGraphics extends ControlMessageSplitScreen { const enumRelation = node.getNamedRelation('EnumStrings') if (enumRelation) { - this.addressSpace.relationsToNodes([enumRelation]).then((enumNodeList)=> { + this.addressSpace.relationsToNodes([enumRelation]).then((enumNodeList) => { const nameList = enumNodeList[0].value const index = parseInt(this.nodeValueToText(node.data.value)) const value = nameList[index] diff --git a/OPC_UA_Clients/Release2/IJT_Web_Client/Python/CallStructure.py b/OPC_UA_Clients/Release2/IJT_Web_Client/Python/CallStructure.py new file mode 100644 index 0000000..7a5f540 --- /dev/null +++ b/OPC_UA_Clients/Release2/IJT_Web_Client/Python/CallStructure.py @@ -0,0 +1,41 @@ +from asyncua import ua + +def createCallStructure(argument): + """ + This function creates the input call structures + """ + + value = argument["value"] + print(value) + inp = 0 + + match argument["dataType"]: + case 3029: + inp = ua.JoiningProcessIdentificationDataType() + arg0 = value[0] + inp.JoiningProcessId = arg0["value"] + arg1 = value[1] + inp.JoiningProcessOriginId = arg1["value"] + arg2 = value[2] + inp.SelectionName = arg2["value"] + case 3010: + lst = [] + + for row in value: + entityRow = row['value'] + entity = ua.EntityDataType() + entity.Name = entityRow["Name"] + entity.Description = entityRow["Description"] + entity.EntityId = entityRow["EntityId"] + entity.EntityOriginId = entityRow["EntityOriginId"] + entity.IsExternal = entityRow["IsExternal"] + entity.EntityType = entityRow["EntityType"] + + lst.append(entity) + + inp = ua.Variant(lst, ua.VariantType.ExtensionObject) + print(inp.__dict__) + case _: + inp = ua.Variant(value, ua.VariantType(argument["dataType"])) + + return inp diff --git a/OPC_UA_Clients/Release2/IJT_Web_Client/Python/Connection.py b/OPC_UA_Clients/Release2/IJT_Web_Client/Python/Connection.py index 4fcd0b1..7e5c64a 100644 --- a/OPC_UA_Clients/Release2/IJT_Web_Client/Python/Connection.py +++ b/OPC_UA_Clients/Release2/IJT_Web_Client/Python/Connection.py @@ -1,10 +1,7 @@ - - - from asyncua import Client, ua -# from opcua.ua import EventFilter, SimpleAttributeOperand, ContentFilter, FilterOperator, ContentFilterElement import asyncio from Python.Serialize import serializeTuple, serializeValue +from Python.CallStructure import createCallStructure import json from threading import Thread #from IPython import embed @@ -255,23 +252,16 @@ async def methodcall(self, data): attrList.append(method) for argument in arguments: - value = argument["value"] - if argument["dataType"] == 3029: - inp = ua.JoiningProcessIdentificationDataType() - arg0 = value[0] - inp.JoiningProcessId = arg0["value"] - arg1 = value[1] - inp.JoiningProcessOriginId = arg1["value"] - arg2 = value[2] - inp.SelectionName = arg2["value"] - else: - inp = ua.Variant(value, ua.VariantType(argument["dataType"])) - attrList.append(inp) + input = createCallStructure(argument) + attrList.append(input) + print(1) methodRepr = getattr(obj, "call_method") + print(2) out = await methodRepr(*attrList) # call the method and get the output + print(3) - #print(serializeValue(out)) + print(serializeValue(out)) return { "output" : serializeValue(out) } diff --git a/OPC_UA_Clients/Release2/IJT_Web_Client/Resources/connectionpoints.json b/OPC_UA_Clients/Release2/IJT_Web_Client/Resources/connectionpoints.json index 1f11703..b2e7539 100644 --- a/OPC_UA_Clients/Release2/IJT_Web_Client/Resources/connectionpoints.json +++ b/OPC_UA_Clients/Release2/IJT_Web_Client/Resources/connectionpoints.json @@ -1 +1 @@ -{"connectionpoints": [{"name": "Local", "address": "opc.tcp://127.0.0.1:40451", "autoconnect": false}, {"name": "Windows simulation", "address": "opc.tcp://10.46.19.106:40451", "autoconnect": false}, {"name": "ICB-A", "address": "opc.tcp://10.46.16.68:40451", "autoconnect": true}, {"name": "PF8", "address": "opc.tcp://10.46.16.174:40451", "autoconnect": true}, {"name": "Pf8Demo", "address": "opc.tcp://192.168.1.1:40451", "autoconnect": false}], "command": "set connectionpoints", "endpoint": "common"} \ No newline at end of file +{"connectionpoints": [{"name": "Local", "address": "opc.tcp://127.0.0.1:40451", "autoconnect": false}, {"name": "Windows simulation", "address": "opc.tcp://10.46.19.106:40451", "autoconnect": false}, {"name": "ICB-A", "address": "opc.tcp://10.46.16.68:40451", "autoconnect": false}, {"name": "PF8", "address": "opc.tcp://10.46.16.174:40451", "autoconnect": true}, {"name": "Pf8Demo", "address": "opc.tcp://192.168.1.1:40451", "autoconnect": false}], "command": "set connectionpoints", "endpoint": "common"} \ No newline at end of file