예제 #1
0
        }           //	end constructor

        public void SetOutProc(OutProc anOutProc)
        {
            try
            {
                m_outProc          = anOutProc;
                m_opcClient        = m_outProc.OpcClient;
                m_session          = m_opcClient.GetSession();
                m_subscription     = m_opcClient.GetSubscription();
                m_executionOptions = m_opcClient.GetExecutionOptions();
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.ToString());
            }               //	end try...catch
        }
예제 #2
0
        }           //	end ProcessCommandLine

        public void Terminate()
        {
            if (m_aeSubscription.CurrentState != EnumObjectState.DISCONNECTED)
            {
                m_aeSubscription.Disconnect(m_executionOptions);
            }               //	end if

            if (m_aeSession.CurrentState != EnumObjectState.DISCONNECTED)
            {
                m_aeSession.Disconnect(m_executionOptions);
            }               //	end if

            m_aeSession.RemoveAeSubscription(m_aeSubscription);
            GetApplication().RemoveAeSession(m_aeSession);

            GetApplication().Terminate();
            m_aeSession        = null;
            m_aeSubscription   = null;
            m_executionOptions = null;
        }           //	end Terminate
예제 #3
0
        }        //end GetConditionState

        public int InitializeAeObjects()
        {
            int connectResult = (int)EnumResultCode.E_FAIL;
            int result        = (int)EnumResultCode.S_OK;

            m_executionOptions = new ExecutionOptions();

            try
            {
                m_aeSession      = new MyAeSession("opcae:///Softing.OPCToolboxDemo_ServerAE.1/{2E565243-B238-11D3-842D-0008C779D775}");
                m_aeSubscription = new MyAeSubscription(m_aeSession);

                connectResult = m_aeSession.Connect(
                    true,
                    true,
                    m_executionOptions);

                result = m_aeSubscription.RefreshAeConditions(m_executionOptions);

                if (!ResultCode.SUCCEEDED(result))
                {
                    string errorText = String.Empty;
                    m_aeSession.GetErrorString(result, out errorText, m_executionOptions);
                    System.Diagnostics.Debug.WriteLine(errorText);
                }                 //end if
            }
            catch (Exception exc)
            {
                GetApplication().Trace(
                    EnumTraceLevel.ERR,
                    EnumTraceGroup.USER,
                    "OpcClient::InitializeAeObjects",
                    exc.ToString());
            }               //	end try...catch

            return(connectResult);
        }           //	end InitializeAeObjects
예제 #4
0
        //-----------------

        public MyAeSubscription(MyAeSession parentSession) : base(parentSession)
        {
            AeConditionsChanged += new AeConditionsChangedEventHandler(HandleAeConditionsChanged);
        }