/// <summary>
        /// Writes a list of Node attributes.
        /// </summary>
        /// <param name="client">A instance of <see cref="ISessionClient"/>.</param>
        /// <param name="request">A <see cref="WriteRequest"/>.</param>
        /// <returns>A <see cref="Task"/> representing the asynchronous operation that returns a <see cref="WriteResponse"/>.</returns>
        public static async Task<WriteResponse> WriteAsync(this ISessionClient client, WriteRequest request)
        {
            if (request == null)
            {
                throw new ArgumentNullException("request");
            }

            return (WriteResponse)await client.RequestAsync(request).ConfigureAwait(false);
        }
Beispiel #2
0
        public async Task WriteBool(string name, bool value)
        {
            var writeRequest = new Workstation.ServiceModel.Ua.WriteRequest
            {
                NodesToWrite = new[]
                {
                    new Workstation.ServiceModel.Ua.WriteValue
                    {
                        NodeId      = Workstation.ServiceModel.Ua.NodeId.Parse("ns=4;s=|var|" + serverName + "." + name),
                        AttributeId = AttributeIds.Value,
                        Value       = new Workstation.ServiceModel.Ua.DataValue(value)
                    }
                }
            };

            try
            {
                var writeResult = await channel.WriteAsync(writeRequest);
            }
            catch (Exception ex)
            { }
        }