Start() public method

public Start ( ) : bool
return bool
Exemplo n.º 1
0
        /// <summary>
        ///     Starts listening for incoming requests and starts all underlying hubs.
        /// </summary>
        /// <returns>True on success, false otherwise.</returns>
        public override bool Start()
        {
            if (m_Started)
            {
                return(m_Started);
            }

            Log.Debug("Starting root hub");

            if (!_serviceStarted)
            {
                var baseAddress = new Uri("net.tcp://localhost:26760/ScpRootHubService");

                var binding = new NetTcpBinding
                {
                    TransferMode = TransferMode.Streamed,
                    Security     = new NetTcpSecurity {
                        Mode = SecurityMode.None
                    }
                };

                _rootHubServiceHost = new ServiceHost(this, baseAddress);
                _rootHubServiceHost.AddServiceEndpoint(typeof(IScpCommandService), binding, baseAddress);

                _rootHubServiceHost.Open();

                _serviceStarted = true;
                try { _udpServer.Start(26760); }
                catch (SocketException ex)
                {
                    Log.FatalFormat("Couldn't start UDP server: {0}", ex);
                    return(false);
                }
            }

            try
            {
                _rxFeedServer.Start();
            }
            catch (SocketException sex)
            {
                Log.FatalFormat("Couldn't start native feed server: {0}", sex);
                return(false);
            }

            m_Started |= _scpBus.Start();
            m_Started |= _usbHub.Start();
            m_Started |= _bthHub.Start();

            Log.Debug("Root hub started");

            // make some noise =)
            if (GlobalConfiguration.Instance.IsStartupSoundEnabled)
            {
                AudioPlayer.Instance.PlayCustomFile(GlobalConfiguration.Instance.StartupSoundFile);
            }

            return(m_Started);
        }
Exemplo n.º 2
0
        public override bool Start()
        {
            try
            {
                if (!_limitInstance.IsOnlyInstance) // existing root hub running as desktop app
                {
                    throw new RootHubAlreadyStartedException("The root hub is already running, please close the ScpServer first!");
                }
            }
            catch (UnauthorizedAccessException) // existing root hub running as service
            {
                throw new RootHubAlreadyStartedException("The root hub is already running, please stop the ScpService first!");
            }

            if (m_Started)
            {
                return(m_Started);
            }

            Log.Info("Starting root hub");

            if (!_serviceStarted)
            {
                var baseAddress = new Uri("net.tcp://localhost:26760/ScpRootHubService");

                var binding = new NetTcpBinding();

                _rootHubServiceHost = new ServiceHost(this, baseAddress);
                _rootHubServiceHost.AddServiceEndpoint(typeof(IScpCommandService), binding, baseAddress);

                _rootHubServiceHost.Open();

                _serviceStarted = true;
            }

            try
            {
                _rxFeedServer.Start();
            }
            catch (SocketException sex)
            {
                Log.FatalFormat("Couldn't start native feed server: {0}", sex);
                return(false);
            }

            scpMap.Start();

            m_Started |= _scpBus.Start();
            m_Started |= _usbHub.Start();
            m_Started |= _bthHub.Start();

            Log.Info("Root hub started");

            return(m_Started);
        }
Exemplo n.º 3
0
        public virtual Boolean Start()
        {
            if (!m_Started)
            {
                m_Started |= scpBus.Start();
                m_Started |= usbHub.Start();
                m_Started |= bthHub.Start();

                if (m_Started)
                {
                    UDP_Worker.RunWorkerAsync();
                }
            }

            return(m_Started);
        }
Exemplo n.º 4
0
        public override Boolean Start()
        {
            if (!m_Started)
            {
                scpMap.Start();

                m_Started |= scpBus.Start();
                m_Started |= usbHub.Start();
                m_Started |= bthHub.Start();

                if (m_Started)
                {
                    UDP_Worker.RunWorkerAsync();
                }
            }

            return(m_Started);
        }
Exemplo n.º 5
0
        /// <summary>
        ///     Starts listening for incoming requests and starts all underlying hubs.
        /// </summary>
        /// <returns>True on success, false otherwise.</returns>
        public override bool Start()
        {
            if (m_Started)
            {
                return(m_Started);
            }

            Log.Debug("Starting root hub");

            if (!_serviceStarted)
            {
                var baseAddress = new Uri("net.tcp://localhost:26760/ScpRootHubService");

                var binding = new NetTcpBinding {
                    TransferMode = TransferMode.Streamed,
                    Security     = new NetTcpSecurity {
                        Mode = SecurityMode.None
                    }
                };

                _rootHubServiceHost = new ServiceHost(this, baseAddress);
                _rootHubServiceHost.AddServiceEndpoint(typeof(IScpCommandService), binding, baseAddress);

                _rootHubServiceHost.Open();

                _serviceStarted = true;
            }

            try {
                _rxFeedServer.Start();
            } catch (SocketException sex) {
                Log.FatalFormat("Couldn't start native feed server: {0}", sex);
                return(false);
            }

            m_Started |= _scpBus.Start();
            m_Started |= _usbHub.Start();
            m_Started |= _bthHub.Start();

            Log.Debug("Root hub started");

            return(m_Started);
        }