Opc.Ua.Server.NodeSource.Write C# (CSharp) Method

Write() public method

public Write ( uint attributeId, DataValue value ) : ServiceResult
attributeId uint
value DataValue
return ServiceResult
        public ServiceResult Write(uint attributeId, DataValue value)
        {
            lock (DataLock)
            {
                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;
                    }
                }

                // write value.
                return WriteAttribute(attributeId, value);
            }
        }
        #endregion