FreeOpcUa / opcua-client-gui

OPC-UA GUI Client
GNU General Public License v3.0
534 stars 176 forks source link

Can't add Variable to graph #85

Open Lifbully opened 2 years ago

Lifbully commented 2 years ago

Hi I'm trying to add a changing INT32 type variable to the server and watch the data change on the client side. I can see the variable change by subscribing to the data change, but I can't add it to the graph. When I use the add to graph function it shows nothing. Can anyone tell me why? Variables are defined here:

c1Attr.displayName = UA_LOCALIZEDTEXT(const_cast<char*> ("en-US"), const_cast<char*> ("c1 - current value"));
c1Attr.accessLevel = UA_ACCESSLEVELMASK_READ | UA_ACCESSLEVELMASK_WRITE;
UA_Variant_setScalar(&c1Attr.value, &c1, &UA_TYPES[UA_TYPES_INT32]);

UA_NodeId currentNodeId = UA_NODEID_STRING(1, const_cast<char*>("current c1 value callback"));
UA_QualifiedName currentName = UA_QUALIFIEDNAME(1, const_cast<char*>("current c1 value callback"));
UA_NodeId parentReferenceNodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_ORGANIZES);
UA_NodeId variableTypeNodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE);

UA_Server_addVariableNode(server, currentNodeId, Library_versionId,
    parentReferenceNodeId,
    currentName,
    variableTypeNodeId, c1Attr, NULL, NULL);