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

ReadAttribute() protected method

Reads an attribute for the node.
protected ReadAttribute ( IOperationContext context, uint attributeId, DataValue value ) : ServiceResult
context IOperationContext
attributeId uint
value DataValue
return ServiceResult
        protected virtual ServiceResult ReadAttribute(IOperationContext context, uint attributeId, DataValue value)
        {
            IList<string> locales = null;

            if (context != null)
            {
                locales = context.PreferredLocales;
            }

            switch (attributeId)
            {
                case Attributes.NodeId:
                {
                    value.Value = NodeId;
                    break;
                }

                case Attributes.NodeClass:
                {
                    value.Value = NodeClass;
                    break;
                }

                case Attributes.BrowseName:
                {
                    value.Value = BrowseName;
                    break;
                }

                case Attributes.DisplayName:
                {
                    value.Value = ResourceManager.Translate(locales, DisplayName);
                    break;
                }

                case Attributes.Description:
                {
                    value.Value = ResourceManager.Translate(locales, DisplayName);
                    break;
                }

                case Attributes.WriteMask:
                {
                    value.Value = (uint)WriteMask;
                    break;
                }

                case Attributes.UserWriteMask:
                {
                    value.Value = (uint)UserWriteMask;
                    break;
                }

                default:
                {
                    return StatusCodes.BadAttributeIdInvalid;
                }
            }

            return ServiceResult.Good;
        }