ConstructIdForHdaItem() public static method

Constructs the node id for an item.
public static ConstructIdForHdaItem ( string itemId, ushort namespaceIndex ) : Opc.Ua.NodeId
itemId string The item id.
namespaceIndex ushort Index of the namespace.
return Opc.Ua.NodeId
Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DaItemState"/> class.
        /// </summary>
        /// <param name="itemId">The item id.</param>
        /// <param name="name">The name.</param>
        /// <param name="namespaceIndex">Index of the namespace.</param>
        public HdaItemState(
            string itemId,
            string name,
            ushort namespaceIndex)
            :
            base(null)
        {
            m_itemId = itemId;

            if (String.IsNullOrEmpty(name))
            {
                name = itemId;
            }

            this.NodeId                  = HdaModelUtils.ConstructIdForHdaItem(itemId, namespaceIndex);
            this.BrowseName              = new QualifiedName(name, namespaceIndex);
            this.DisplayName             = new LocalizedText(name);
            this.TypeDefinitionId        = Opc.Ua.VariableTypeIds.DataItemType;
            this.Description             = null;
            this.WriteMask               = 0;
            this.UserWriteMask           = 0;
            this.DataType                = DataTypeIds.BaseDataType;
            this.ValueRank               = ValueRanks.Any;
            this.Historizing             = false;
            this.MinimumSamplingInterval = MinimumSamplingIntervals.Indeterminate;
            this.AccessLevel             = AccessLevels.HistoryRead;
            this.UserAccessLevel         = AccessLevels.HistoryRead;
        }
Beispiel #2
0
        /// <summary>
        /// Gets the item annotations node.
        /// </summary>
        /// <param name="itemId">The item id.</param>
        /// <param name="namespaceIndex">Index of the namespace.</param>
        /// <returns></returns>
        public static PropertyState GetItemAnnotationsNode(string itemId, ushort namespaceIndex)
        {
            if (itemId == null)
            {
                return(null);
            }

            PropertyState component = new PropertyState(null);

            component.NodeId                  = HdaParsedNodeId.Construct(HdaModelUtils.HdaItemAnnotations, itemId, null, namespaceIndex);
            component.SymbolicName            = Opc.Ua.BrowseNames.Annotations;
            component.BrowseName              = new QualifiedName(component.SymbolicName);
            component.DisplayName             = component.BrowseName.Name;
            component.DataType                = DataTypeIds.Annotation;
            component.ValueRank               = ValueRanks.Scalar;
            component.MinimumSamplingInterval = MinimumSamplingIntervals.Indeterminate;
            component.Historizing             = false;
            component.AccessLevel             = AccessLevels.HistoryRead;
            component.UserAccessLevel         = AccessLevels.HistoryRead;
            component.ReferenceTypeId         = Opc.Ua.ReferenceTypeIds.HasProperty;
            component.TypeDefinitionId        = Opc.Ua.VariableTypeIds.PropertyType;

            component.AddReference(ReferenceTypeIds.HasProperty, true, HdaModelUtils.ConstructIdForHdaItem(itemId, namespaceIndex));

            return(component);
        }
Beispiel #3
0
        /// <summary>
        /// Gets the item configuration node.
        /// </summary>
        /// <param name="itemId">The item id.</param>
        /// <param name="namespaceIndex">Index of the namespace.</param>
        /// <returns></returns>
        public static BaseInstanceState GetItemConfigurationNode(string itemId, ushort namespaceIndex)
        {
            if (itemId == null)
            {
                return(null);
            }

            FolderState component = new FolderState(null);

            component.NodeId           = HdaParsedNodeId.Construct(HdaModelUtils.HdaItemConfiguration, itemId, null, namespaceIndex);
            component.SymbolicName     = Opc.Ua.BrowseNames.HAConfiguration;
            component.BrowseName       = new QualifiedName(component.SymbolicName);
            component.DisplayName      = component.BrowseName.Name;
            component.ReferenceTypeId  = Opc.Ua.ReferenceTypeIds.HasComponent;
            component.TypeDefinitionId = Opc.Ua.ObjectTypeIds.HistoricalDataConfigurationType;
            component.EventNotifier    = EventNotifiers.None;

            component.AddReference(ReferenceTypeIds.HasHistoricalConfiguration, true, HdaModelUtils.ConstructIdForHdaItem(itemId, namespaceIndex));
            component.AddReference(ReferenceTypeIds.HasComponent, false, HdaModelUtils.ConstructIdForInternalNode(Opc.Ua.BrowseNames.AggregateConfiguration, namespaceIndex));

            return(component);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="DaItemState"/> class.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <param name="itemId">The item id.</param>
        /// <param name="attribute">The attribute.</param>
        /// <param name="namespaceIndex">Index of the namespace.</param>
        public HdaAttributeState(
            ComHdaClientConfiguration configuration,
            string itemId,
            HdaAttribute attribute,
            ushort namespaceIndex)
            :
            base(null)
        {
            m_itemId    = itemId;
            m_attribute = attribute;

            this.NodeId                  = HdaModelUtils.ConstructIdForHdaItemAttribute(itemId, attribute.Id, namespaceIndex);
            this.SymbolicName            = attribute.Id.ToString();
            this.Description             = attribute.Description;
            this.AccessLevel             = AccessLevels.CurrentRead;
            this.UserAccessLevel         = AccessLevels.CurrentRead;
            this.MinimumSamplingInterval = MinimumSamplingIntervals.Indeterminate;
            this.Historizing             = false;
            this.ReferenceTypeId         = Opc.Ua.ReferenceTypeIds.HasProperty;
            this.TypeDefinitionId        = Opc.Ua.VariableTypeIds.PropertyType;
            this.Value      = null;
            this.StatusCode = StatusCodes.BadWaitingForInitialData;

            bool isConfigItem = false;

            // handle built-in properties.
            switch (attribute.Id)
            {
            default:
            {
                bool isArray = false;
                this.BrowseName  = new QualifiedName(this.SymbolicName, namespaceIndex);
                this.DisplayName = attribute.Name;
                this.DataType    = ComUtils.GetDataTypeId(attribute.DataType, out isArray);
                this.ValueRank   = (isArray)?ValueRanks.OneDimension:ValueRanks.Scalar;
                break;
            }

            case Constants.OPCHDA_ENG_UNITS:
            {
                this.BrowseName  = Opc.Ua.BrowseNames.EngineeringUnits;
                this.DisplayName = this.BrowseName.Name;
                this.DataType    = Opc.Ua.DataTypeIds.EUInformation;
                this.ValueRank   = ValueRanks.Scalar;
                break;
            }

            case Constants.OPCHDA_NORMAL_MAXIMUM:
            {
                this.BrowseName  = Opc.Ua.BrowseNames.EURange;
                this.DisplayName = this.BrowseName.Name;
                this.DataType    = Opc.Ua.DataTypeIds.Range;
                this.ValueRank   = ValueRanks.Scalar;
                break;
            }

            case Constants.OPCHDA_HIGH_ENTRY_LIMIT:
            {
                this.BrowseName  = Opc.Ua.BrowseNames.InstrumentRange;
                this.DisplayName = this.BrowseName.Name;
                this.DataType    = Opc.Ua.DataTypeIds.Range;
                this.ValueRank   = ValueRanks.Scalar;
                break;
            }

            case Constants.OPCHDA_STEPPED:
            {
                this.BrowseName  = Opc.Ua.BrowseNames.Stepped;
                this.DisplayName = this.BrowseName.Name;
                this.DataType    = Opc.Ua.DataTypeIds.Boolean;
                this.ValueRank   = ValueRanks.Scalar;
                isConfigItem     = true;
                break;
            }

            case Constants.OPCHDA_DERIVE_EQUATION:
            {
                this.BrowseName  = Opc.Ua.BrowseNames.Definition;
                this.DisplayName = this.BrowseName.Name;
                this.DataType    = Opc.Ua.DataTypeIds.String;
                this.ValueRank   = ValueRanks.Scalar;
                isConfigItem     = true;
                break;
            }

            case Constants.OPCHDA_MIN_TIME_INT:
            {
                this.BrowseName  = Opc.Ua.BrowseNames.MinTimeInterval;
                this.DisplayName = this.BrowseName.Name;
                this.DataType    = Opc.Ua.DataTypeIds.Duration;
                this.ValueRank   = ValueRanks.Scalar;
                isConfigItem     = true;
                break;
            }

            case Constants.OPCHDA_MAX_TIME_INT:
            {
                this.BrowseName  = Opc.Ua.BrowseNames.MaxTimeInterval;
                this.DisplayName = this.BrowseName.Name;
                this.DataType    = Opc.Ua.DataTypeIds.Duration;
                this.ValueRank   = ValueRanks.Scalar;
                isConfigItem     = true;
                break;
            }

            case Constants.OPCHDA_EXCEPTION_DEV:
            {
                this.BrowseName  = Opc.Ua.BrowseNames.ExceptionDeviation;
                this.DisplayName = this.BrowseName.Name;
                this.DataType    = Opc.Ua.DataTypeIds.Double;
                this.ValueRank   = ValueRanks.Scalar;
                isConfigItem     = true;
                break;
            }

            case Constants.OPCHDA_EXCEPTION_DEV_TYPE:
            {
                this.BrowseName  = Opc.Ua.BrowseNames.ExceptionDeviationFormat;
                this.DisplayName = this.BrowseName.Name;
                this.DataType    = Opc.Ua.DataTypeIds.ExceptionDeviationFormat;
                this.ValueRank   = ValueRanks.Scalar;
                isConfigItem     = true;
                break;
            }
            }

            // set the parent id.
            NodeId parentId = null;

            if (isConfigItem)
            {
                parentId = HdaParsedNodeId.Construct(HdaModelUtils.HdaItemConfiguration, itemId, null, namespaceIndex);
            }
            else
            {
                parentId = HdaModelUtils.ConstructIdForHdaItem(itemId, namespaceIndex);
            }

            this.AddReference(ReferenceTypeIds.HasProperty, true, parentId);
        }