Пример #1
0
        /// <summary>
        ///     Asynchronously writes one or more values, qualities and timestamps for the items specified. If a client attempts to
        ///     write VQ, VT, or VQT it should expect that the server will write them all or none at all.
        /// </summary>
        /// <param name="items">The group items.</param>
        /// <param name="values">The list of values, qualities and timestamps.</param>
        /// <param name="token">The task cancellation token.</param>
        /// <returns>
        ///     Array of HRESULTs indicating the success of the individual item Writes.
        /// </returns>
        public Task <HRESULT[]> WriteVQTAsync(IList <OpcDaItem> items, IList <OpcDaVQT> values,
                                              CancellationToken token)
        {
            CheckItems(items);
            CheckSupported(OpcDaGroupFeatures.WriteVQTAsync);

            var request = new WriteVQTAsyncRequest(As <OpcAsyncIO3>());

            _asyncRequestManager.AddRequest(request);
            OPCITEMVQT[] vqts = ArrayHelpers.CreateOpcItemVQT(values);
            return(request.Start(items, vqts, token));
        }
Пример #2
0
        /// <summary>
        ///     Writes one or more values, qualities and timestamps for the items specified. If a client attempts to write VQ, VT,
        ///     or VQT it should expect that the server will write them all or none at all.
        /// </summary>
        /// <param name="items">The group items.</param>
        /// <param name="values">The list of values, qualities and timestamps.</param>
        /// <returns>
        ///     Array of HRESULTs indicating the success of the individual item Writes.
        /// </returns>
        /// <exception cref="System.ArgumentException">Invalid size of values;values</exception>
        public HRESULT[] WriteVQT(IList <OpcDaItem> items, IList <OpcDaVQT> values)
        {
            CheckSupported(OpcDaGroupFeatures.WriteVQT);
            CheckItems(items);
            int[] serverHandles = ArrayHelpers.GetServerHandles(items);

            if (serverHandles.Length != values.Count)
            {
                throw new ArgumentException("Invalid size of values", "values");
            }

            OPCITEMVQT[] vqts = ArrayHelpers.CreateOpcItemVQT(values);
            return(As <OpcSyncIO2>().WriteVQT(serverHandles, vqts));
        }