Esempio n. 1
0
        /// <summary>
        /// Method used to Start the stack transport services.
        /// </summary>
        /// <remarks>
        /// The Start Method initialises device specific services and calls the stack services to start
        /// the Http and UDP transport services. It also creates and starts an instance of the
        /// Event Queue manager service that manages event subscription expirations.
        /// </remarks>
        public static void Start()
        {
            isStarted = true;

            // Initialize the device collections
            System.Ext.Console.Write("");
            System.Ext.Console.Write("Initializing device.....");
            Init();

            // Start Udp service host
            m_udpServiceHost.Start();
            System.Ext.Console.Write("Udp service host started...");

            // Start Http service host
            m_httpServiceHost.Start();
            System.Ext.Console.Write("Http service host started...");

            // Start the event subscription manager
            m_eventQManager = new DpwsWseEventSinkQMgr();
            m_eventQManager.Start();
            System.Ext.Console.Write("Event subscription manager started...");

            // Send hello greeting
            DpwsDiscoGreeting.SendGreetingMessage(true);
        }
Esempio n. 2
0
        private void Init()
        {
            m_discoClient = new DpwsDiscoveryClient(this);

            // Set the initial endpoint address
            m_endpointAddress = "urn:uuid:" + Guid.NewGuid();

            // Add the Hello and Bye discovery disco services
            ClientDiscoveryService = new DpwsDiscoClientService(this);
            m_discoServiceEndpoints.Add(ClientDiscoveryService);

            // Start a Udp discovery service host
            m_udpSeviceHost = new WsUdpServiceHost(m_discoServiceEndpoints);
            if (!m_udpSeviceHost.IsRunning)
            {
                m_udpSeviceHost.IgnoreRequestFromThisIP = m_ignoreRequestFromThisIP;
                m_udpSeviceHost.MaxThreadCount          = 5;
                m_udpSeviceHost.Start();
                System.Ext.Console.Write("Udp service host started...");
            }
            else
            {
                m_udpSeviceHost = null;
            }

            // Add eventing SubscriptionEnd ServiceOperations. By default Subscription End call back
            // to this client
            ServiceOperations.Add(new WsServiceOperation(WsWellKnownUri.WseNamespaceUri, "SubscriptionEnd"));

            // Add callbacks implemented by this client
            m_callbackServiceEndpoints.Add(this);

            // Start the Http service host
            m_httpServiceHost = new WsHttpServiceHost(m_port, m_callbackServiceEndpoints);
            m_httpServiceHost.MaxThreadCount = m_callbackServiceEndpoints.Count;
            m_httpServiceHost.Start();
            System.Ext.Console.Write("Http service host started...");
        }