i'm trying to retrieve the data from all fields in a plc with opc foundation libray in c#.
For now I managet to obtain only the values and not the rest.
For obtain the values i use this:
session.Read(
null,
0,
TimestampsToReturn.Neither,
nodesToRead,
out results,
out diagnosticInfos);
and in result there are the values, but how can i retrieve the other attributes of the node?
I tried also to look in ocp foundation samples, and I used something like that:
FieldInfo[] fields = typeof(Attributes).GetFields(BindingFlags.Static | BindingFlags.Public);
int num = 0;
string[] array = new string[fields.Length];
FieldInfo[] array2 = fields;
foreach (FieldInfo fieldInfo in array2)
{
array[num++] = fieldInfo.Name;
}
uint[] attributesIds = Attributes.GetIdentifiers();
ILocalNode node = m_session.NodeCache.Find(nodeIds[0]) as ILocalNode;
ItemInfo info = new ItemInfo();
ServiceResult result = node.Read(null, 1, info.Value);
But in this way I obtain only the standard fields and not value of my server.
Thanks in advance!