Beispiel #1
0
        }           //	end Terminate

        public int InitializeDaObjects()
        {
            int connectResult = (int)EnumResultCode.E_FAIL;

            m_addressSpaceElementId             = "increment.I1";
            m_addressSpaceElementPath           = string.Empty;
            m_executionOptions                  = new ExecutionOptions();
            m_executionOptions.ExecutionContext = 0;


            try
            {
                //	TODO add your server URL here
                //	this is the server url for Softing OPCToolbox Demo Server
                //	first choice is COM-DA
                string url = "opcda:///Softing.OPCToolboxDemo_ServerDA.1/{2E565242-B238-11D3-842D-0008C779D775}";

                //uncomment if you need an XML-DA access
                //	string url = "http://localhost:8079/OPC/DA";

                m_daSession = new MyDaSession(url);

                connectResult = m_daSession.Connect(true, false, null);
            }
            catch (Exception exc)
            {
                GetApplication().Trace(
                    EnumTraceLevel.ERR,
                    EnumTraceGroup.USER,
                    "OpcClient::InitializaDaObjects",
                    exc.ToString());
            }               //	end try...catch

            return(connectResult);
        }           //	end InitializeDaObjects
Beispiel #2
0
        }           //	end ProcessCommandLine

        public void Terminate()
        {
            GetApplication().Terminate();
            m_daSession = null;
        }           //	end Terminate