Browse Source

Serverside method 'ping' was wrongly referenced as being 'organizes' by its parent object 'Objects' (not hasProperty), which prevented it from being called.

ichrispa 10 years ago
parent
commit
c662814c8a
2 changed files with 7 additions and 2 deletions
  1. 6 1
      examples/client.c
  2. 1 1
      examples/server.c

+ 6 - 1
examples/client.c

@@ -5,12 +5,12 @@
 # include "networklayer_tcp.h"
 # include "logger_stdout.h"
 # include "ua_types_encoding_binary.h"
+#include "ua_nodes.h"
 #else
 # include "open62541.h"
 # include <string.h>
 # include <stdlib.h>
 #endif
-
 #include <stdio.h>
 
 void handler_TheAnswerChanged(UA_UInt32 handle, UA_DataValue *value);
@@ -243,8 +243,13 @@ int main(int argc, char *argv[]) {
     free(theValue);
     /* Done creating a new node*/
 #endif
+    // Iterate over all nodes in 'Objects'
     UA_Client_forEachChildNodeCall(client, UA_NODEID_NUMERIC(0, UA_NS0ID_OBJECTSFOLDER), nodeIter);
     
+    // Get a copy of the node 'TheNewVariableNode'
+    void *theCopy;
+    UA_Client_getNodeCopy(client, retNodeId, (void*) &theCopy);
+    
     UA_Client_disconnect(client);
     UA_Client_delete(client);
     return UA_STATUSCODE_GOOD;

+ 1 - 1
examples/server.c

@@ -345,7 +345,7 @@ int main(int argc, char** argv) {
 
   UA_NodeId methodId; // Retrieve the actual ID if this node if a random id as in UA_NODEID_NUMERIC(1,0) is used
   UA_Server_addMethodNode(server, UA_QUALIFIEDNAME(1,"ping"), UA_NODEID_NUMERIC(1,62541),
-                          UA_EXPANDEDNODEID_NUMERIC(0, UA_NS0ID_OBJECTSFOLDER), UA_NODEID_NUMERIC(0, UA_NS0ID_ORGANIZES),
+                          UA_EXPANDEDNODEID_NUMERIC(0, UA_NS0ID_OBJECTSFOLDER), UA_NODEID_NUMERIC(0, UA_NS0ID_HASCOMPONENT),
                           &getMonitoredItems, 1, &inputArguments, 1, &outputArguments, &methodId);
 #endif