10/28/2021
Hello,
I am trying to write a single value in an array of booleans. My code looks as follows:
WriteValueCollection nodesToWrite = new WriteValueCollection();
WriteValue writeVal = new WriteValue();
writeVal.NodeId = new NodeId(nodeID);
writeVal.AttributeId = Attributes.Value;
writeVal.Value = new DataValue(new Variant(true));
writeVal.IndexRange = "1";
nodesToWrite.Add(writeVal);
StatusCodeCollection results = null;
DiagnosticInfoCollection diagnosticInfos;
session.Write(null,
nodesToWrite,
out results,
out diagnosticInfos);
Unfortunately I get a BadWriteNotSupported as a reply. I've tried setting writeVal.Value.Value to the following:
Boolean[] toWrite = { true };
Variant[] toWrite2 = { new Variant(true) };
Boolean[,] toWrite3 = { { true } };
And unfortunately I get the same error. It's possible to write single values by using ua Expert, so I am sure that the server allows writing single values.
I have been able to subscribe to the properties and read them, but not write to them. Any help would be greatly appreciated!
05/30/2017
Servers may not support index writes for every variable (some servers front end other systems which do not support the feature).
A WriteFullArrayOnly bit has been added to the AccessLevel to allow Servers to indicate when writes are not supported:
https://reference.opcfoundatio.....art3/8.58/
For servers that do not support the bit, the BadWriteNotSupported code tells that client that index writes are not supported for the variable.
1 Guest(s)