I can't seem to figure this one out:
Before writing to a tag I need to know what data type it is expecting(the value that mywrite function receives is always a string).
I realise you have to read the datatype from the server and here's my code to do so, but I'm at a loss as to how to use the information returned:
var nodesToRead = BuildReadValueIdCollection(node.DisplayName, Attributes.DataType);
DataValueCollection readResults;
DiagnosticInfoCollection diag;
_session.Read(
requestHeader: null,
maxAge: 0,
timestampsToReturn: TimestampsToReturn.Neither,
nodesToRead: nodesToRead,
results: out readResults,
diagnosticInfos: out diag);
var val = readResults[0];
What do I do with val
to determine what the datatype is?
Do I use Val.Value
or Val.WrappedValue
or Val.WrappedValue.Value
(whatever the difference is ?)
The tag I've been using to test has returned Val = "i=6".....
What is this referring to?
What datatype is "6" and
how do I convert val to something I can use.
Any help would be greatly appreciated.
Thanks