Opc.Ua.Com.Client.ComAeClient.CreateEventSubscription C# (CSharp) Méthode

CreateEventSubscription() public méthode

Creates an event subscription.
public CreateEventSubscription ( ) : IOPCEventSubscriptionMgt
Résultat IOPCEventSubscriptionMgt
        public IOPCEventSubscriptionMgt CreateEventSubscription()
        {
            object unknown = null;

            string methodName = "IOPCEventServer.CreateEventSubscription";

            try
            {
                IOPCEventServer server = BeginComCall<IOPCEventServer>(methodName, true);
                Guid riid = typeof(IOPCEventSubscriptionMgt).GUID;

                int revisedBufferTime = 0;
                int revisedMaxSize = 0;

                server.CreateEventSubscription(
                    1,
                    0,
                    0,
                    0,
                    ref riid,
                    out unknown,
                    out revisedBufferTime,
                    out revisedMaxSize);
            }
            catch (Exception e)
            {
                ComCallError(methodName, e);
                return null;
            }
            finally
            {
                EndComCall(methodName);
            }

            return (IOPCEventSubscriptionMgt)unknown;
        }

Usage Example

Exemple #1
0
        /// <summary>
        /// Creates the subscription.
        /// </summary>
        public void Create()
        {
            ComAeClient client = m_manager.SelectClient(m_defaultContext, false);

            // release existing server.
            if (this.Unknown != null)
            {
                ReleaseServer();
            }

            // create the subscription.
            this.Unknown = client.CreateEventSubscription();

            // select the attributes.
            foreach (KeyValuePair <int, int[]> entry in m_cache.Attributes)
            {
                SelectReturnedAttributes(entry.Key, entry.Value);
            }

            // set the filter.
            SetFilter(m_qualifiedName, m_isSource);

            // set up callback.
            try
            {
                m_callback = new ComAeEventSink(this);
            }
            catch (Exception e)
            {
                Utils.Trace("Could not establish event callback.", e);
            }
        }