public EventSerializer(EventTypeMapping mapping, StreamTransformations streamTransformations,
                        EventTransformations transformations)
 {
     this.mapping               = mapping;
     this.transformations       = transformations;
     this.streamTransformations = streamTransformations;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AeEventTypeMappingState"/> class.
        /// </summary>
        public AeEventTypeMappingState(EventTypeMapping eventType, ushort namespaceIndex)
        {
            m_eventType = eventType;

            // create the name for the event type.
            string name = "COMAE" + eventType.ToString();

            // the attributes.
            this.NodeId      = AeParsedNodeId.Construct(eventType, namespaceIndex);
            this.BrowseName  = new QualifiedName(name, namespaceIndex);
            this.DisplayName = this.BrowseName.Name;
            this.IsAbstract  = true;

            // set the supertype.
            switch (eventType)
            {
            case EventTypeMapping.AlarmConditionType: { SuperTypeId = Opc.Ua.ObjectTypeIds.AlarmConditionType; break; }

            case EventTypeMapping.AuditEventType: { SuperTypeId = Opc.Ua.ObjectTypeIds.AuditEventType; break; }

            case EventTypeMapping.BaseEventType: { SuperTypeId = Opc.Ua.ObjectTypeIds.BaseEventType; break; }

            case EventTypeMapping.DeviceFailureEventType: { SuperTypeId = Opc.Ua.ObjectTypeIds.DeviceFailureEventType; break; }

            case EventTypeMapping.DiscreteAlarmType: { SuperTypeId = Opc.Ua.ObjectTypeIds.DiscreteAlarmType; break; }

            case EventTypeMapping.NonExclusiveDeviationAlarmType: { SuperTypeId = Opc.Ua.ObjectTypeIds.NonExclusiveDeviationAlarmType; break; }

            case EventTypeMapping.ExclusiveLevelAlarmType: { SuperTypeId = Opc.Ua.ObjectTypeIds.ExclusiveLevelAlarmType; break; }

            case EventTypeMapping.LimitAlarmType: { SuperTypeId = Opc.Ua.ObjectTypeIds.LimitAlarmType; break; }

            case EventTypeMapping.NonExclusiveLevelAlarmType: { SuperTypeId = Opc.Ua.ObjectTypeIds.NonExclusiveLevelAlarmType; break; }

            case EventTypeMapping.OffNormalAlarmType: { SuperTypeId = Opc.Ua.ObjectTypeIds.OffNormalAlarmType; break; }

            case EventTypeMapping.SystemEventType: { SuperTypeId = Opc.Ua.ObjectTypeIds.SystemEventType; break; }

            case EventTypeMapping.TripAlarmType: { SuperTypeId = Opc.Ua.ObjectTypeIds.TripAlarmType; break; }

            case EventTypeMapping.ConditionClassType: { SuperTypeId = Opc.Ua.ObjectTypeIds.BaseConditionClassType; break; }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Parses the specified node identifier.
        /// </summary>
        /// <param name="nodeId">The node identifier.</param>
        /// <returns>The parsed node identifier. Null if the identifier cannot be parsed.</returns>
        public static new AeParsedNodeId Parse(NodeId nodeId)
        {
            // can only parse non-null string node identifiers.
            if (NodeId.IsNull(nodeId))
            {
                return(null);
            }

            string identifier = nodeId.Identifier as string;

            if (String.IsNullOrEmpty(identifier))
            {
                return(null);
            }

            AeParsedNodeId parsedNodeId = new AeParsedNodeId();

            parsedNodeId.NamespaceIndex = nodeId.NamespaceIndex;

            int start = 0;

            // extract the type of identifier.
            parsedNodeId.RootType = (int)ExtractNumber(identifier, ref start);

            if (start >= identifier.Length || identifier[start] != ':')
            {
                return(null);
            }

            // extract any component path.
            StringBuilder buffer = new StringBuilder();

            int index = start + 1;

            parsedNodeId.RootId = ExtractAndUnescapeString(identifier, ref index, '&', '?');

            // extract any component.
            int end = index + 1;

            parsedNodeId.ComponentPath = null;

            // extract the component path.
            if (end < identifier.Length)
            {
                parsedNodeId.ComponentPath = identifier.Substring(end);
            }

            // extract the category and condition name.
            start      = 0;
            identifier = parsedNodeId.RootId;

            switch (parsedNodeId.RootType)
            {
            case AeModelUtils.AeEventTypeMapping:
            {
                EventTypeMapping mapping = (EventTypeMapping)(int)ExtractNumber(identifier, ref start);

                if (start < identifier.Length)
                {
                    return(null);
                }

                parsedNodeId.CategoryId = (int)mapping;
                break;
            }

            case AeModelUtils.AeSimpleEventType:
            case AeModelUtils.AeTrackingEventType:
            {
                parsedNodeId.CategoryId = Utils.ToInt32(ExtractNumber(identifier, ref start));

                if (start < identifier.Length)
                {
                    return(null);
                }

                break;
            }

            case AeModelUtils.AeConditionEventType:
            {
                parsedNodeId.CategoryId = Utils.ToInt32(ExtractNumber(identifier, ref start));

                if (start < identifier.Length)
                {
                    if (identifier[start] != ':')
                    {
                        return(null);
                    }

                    parsedNodeId.ConditionName = identifier.Substring(start + 1);
                }

                break;
            }

            case AeModelUtils.AeCondition:
            {
                parsedNodeId.SourceId = ExtractAndUnescapeString(identifier, ref start, '0', ':');

                if (start < identifier.Length && identifier[start] != ':')
                {
                    return(null);
                }

                start++;

                parsedNodeId.CategoryId = Utils.ToInt32(ExtractNumber(identifier, ref start));

                if (start < identifier.Length)
                {
                    if (identifier[start] != ':')
                    {
                        return(null);
                    }

                    parsedNodeId.ConditionName = identifier.Substring(start + 1);
                }

                break;
            }
            }

            // extract the attribute id.
            if (!String.IsNullOrEmpty(parsedNodeId.ComponentPath))
            {
                start      = 0;
                identifier = parsedNodeId.ComponentPath;

                switch (parsedNodeId.RootType)
                {
                case AeModelUtils.AeSimpleEventType:
                case AeModelUtils.AeTrackingEventType:
                case AeModelUtils.AeConditionEventType:
                {
                    parsedNodeId.AttributeName = identifier.Substring(start + 1);
                    break;
                }
                }
            }

            return(parsedNodeId);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Constructs the NodeId for the specified event type mapping node.
 /// </summary>
 internal static NodeId Construct(EventTypeMapping mapping, ushort namespaceIndex)
 {
     return(Construct(AeModelUtils.AeEventTypeMapping, ((int)mapping).ToString(), null, namespaceIndex));
 }
Exemplo n.º 5
0
 /// <summary>
 /// Constructs the NodeId for the specified event type mapping node.
 /// </summary>
 internal static NodeId Construct(EventTypeMapping mapping, ushort namespaceIndex)
 {
     return Construct(AeModelUtils.AeEventTypeMapping, ((int)mapping).ToString(), null, namespaceIndex);
 }
Exemplo n.º 6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AeEventTypeMappingState"/> class.
        /// </summary>
        public AeEventTypeMappingState(EventTypeMapping eventType, ushort namespaceIndex)
        {
            m_eventType = eventType;

            // create the name for the event type.
            string name = "COMAE" + eventType.ToString();

            // the attributes.
            this.NodeId = AeParsedNodeId.Construct(eventType, namespaceIndex);
            this.BrowseName = new QualifiedName(name, namespaceIndex);
            this.DisplayName = this.BrowseName.Name;
            this.IsAbstract = true;

            // set the supertype.
            switch (eventType)
            {
                case EventTypeMapping.AlarmConditionType: { SuperTypeId = Opc.Ua.ObjectTypeIds.AlarmConditionType; break; }
                case EventTypeMapping.AuditEventType: { SuperTypeId = Opc.Ua.ObjectTypeIds.AuditEventType; break; }
                case EventTypeMapping.BaseEventType: { SuperTypeId = Opc.Ua.ObjectTypeIds.BaseEventType; break; }
                case EventTypeMapping.DeviceFailureEventType: { SuperTypeId = Opc.Ua.ObjectTypeIds.DeviceFailureEventType; break; }
                case EventTypeMapping.DiscreteAlarmType: { SuperTypeId = Opc.Ua.ObjectTypeIds.DiscreteAlarmType; break; }
                case EventTypeMapping.NonExclusiveDeviationAlarmType: { SuperTypeId = Opc.Ua.ObjectTypeIds.NonExclusiveDeviationAlarmType; break; }
                case EventTypeMapping.ExclusiveLevelAlarmType: { SuperTypeId = Opc.Ua.ObjectTypeIds.ExclusiveLevelAlarmType; break; }
                case EventTypeMapping.LimitAlarmType: { SuperTypeId = Opc.Ua.ObjectTypeIds.LimitAlarmType; break; }
                case EventTypeMapping.NonExclusiveLevelAlarmType: { SuperTypeId = Opc.Ua.ObjectTypeIds.NonExclusiveLevelAlarmType; break; }
                case EventTypeMapping.OffNormalAlarmType: { SuperTypeId = Opc.Ua.ObjectTypeIds.OffNormalAlarmType; break; }
                case EventTypeMapping.SystemEventType: { SuperTypeId = Opc.Ua.ObjectTypeIds.SystemEventType; break; }
                case EventTypeMapping.TripAlarmType: { SuperTypeId = Opc.Ua.ObjectTypeIds.TripAlarmType; break; }
                case EventTypeMapping.ConditionClassType: { SuperTypeId = Opc.Ua.ObjectTypeIds.BaseConditionClassType; break; }
            }
        }