I tested "new DataValue(v, StatusCode.GOOD, null)", same error: Bad_TypeMismatch.
------------------------------------------------------------------
发件人:Ari Suutari <Ari.Suutari@xxxxxxxxxxxxxxx>
发送时间:2017年3月30日(星期四) 13:42
收件人:george.ray <george.ray@xxxxxxxxxx>; milo developer discussions <milo-dev@xxxxxxxxxxx>
主 题:RE: [milo-dev] Reply: Write node value error
Hi,
Your code looks ok to me, ie. passing 3000 as short to Variant.
But it might be that kepware doesn’t like passing null statuscode,
try “new DataValue(v, StatusCode.GOOD, null)” instead.
Ari S.
From: milo-dev-bounces@xxxxxxxxxxx [mailto:milo-dev-bounces@xxxxxxxxxxx]
On Behalf Of george.ray
Sent: 30. maaliskuuta 2017 8:32
To: milo developer discussions <milo-dev@xxxxxxxxxxx>; Kevin Herron <kevinherron@xxxxxxxxx>
Subject: [milo-dev] Reply: Write node value error
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.
@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?
------------------------------------------------------------------
发送时间:2017年3月29日(星期三)
23:00
主 题: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.
On Wed, Mar 29, 2017 at 3:30 AM, george.ray <george.ray@xxxxxxxxxx> wrote:
I am testing write node value function by WriteExample, but getting “StatusCode{name=Bad_TypeMismatch, value=0x80740000, quality=bad}” error.
What's the reseason of this issue? Maybe the value type is error, but I don't known how to set the type when writing value.
_______________________________________________
milo-dev mailing list
milo-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/milo-dev