示例#1
0
        /// <summary>
        /// Converts a UA Aggregate ID to a HDA aggregate ID
        /// </summary>
        /// <param name="nodeId">The node id.</param>
        /// <param name="namespaceIndex">Index of the namespace.</param>
        /// <returns></returns>
        public static uint HdaAggregateToUaAggregate(NodeId nodeId, ushort namespaceIndex)
        {
            // check for valid node.
            if (nodeId == null)
            {
                return(0);
            }

            // check for built in aggregate.
            uint aggregateId = ComUtils.GetHdaAggregateId(nodeId);

            if (aggregateId != 0)
            {
                return(aggregateId);
            }

            // parse the node id.
            HdaParsedNodeId parsedNodeId = HdaParsedNodeId.Parse(nodeId);

            if (parsedNodeId == null || namespaceIndex != parsedNodeId.NamespaceIndex || parsedNodeId.RootType != HdaModelUtils.HdaAggregate)
            {
                return(0);
            }

            return(parsedNodeId.AggregateId);
        }
示例#2
0
        /// <summary>
        /// Converts a HDA Aggregate ID to a UA aggregate ID
        /// </summary>
        /// <param name="aggregateId">The aggregate id.</param>
        /// <param name="namespaceIndex">Index of the namespace.</param>
        /// <returns></returns>
        public static NodeId HdaAggregateToUaAggregate(uint aggregateId, ushort namespaceIndex)
        {
            NodeId nodeId = ComUtils.GetHdaAggregateId(aggregateId);

            if (nodeId != null)
            {
                return(nodeId);
            }

            return(HdaParsedNodeId.Construct(HdaAggregate, aggregateId.ToString(), null, namespaceIndex));
        }
示例#3
0
        /// <summary>
        /// Constructs the node id for an aggregate function.
        /// </summary>
        /// <param name="aggregateId">The aggregate id.</param>
        /// <param name="namespaceIndex">Index of the namespace.</param>
        /// <returns></returns>
        public static NodeId ConstructIdForHdaAggregate(uint aggregateId, ushort namespaceIndex)
        {
            // check for built in aggregates.
            NodeId nodeId = ComUtils.GetHdaAggregateId(aggregateId);

            if (nodeId != null)
            {
                return(nodeId);
            }

            // server specific aggregates.
            ParsedNodeId parsedNodeId = new ParsedNodeId();

            parsedNodeId.RootId         = aggregateId.ToString();
            parsedNodeId.NamespaceIndex = namespaceIndex;
            parsedNodeId.RootType       = HdaAggregate;

            return(parsedNodeId.Construct());
        }