/// <summary> /// Reads the specified group items. /// </summary> /// <param name="items">The group items.</param> /// <param name="dataSource">The data source.</param> /// <returns> /// The values of the group items. /// </returns> public OpcDaItemValue[] Read(IList <OpcDaItem> items, OpcDaDataSource dataSource = OpcDaDataSource.Cache) { CheckItems(items); CheckSupported(OpcDaGroupFeatures.Read); int[] serverHandles = ArrayHelpers.GetServerHandles(items); HRESULT[] ppErrors; OPCITEMSTATE[] ppItemValues = As <OpcSyncIO>().Read((OPCDATASOURCE)dataSource, serverHandles, out ppErrors); OpcDaItemValue[] result = OpcDaItemValue.Create(this, ppItemValues, ppErrors); OnValuesChanged(new OpcDaItemValuesChangedEventArgs(result)); return(result); }
/// <summary> /// Reads the specified group items using MaxAge. If the information in the cache is within the MaxAge, then the data /// will be obtained from the cache, otherwise the server must access the device for the requested information. /// </summary> /// <param name="items">The group items.</param> /// <param name="maxAge">The list of MaxAges for the group items.</param> /// <returns> /// The values of the group items. /// </returns> /// <exception cref="System.ArgumentException">Invalid size of maxAge;maxAge</exception> public OpcDaItemValue[] ReadMaxAge(IList <OpcDaItem> items, IList <TimeSpan> maxAge) { CheckSupported(OpcDaGroupFeatures.ReadMaxAge); CheckItems(items); int[] serverHandles = ArrayHelpers.GetServerHandles(items); if (serverHandles.Length != maxAge.Count) { throw new ArgumentException("Invalid size of maxAge", "maxAge"); } // int[] intMaxAge = ArrayHelpers.CreateMaxAgeArray(maxAge, items.Count); DateTimeOffset[] timestamps; HRESULT[] errors; OpcDaQuality[] qualities; object[] ppvValues = As <OpcSyncIO2>() .ReadMaxAge(serverHandles, maxAge, out qualities, out timestamps, out errors); OpcDaItemValue[] result = OpcDaItemValue.Create(items, ppvValues, qualities, timestamps, errors); OnValuesChanged(new OpcDaItemValuesChangedEventArgs(result)); return(result); }