public int ReadMaxAge(int[] serverHandles, IList <TimeSpan> maxAge, int transactionId, out HRESULT[] errors) { int[] intMaxAge = ArrayHelpers.CreateMaxAgeArray(maxAge, maxAge.Count); var _errors = new HRESULT[serverHandles.Length]; int result = DoComCall(ComObject, "IOpcAsyncIO3::ReadMaxAge", () => { int dwCancelId; ComObject.ReadMaxAge(serverHandles.Length, serverHandles, intMaxAge, transactionId, out dwCancelId, out _errors); return(dwCancelId); }, serverHandles, maxAge, transactionId); errors = _errors; return(result); }
public TimeSpan[] SetItemSamplingRate( int[] serverHandles, TimeSpan[] requestedSamplingRate, out HRESULT[] errors) { throw new NotImplementedException(); int[] pdwRequestedSamplingRate = ArrayHelpers.CreateMaxAgeArray(requestedSamplingRate, requestedSamplingRate.Length); IntPtr ppdwRevisedSamplingRate; IntPtr ppErrors; ComObject.SetItemSamplingRate(serverHandles.Length, serverHandles, pdwRequestedSamplingRate, out ppdwRevisedSamplingRate, out ppErrors); return(null); }
public OpcDaVQTE[] Read(IList <string> itemIds, IList <TimeSpan> maxAge) { if (maxAge == null) { maxAge = new TimeSpan[itemIds.Count]; } if (itemIds.Count != maxAge.Count) { throw new ArgumentException("Invalid size of maxAge", "maxAge"); } int[] intMaxAge = ArrayHelpers.CreateMaxAgeArray(maxAge, itemIds.Count); string[] pszItemIDs = itemIds.ToArray(); var ppvValues = new object[pszItemIDs.Length]; var ppwQualities = new short[pszItemIDs.Length]; var ppftTimeStamps = new FILETIME[pszItemIDs.Length]; var ppErrors = new HRESULT[pszItemIDs.Length]; DoComCall(ComObject, "IOPCItemIO::Read", () => ComObject.Read(pszItemIDs.Length, pszItemIDs, intMaxAge, out ppvValues, out ppwQualities, out ppftTimeStamps, out ppErrors), pszItemIDs.Length, pszItemIDs, maxAge); var result = new OpcDaVQTE[itemIds.Count]; for (int i = 0; i < ppvValues.Length; i++) { var vqte = new OpcDaVQTE { Value = ppvValues[i], Quality = ppwQualities[i], Timestamp = FileTimeConverter.FromFileTime(ppftTimeStamps[i]), Error = ppErrors[i] }; result[i] = vqte; } return(result); }
public object[] ReadMaxAge(int[] serverHandles, IList <TimeSpan> maxAge, out OpcDaQuality[] qualities, out DateTimeOffset[] timestamps, out HRESULT[] errors) { int[] intMaxAge = ArrayHelpers.CreateMaxAgeArray(maxAge, maxAge.Count); object[] ppvValues = {}; short[] ppwQualities = {}; FILETIME[] ppftTimeStamps = {}; HRESULT[] _errors = {}; DoComCall(ComObject, "IOpcSyncIO2::ReadMaxAge", () => ComObject.ReadMaxAge(serverHandles.Length, serverHandles, intMaxAge, out ppvValues, out ppwQualities, out ppftTimeStamps, out _errors), serverHandles.Length, serverHandles, intMaxAge); timestamps = new DateTimeOffset[ppftTimeStamps.Length]; qualities = new OpcDaQuality[ppwQualities.Length]; for (int i = 0; i < timestamps.Length; i++) { timestamps[i] = FileTimeConverter.FromFileTime(ppftTimeStamps[i]); qualities[i] = new OpcDaQuality(ppwQualities[i]); } errors = _errors; return(ppvValues); }