public void Stop()
        {
            Client.Network.EventQueueRunning -= new EventHandler <EventQueueRunningEventArgs>(Network_EventQueueRunning);

            // Connection events
            OnDaemonRunning -=
                new VoiceGateway.DaemonRunningCallback(connector_OnDaemonRunning);
            OnDaemonCouldntRun -=
                new VoiceGateway.DaemonCouldntRunCallback(connector_OnDaemonCouldntRun);
            OnConnectorCreateResponse -=
                new EventHandler <VoiceGateway.VoiceConnectorEventArgs>(connector_OnConnectorCreateResponse);
            OnDaemonConnected -=
                new VoiceGateway.DaemonConnectedCallback(connector_OnDaemonConnected);
            OnDaemonCouldntConnect -=
                new VoiceGateway.DaemonCouldntConnectCallback(connector_OnDaemonCouldntConnect);
            OnAuxAudioPropertiesEvent -=
                new EventHandler <AudioPropertiesEventArgs>(connector_OnAuxAudioPropertiesEvent);

            // Session events
            OnSessionStateChangeEvent -=
                new EventHandler <SessionStateChangeEventArgs>(connector_OnSessionStateChangeEvent);
            OnSessionAddedEvent -=
                new EventHandler <SessionAddedEventArgs>(connector_OnSessionAddedEvent);

            // Session Participants events
            OnSessionParticipantUpdatedEvent -=
                new EventHandler <ParticipantUpdatedEventArgs>(connector_OnSessionParticipantUpdatedEvent);
            OnSessionParticipantAddedEvent -=
                new EventHandler <ParticipantAddedEventArgs>(connector_OnSessionParticipantAddedEvent);
            OnSessionParticipantRemovedEvent -=
                new EventHandler <ParticipantRemovedEventArgs>(connector_OnSessionParticipantRemovedEvent);

            // Tuning events
            OnAuxGetCaptureDevicesResponse -=
                new EventHandler <VoiceGateway.VoiceDevicesEventArgs>(connector_OnAuxGetCaptureDevicesResponse);
            OnAuxGetRenderDevicesResponse -=
                new EventHandler <VoiceGateway.VoiceDevicesEventArgs>(connector_OnAuxGetRenderDevicesResponse);

            // Account events
            OnAccountLoginResponse -=
                new EventHandler <VoiceGateway.VoiceAccountEventArgs>(connector_OnAccountLoginResponse);

            // Stop the background thread
            if (posThread != null)
            {
                PosUpdating(false);

                if (posThread.IsAlive)
                {
                    posThread.Abort();
                }
                posThread = null;
            }

            // Close all sessions
            foreach (VoiceSession s in sessions.Values)
            {
                if (OnSessionRemove != null)
                {
                    OnSessionRemove(s, EventArgs.Empty);
                }
                s.Close();
            }

            // Clear out lots of state so in case of restart we begin at the beginning.
            currentParcelCap = null;
            sessions.Clear();
            accountHandle = null;
            voiceUser     = null;
            voicePassword = null;

            SessionTerminate(sessionHandle);
            sessionHandle = null;
            AccountLogout(accountHandle);
            accountHandle = null;
            ConnectorInitiateShutdown(connectionHandle);
            connectionHandle = null;
            StopDaemon();
        }
Example #2
0
        public void Stop()
        {
            Client.Network.EventQueueRunning -= new EventHandler<EventQueueRunningEventArgs>(Network_EventQueueRunning);

            // Connection events
            OnDaemonRunning -=
                     new VoiceGateway.DaemonRunningCallback(connector_OnDaemonRunning);
            OnDaemonCouldntRun -=
                    new VoiceGateway.DaemonCouldntRunCallback(connector_OnDaemonCouldntRun);
            OnConnectorCreateResponse -=
                new EventHandler<VoiceGateway.VoiceConnectorEventArgs>(connector_OnConnectorCreateResponse);
            OnDaemonConnected -=
                    new VoiceGateway.DaemonConnectedCallback(connector_OnDaemonConnected);
            OnDaemonCouldntConnect -=
                    new VoiceGateway.DaemonCouldntConnectCallback(connector_OnDaemonCouldntConnect);
            OnAuxAudioPropertiesEvent -=
                    new EventHandler<AudioPropertiesEventArgs>(connector_OnAuxAudioPropertiesEvent);

            // Session events
            OnSessionStateChangeEvent -=
                    new EventHandler<SessionStateChangeEventArgs>(connector_OnSessionStateChangeEvent);
            OnSessionAddedEvent -=
                    new EventHandler<SessionAddedEventArgs>(connector_OnSessionAddedEvent);

            // Session Participants events
            OnSessionParticipantUpdatedEvent -=
                    new EventHandler<ParticipantUpdatedEventArgs>(connector_OnSessionParticipantUpdatedEvent);
            OnSessionParticipantAddedEvent -=
                    new EventHandler<ParticipantAddedEventArgs>(connector_OnSessionParticipantAddedEvent);
            OnSessionParticipantRemovedEvent -=
                    new EventHandler<ParticipantRemovedEventArgs>(connector_OnSessionParticipantRemovedEvent);

            // Tuning events
            OnAuxGetCaptureDevicesResponse -=
                    new EventHandler<VoiceGateway.VoiceDevicesEventArgs>(connector_OnAuxGetCaptureDevicesResponse);
            OnAuxGetRenderDevicesResponse -=
                    new EventHandler<VoiceGateway.VoiceDevicesEventArgs>(connector_OnAuxGetRenderDevicesResponse);

            // Account events
            OnAccountLoginResponse -=
                    new EventHandler<VoiceGateway.VoiceAccountEventArgs>(connector_OnAccountLoginResponse);

            // Stop the background thread
            if (posThread != null)
            {
                PosUpdating(false);

                if (posThread.IsAlive)
                    posThread.Abort();
                posThread = null;
            }

            // Close all sessions
            foreach (VoiceSession s in sessions.Values)
            {
                if (OnSessionRemove != null)
                    OnSessionRemove(s, EventArgs.Empty);
                s.Close();
            }

            // Clear out lots of state so in case of restart we begin at the beginning.
            currentParcelCap = null;
            sessions.Clear();
            accountHandle = null;
            voiceUser = null;
            voicePassword = null;

            SessionTerminate(sessionHandle);
            sessionHandle = null;
            AccountLogout(accountHandle);
            accountHandle = null;
            ConnectorInitiateShutdown(connectionHandle);
            connectionHandle = null;
            StopDaemon();
        }
        /// <summary>
        /// Start up the Voice service.
        /// </summary>
        public void Start()
        {
            // Start the background thread
            if (posThread != null && posThread.IsAlive)
            {
                posThread.Abort();
            }
            posThread              = new Thread(new ThreadStart(PositionThreadBody));
            posThread.Name         = "VoicePositionUpdate";
            posThread.IsBackground = true;
            posRestart             = new ManualResetEvent(false);
            posThread.Start();

            Client.Network.EventQueueRunning += new EventHandler <EventQueueRunningEventArgs>(Network_EventQueueRunning);

            // Connection events
            OnDaemonRunning +=
                new VoiceGateway.DaemonRunningCallback(connector_OnDaemonRunning);
            OnDaemonCouldntRun +=
                new VoiceGateway.DaemonCouldntRunCallback(connector_OnDaemonCouldntRun);
            OnConnectorCreateResponse +=
                new EventHandler <VoiceGateway.VoiceConnectorEventArgs>(connector_OnConnectorCreateResponse);
            OnDaemonConnected +=
                new DaemonConnectedCallback(connector_OnDaemonConnected);
            OnDaemonCouldntConnect +=
                new DaemonCouldntConnectCallback(connector_OnDaemonCouldntConnect);
            OnAuxAudioPropertiesEvent +=
                new EventHandler <AudioPropertiesEventArgs>(connector_OnAuxAudioPropertiesEvent);

            // Session events
            OnSessionStateChangeEvent +=
                new EventHandler <SessionStateChangeEventArgs>(connector_OnSessionStateChangeEvent);
            OnSessionAddedEvent +=
                new EventHandler <SessionAddedEventArgs>(connector_OnSessionAddedEvent);

            // Session Participants events
            OnSessionParticipantUpdatedEvent +=
                new EventHandler <ParticipantUpdatedEventArgs>(connector_OnSessionParticipantUpdatedEvent);
            OnSessionParticipantAddedEvent +=
                new EventHandler <ParticipantAddedEventArgs>(connector_OnSessionParticipantAddedEvent);

            // Device events
            OnAuxGetCaptureDevicesResponse +=
                new EventHandler <VoiceDevicesEventArgs>(connector_OnAuxGetCaptureDevicesResponse);
            OnAuxGetRenderDevicesResponse +=
                new EventHandler <VoiceDevicesEventArgs>(connector_OnAuxGetRenderDevicesResponse);

            // Generic status response
            OnVoiceResponse += new EventHandler <VoiceResponseEventArgs>(connector_OnVoiceResponse);

            // Account events
            OnAccountLoginResponse +=
                new EventHandler <VoiceAccountEventArgs>(connector_OnAccountLoginResponse);

            Logger.Log("Voice initialized", Helpers.LogLevel.Info);

            // If voice provisioning capability is already available,
            // proceed with voice startup.   Otherwise the EventQueueRunning
            // event will do it.
            System.Uri vCap =
                Client.Network.CurrentSim.Caps.CapabilityURI("ProvisionVoiceAccountRequest");
            if (vCap != null)
            {
                RequestVoiceProvision(vCap);
            }
        }
Example #4
0
        /// <summary>
        /// Start up the Voice service.
        /// </summary>
        public void Start()
        {
            // Start the background thread
            if (posThread != null && posThread.IsAlive)
                posThread.Abort();
            posThread = new Thread(new ThreadStart(PositionThreadBody));
            posThread.Name = "VoicePositionUpdate";
            posThread.IsBackground = true;
            posRestart = new ManualResetEvent(false);
            posThread.Start();

            Client.Network.EventQueueRunning += new EventHandler<EventQueueRunningEventArgs>(Network_EventQueueRunning);

            // Connection events
            OnDaemonRunning +=
                 new VoiceGateway.DaemonRunningCallback(connector_OnDaemonRunning);
            OnDaemonCouldntRun +=
                new VoiceGateway.DaemonCouldntRunCallback(connector_OnDaemonCouldntRun);
            OnConnectorCreateResponse +=
                new EventHandler<VoiceGateway.VoiceConnectorEventArgs>(connector_OnConnectorCreateResponse);
            OnDaemonConnected +=
                new DaemonConnectedCallback(connector_OnDaemonConnected);
            OnDaemonCouldntConnect +=
                new DaemonCouldntConnectCallback(connector_OnDaemonCouldntConnect);
            OnAuxAudioPropertiesEvent +=
                new EventHandler<AudioPropertiesEventArgs>(connector_OnAuxAudioPropertiesEvent);

            // Session events
            OnSessionStateChangeEvent +=
                new EventHandler<SessionStateChangeEventArgs>(connector_OnSessionStateChangeEvent);
            OnSessionAddedEvent +=
                new EventHandler<SessionAddedEventArgs>(connector_OnSessionAddedEvent);

            // Session Participants events
            OnSessionParticipantUpdatedEvent +=
                new EventHandler<ParticipantUpdatedEventArgs>(connector_OnSessionParticipantUpdatedEvent);
            OnSessionParticipantAddedEvent +=
                new EventHandler<ParticipantAddedEventArgs>(connector_OnSessionParticipantAddedEvent);

            // Device events
            OnAuxGetCaptureDevicesResponse +=
                new EventHandler<VoiceDevicesEventArgs>(connector_OnAuxGetCaptureDevicesResponse);
            OnAuxGetRenderDevicesResponse +=
                new EventHandler<VoiceDevicesEventArgs>(connector_OnAuxGetRenderDevicesResponse);

            // Generic status response
            OnVoiceResponse += new EventHandler<VoiceResponseEventArgs>(connector_OnVoiceResponse);

            // Account events
            OnAccountLoginResponse +=
                new EventHandler<VoiceAccountEventArgs>(connector_OnAccountLoginResponse);

            Logger.Log("Voice initialized", Helpers.LogLevel.Info);

            // If voice provisioning capability is already available,
            // proceed with voice startup.   Otherwise the EventQueueRunning
            // event will do it.
            System.Uri vCap =
                 Client.Network.CurrentSim.Caps.CapabilityURI("ProvisionVoiceAccountRequest");
            if (vCap != null)
                RequestVoiceProvision(vCap);
        }