I modified WriteExample.java, and wrote node value through KEP Server.
In KEP Server the node data type is Word, value is 2500, I want to modify the value to 3000.
This is the souce code :
@Override
public void run(OpcUaClient client, CompletableFuture<OpcUaClient> future) throws Exception {
// synchronous connect
client.connect().get();
List<NodeId> nodeIds = ImmutableList.of(new NodeId(2, "ChannelTest.DeviceTest.Tag190"));
Variant v = new Variant((short)3000);
DataValue dv = new DataValue(v, null, null);
CompletableFuture<StatusCode> f = client.writeValue(nodeIds.get(0), dv);
StatusCode status = f.get();
if (status.isGood()) {
logger.info("Wrote '{}' to nodeId={} success", v, nodeIds.get(0));
}
else
logger.info("Wrote '{}' to nodeId={} failed", v, nodeIds.get(0));
future.complete(client);
}
How to set values type in Eclipse Milo when writing Node?
------------------------------------------------------------------
发件人:Kevin Herron <kevinherron@xxxxxxxxx>
发送时间:2017年3月29日(星期三) 23:00
收件人:george.ray <george.ray@xxxxxxxxxx>; milo developer discussions <milo-dev@xxxxxxxxxxx>
主 题:Re: [milo-dev] Write node value error
If you post your code I could tell you more, but OPC UA requires that you write values of the correct type for the Node you're writing to.