示例#1
0
        }       //    end InitializeAeObjects

        public void activateObjectsAsync()
        {
            System.Console.WriteLine();
            // activate the session asynchronously
            m_aeSession.Connect(true, true, m_executionOptions);
            // increment the execution context used to identify the callback that comes as response
            m_executionOptions.ExecutionContext++;
        }// end activateObjectsAsync
示例#2
0
        public int InitializeAeObjects(string url)
        {
            int connectResult = (int)EnumResultCode.E_FAIL;

            m_executionOptions = new ExecutionOptions();
            m_executionOptions.ExecutionType    = EnumExecutionType.ASYNCHRONOUS;
            m_executionOptions.ExecutionContext = 0;

            try
            {
                m_aeSession      = new MyAeSession(url);
                m_aeSubscription = new MyAeSubscription(m_aeSession);

                connectResult = m_aeSession.Connect(true, false, new ExecutionOptions());

                uint[] categoryIds = new uint[]
                {
                    (uint)CategoriesAndAttribute.Categories.System_alarm,
                    (uint)CategoriesAndAttribute.Categories.Process_alarm,
                    (uint)CategoriesAndAttribute.Categories.Operation_record
                };
                m_aeSubscription.FilterCategories = categoryIds;

                AeReturnedAttributes[] returnedAttributes = new AeReturnedAttributes[categoryIds.Length];
                for (int i = 0; i < categoryIds.Length; i++)
                {
                    List <uint> temp         = CategoriesAndAttribute.getAttributeIDsFromCategoryID(categoryIds[i]);
                    uint[]      attributeIds = new uint[temp.Count];
                    attributeIds          = temp.ToArray();
                    returnedAttributes[i] = new AeReturnedAttributes();
                    returnedAttributes[i].AttributeIds = attributeIds;
                    returnedAttributes[i].CategoryId   = categoryIds[i];
                }
                m_aeSubscription.ReturnedAttributes = returnedAttributes;
            }
            catch (Exception exc)
            {
                GetApplication().Trace(
                    EnumTraceLevel.ERR,
                    EnumTraceGroup.USER,
                    "OpcClient::InitializeAeObjects",
                    exc.ToString());
            }   //    end try...catch

            return(connectResult);
        }       //    end InitializeAeObjects