First of all thanks for this great lib!
I have try to read the Datatype from a OPC UA-Variable using the Nuget Package and the OPC UA Client. My expectation is a datatype string like "Bool", "Int32", "String", etc. but instead of a datatype string i´ve get the nodeId.
I could not find my mistake. Can someone help?
` public (bool Sucess, string Datatype) ReadDatatype(string nodeId)
{
if (client is null)
return (false, "Not Connected");
try
{
string Error = GetIdFromString(nodeId, out NodeId readNodeId);
if (Error != "")
return (false, Error);
var readRes = client.Read(new ReadValueId[]
{
new ReadValueId(readNodeId, NodeAttribute.DataType, null, new QualifiedName(0, null))
}, out DataValue[] dvs);
if (readRes != StatusCode.Good)
return (false, readRes.ToString());
if (dvs[0].Value is null && dvs[0].ServerTimestamp is null && dvs[0].SourceTimestamp is null && dvs[0].StatusCode is null)
return (false, "Read Error - exist NodeId?");
return (true, dvs[0].Value.ToString() ?? "");
}
catch (Exception ex)
{
return (false, $"Error. {ex}");
}
}`
First of all thanks for this great lib! I have try to read the Datatype from a OPC UA-Variable using the Nuget Package and the OPC UA Client. My expectation is a datatype string like "Bool", "Int32", "String", etc. but instead of a datatype string i´ve get the nodeId. I could not find my mistake. Can someone help?
` public (bool Sucess, string Datatype) ReadDatatype(string nodeId) { if (client is null) return (false, "Not Connected");