0

I ran the ExampleNamespace sample. I can browse the node and return all the nodes correctly. I can run the client read example okay.

But when I run the client to read value of HelloWorld.Dynamic.Double, it timeout, and the override read function in ExampleNamespace is not called.

// synchronous read request via VariableNode
NodeId nodeId = new NodeId(2, "HellowWorld.Dynamic.Double");

VariableNode node= client.getAddressSpace().createVariableNode(nodeId);

CompletableFuture<DataValue> datavalue = client.readValue(1.0, TimestampsToReturn.Source, nodeId);

DataValue value = datavalue.get();

Did I forget to do anything?

Nkosi
  • 235,767
  • 35
  • 427
  • 472

1 Answers1

0

At the second line of your code, you set an instance for the node variable as VariableNode type by making a call via the client object, which looks correct.

However, you never use the new node variable later. The next line of code still tries to readValue through the same client object. I can recommend you to replace the client with the node variable as follows:

CompletableFuture<DataValue> datavalue = node.readValue(1.0, TimestampsToReturn.Source, nodeId);

A simpler way of making the same read operation might be as follows:

    // synchronous read request via VariableNode object (node)
    VariableNode node = client.getAddressSpace().createVariableNode(nodeId);
    DataValue datavalue = node.readValue().get();
kahveci
  • 1,429
  • 9
  • 23
  • Sinan, thanks for the response... I did the way you suggested.. I still have the timeout and the ExampleNamespace server example still did not call the "read" function... Any other suggestion? – user2996604 Apr 10 '18 at 21:32
  • I also noticed that, there is one extra 'w' character at the first line of your code. Would you check it out? `NodeId nodeId = new NodeId(2, "HellowWorld.Dynamic.Double");` This may lead to instantiate the nodeId object with wrong values. – kahveci Apr 10 '18 at 23:01