Наследование: ComProxyConfiguration
Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ComHdaBrowser"/> class.
        /// </summary>
        public ComAe2Browser(ComAe2Proxy server, ComAe2ProxyConfiguration configuration, ComAeNamespaceMapper mapper)
        {
            m_server = server;
            m_configuration = configuration;
            m_mapper = mapper;

            m_cache = new Dictionary<string, AeBrowseElement>();

            AeBrowseElement root = new AeBrowseElement();
            root.NodeId = Opc.Ua.ObjectIds.Server;
            root.ItemId = String.Empty;
            root.BrowseText = String.Empty;
            root.IsArea = true;
            root.Duplicated = false;

            m_cache[String.Empty] = root;
            m_position = root;
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ComHdaBrowser"/> class.
        /// </summary>
        public ComAe2Browser(ComAe2Proxy server, ComAe2ProxyConfiguration configuration, ComAeNamespaceMapper mapper)
        {
            m_server        = server;
            m_configuration = configuration;
            m_mapper        = mapper;

            m_cache = new Dictionary <string, AeBrowseElement>();

            AeBrowseElement root = new AeBrowseElement();

            root.NodeId     = Opc.Ua.ObjectIds.Server;
            root.ItemId     = String.Empty;
            root.BrowseText = String.Empty;
            root.IsArea     = true;
            root.Duplicated = false;

            m_cache[String.Empty] = root;
            m_position            = root;
        }
Пример #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ComHdaBrowser"/> class.
        /// </summary>
        public ComAe2Subscription(
            ComAe2Proxy server, 
            ComAe2ProxyConfiguration configuration,
            ComAeNamespaceMapper mapper,
            ComAe2Browser browser, 
            AeConditionManager conditionManager)
        {
            m_server = server;
            m_configuration = configuration;
            m_mapper = mapper;
            m_browser = browser;
            m_conditionManager = conditionManager;
            m_filter = new AeEventFilter(m_mapper);
            m_queue = new Queue<AeEvent>();
            m_notifiers = new NodeIdDictionary<MonitoredItem>();
            m_sourceNodes = new List<NodeId>();

            // set a default filters.
            m_filter.SetFilter(Constants.ALL_EVENTS, 0, UInt16.MaxValue, null, null); 
            UpdateAreaFilter(null);
            UpdateSourceFilter(null);
        }
Пример #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ComHdaBrowser"/> class.
        /// </summary>
        public ComAe2Subscription(
            ComAe2Proxy server,
            ComAe2ProxyConfiguration configuration,
            ComAeNamespaceMapper mapper,
            ComAe2Browser browser,
            AeConditionManager conditionManager)
        {
            m_server           = server;
            m_configuration    = configuration;
            m_mapper           = mapper;
            m_browser          = browser;
            m_conditionManager = conditionManager;
            m_filter           = new AeEventFilter(m_mapper);
            m_queue            = new Queue <AeEvent>();
            m_notifiers        = new NodeIdDictionary <MonitoredItem>();
            m_sourceNodes      = new List <NodeId>();

            // set a default filters.
            m_filter.SetFilter(Constants.ALL_EVENTS, 0, UInt16.MaxValue, null, null);
            UpdateAreaFilter(null);
            UpdateSourceFilter(null);
        }
Пример #5
0
        /// <summary>
        /// Initializes the mapper.
        /// </summary>
        public void Initialize(Session session, ComAe2ProxyConfiguration configuration)
        {
            base.Initialize(session, configuration);

            m_session = session;

            // discard the table.
            m_eventTypes = new NodeIdDictionary <AeEventCategory>();
            m_categories = new Dictionary <uint, AeEventCategory>();
            m_attributes = new Dictionary <uint, AeEventAttribute>();

            // load the well known types from an embedded resource.
            IndexWellKnownTypes();

            // browse the server for additional types.
            if (!configuration.UseOnlyBuiltInTypes)
            {
                IndexTypesFromServer(Opc.Ua.ObjectTypeIds.BaseEventType, OpcRcw.Ae.Constants.SIMPLE_EVENT);
            }

            // check for existing category mapping.
            NodeIdMappingSet mappingSet = configuration.GetMappingSet("EventCategories");

            // update mappings.
            UpdateEventTypeMappings(mappingSet);

            // update configuration.
            configuration.ReplaceMappingSet(mappingSet);

            // check for existing attribute mapping.
            mappingSet = configuration.GetMappingSet("EventAttributes");

            // update mappings.
            UpdateEventAttributeMappings(mappingSet);

            // update configuration.
            configuration.ReplaceMappingSet(mappingSet);
        }
Пример #6
0
        /// <summary>
        /// Initializes the mapper.
        /// </summary>
        public void Initialize(Session session, ComAe2ProxyConfiguration configuration)
        {
            base.Initialize(session, configuration);

            m_session = session;

            // discard the table.
            m_eventTypes = new NodeIdDictionary<AeEventCategory>();
            m_categories = new Dictionary<uint, AeEventCategory>();
            m_attributes = new Dictionary<uint, AeEventAttribute>();

            // load the well known types from an embedded resource.
            IndexWellKnownTypes();

            // browse the server for additional types.
            if (!configuration.UseOnlyBuiltInTypes)
            {
                IndexTypesFromServer(Opc.Ua.ObjectTypeIds.BaseEventType, OpcRcw.Ae.Constants.SIMPLE_EVENT);
            }
            
            // check for existing category mapping.
            NodeIdMappingSet mappingSet = configuration.GetMappingSet("EventCategories");

            // update mappings.
            UpdateEventTypeMappings(mappingSet);

            // update configuration.
            configuration.ReplaceMappingSet(mappingSet);

            // check for existing attribute mapping.
            mappingSet = configuration.GetMappingSet("EventAttributes");

            // update mappings.
            UpdateEventAttributeMappings(mappingSet);

            // update configuration.
            configuration.ReplaceMappingSet(mappingSet);
        }
Пример #7
0
        /// <summary>
        /// Called when a new session is created.
        /// </summary>
        protected override void OnSessionCreated()
        {
            lock (Lock)
            {
                // fetch the configuration.
                m_configuration = Endpoint.ParseExtension<ComAe2ProxyConfiguration>(null);

                if (m_configuration == null)
                {
                    m_configuration = new ComAe2ProxyConfiguration();
                }

                Session session = Session;

                // update the mapping and pass the new session to other objects.
                m_mapper.Initialize(session, m_configuration);

                // save the configuration.
                Endpoint.UpdateExtension<ComAe2ProxyConfiguration>(null, m_configuration);
                SaveConfiguration();

                // create the browser.
                m_browser = new ComAe2Browser(this, m_configuration, m_mapper);
                m_conditionManager.Initialize();
            }
        }