[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[milo-dev] Problem reading variable value
|
Hello,
I'm writing a Java client to read variable values from a opcua server
that is a gateway to several machines. I can read the values from the
server variables, but not from the machine variables. The machine
variables values allways return null.
The machine variables have ns=2, the server variables have ns=0.
The NodeId for the variable I'm trying to read is created with the
following code:
public static final NodeId CycleCounter = new NodeId(Unsigned.ushort(2),
"47.CycleCounter");
A modified ReadExample program called ReadTest:
@Override
public void run(OpcUaClient client, CompletableFuture<OpcUaClient>
future) throws Exception {
// synchronous connect
client.connect().get();
VariableNode node2 =
client.getAddressSpace().createVariableNode(HuskyIds.CycleCounter);
DataValue value2 = node2.readValue().get();
logger.info("CycleCounter = {} {}",
value2.getValue().getValue(), value2.getStatusCode());
future.complete(client);
}
prints:
[main] INFO org.eclipse.milo.examples.client.ReadTest - CycleCounter =
null StatusCode{name=Good, value=0x00000000, quality=good}
I interpret this log as the server recognizing the variable Id as valid,
but the return value is still null.
The machine variables have ns=2. Is this the problem? If so, How can I
read their values?
Thank you.
Joaquim Torres