Opc.Ua.Node.Write C# (CSharp) Method

Write() public method

Writes the value of an attribute.
public Write ( uint attributeId, Opc.Ua.DataValue value ) : ServiceResult
attributeId uint The attribute id.
value Opc.Ua.DataValue The value.
return ServiceResult
        public ServiceResult Write(uint attributeId, DataValue value)
        {
            if (!SupportsAttribute(attributeId))
            {
                return StatusCodes.BadAttributeIdInvalid;
            }
            
            // check for read only attributes.
            switch (attributeId)
            {
                case Attributes.NodeId:
                case Attributes.NodeClass:
                {
                    return StatusCodes.BadNotWritable;
                }
            }

            // check data type.
            if (attributeId != Attributes.Value)
            {
                if (Attributes.GetDataTypeId(attributeId) != TypeInfo.GetDataTypeId(value))
                {
                    return StatusCodes.BadTypeMismatch;
                }
            }

            return Write(attributeId, value.Value);
        }
        #endregion

Same methods

Node::Write ( uint attributeId, object value ) : ServiceResult