internal OpcDaItem(OpcDaItemDefinition itemDefinition, OPCITEMRESULT itemResult, OpcDaGroup @group) { Group = @group; ClientHandle = 0; ServerHandle = itemResult.hServer; ItemId = itemDefinition.ItemId; RequestedDataType = itemDefinition.RequestedDataType; CanonicalDataType = TypeConverter.FromVarEnum((VarEnum) itemResult.vtCanonicalDataType); Blob = itemResult.pBlob; AccessPath = itemDefinition.AccessPath; IsActive = itemDefinition.IsActive; AccessRights = (OpcDaAccessRights) itemResult.dwAccessRights; }
public static OPCITEMRESULT[] CreateOpcItemResults(OPCITEMDEF[] pItemArray, IntPtr ppAddResults) { var results = new OPCITEMRESULT[pItemArray.Length]; for (int i = 0; i < pItemArray.Length; i++) { IntPtr current = ppAddResults + i*Marshal.SizeOf(typeof (OPCITEMRESULT)); results[i] = (OPCITEMRESULT) Marshal.PtrToStructure(current, typeof (OPCITEMRESULT)); Marshal.DestroyStructure(current, typeof (OPCITEMRESULT)); Marshal.FreeCoTaskMem(pItemArray[i].pBlob); // Delete allocated blobs } return results; }