private void OnPeripheralStateChange(object sender, PeripheralStateChangeEventArgs eventArguments)
        {
            Sdk.Logger.Log("Is " + eventArguments.Peripheral.Name + " Connected? " + eventArguments.Connected);

            if (eventArguments.Peripheral is ControllerPeripheral)
            {
                // stopping the pairing process
                Sdk.Tracking.StopPairing();
            }
            else if (eventArguments.Peripheral is HmdPeripheral)
            {
                if (eventArguments.Peripheral.Connected)
                {
                    KpiTracking.TrackSceneLoadTime();

                    // dispatching the HMD connected event
                    if (StereoSetupEvents.OnHmdConnected != null)
                    {
                        StereoSetupEvents.OnHmdConnected();
                    }
                }
                else
                {
                    // dispatching the HMD disconnected event
                    if (StereoSetupEvents.OnHmdDisconnected != null)
                    {
                        StereoSetupEvents.OnHmdDisconnected();
                    }
                }
            }
        }
        private void OnPeripheralStateChange(object sender, PeripheralStateChangeEventArgs eventArguments)
        {
            Debug.Log("OnPeripheralStateChange: " + eventArguments.Peripheral + " " + eventArguments.Connected);

            // Peripheral Type
            if (eventArguments.Peripheral is HmdPeripheral)
            {
                // Update the Start Demo Button color
                StartGameButton.GetComponent <Image>().color = (eventArguments.Connected) ? Color.green : Color.white;
            }
            else
            {
                if (eventArguments.Connected)
                {
                    // Stop Pairing now that it is found.
                    CancelInvoke("StopPairing");
                    StopPairing();

                    // Update the pair button color
                    PairButton.GetComponent <Image>().color = Color.green;
                }
                else
                {
                    // Update the pair button color
                    PairButton.GetComponent <Image>().color = Color.white;
                }
            }
        }
Пример #3
0
        private void OnPeripheralStateChange(object sender, PeripheralStateChangeEventArgs eventArguments)
        {
            Sdk.Logger.Log("Is " + eventArguments.Peripheral.Name + " Connected? " + eventArguments.Connected);

            if (eventArguments.Connected && eventArguments.Peripheral is ControllerPeripheral)
            {
                StartCoroutine(SetSaberColor(eventArguments.Peripheral as ControllerPeripheral));
            }
        }
Пример #4
0
 void OnPeripheralStateChange(object sender, PeripheralStateChangeEventArgs eventArguments)
 {
     if (eventArguments.Peripheral is HmdPeripheral)
     {
     }
     else
     {
         SetCtrState(eventArguments.Peripheral);
     }
 }
Пример #5
0
        /// <summary>
        /// OnPeripheralStateChange,Update State of Peripheral
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="eventArguments"></param>
        private void OnPeripheralStateChange(object sender, PeripheralStateChangeEventArgs eventArguments)
        {
            Sdk.Logger.Log("Is " + eventArguments.Peripheral.Name + " Connected? " + eventArguments.Connected);

            //Connected
            if (eventArguments.Connected)
            {
                // Peripheral Type
                if (eventArguments.Peripheral is HmdPeripheral)
                {
                    mHmdController = (HmdPeripheral)eventArguments.Peripheral;

                    //Output the Info of Hmd
                    OutputHmdInfo(mHmdController);
                }
                else
                {
                    if (eventArguments.Peripheral.GetModelName() == MirageAR_DeviceConstants.CONTROLLER_UNIVERSAL_MODELNAME)
                    {
                        controllerType       = MirageAR_DeviceConstants.ControllerType.UniversalController;
                        mUniversalController = (ControllerPeripheral)eventArguments.Peripheral;
                    }
                    else if (eventArguments.Peripheral.GetModelName() == MirageAR_DeviceConstants.CONTROLLER_SABER_MODELNAME)
                    {
                        controllerType   = MirageAR_DeviceConstants.ControllerType.SaberController;
                        mSaberController = (ControllerPeripheral)eventArguments.Peripheral;
                    }
                    else
                    {
                        Sdk.Logger.Log("Unknow Controller" + mUniversalController.GetDeviceName());
                    }

                    //Output the Info of Controller
                    OutputControllerInfo(eventArguments.Peripheral);
                }
            }
            else //DisConnected
            {
                if (eventArguments.Peripheral is HmdPeripheral)
                {
                    mHmdController = null;
                }
                else
                {
                    if (eventArguments.Peripheral.GetModelName() == MirageAR_DeviceConstants.CONTROLLER_UNIVERSAL_MODELNAME)
                    {
                        mUniversalController = null;
                    }
                    else if (eventArguments.Peripheral.GetModelName() == MirageAR_DeviceConstants.CONTROLLER_SABER_MODELNAME)
                    {
                        mSaberController = null;
                    }
                }
            }
        }
Пример #6
0
        protected void OnPeripheralDisconnected(object sender, PeripheralStateChangeEventArgs eventArgs)
        {
            if (eventArgs.Connected)
            {
                return;
            }

            if (eventArgs.Peripheral is HmdPeripheral)
            {
                ShowErrorPanel(HmdDisconnectedPanel, true);
            }
            else if (eventArgs.Peripheral is ControllerPeripheral)
            {
                ShowErrorPanel(SaberNotSyncedPanel, true);
            }
        }
Пример #7
0
        /// <summary>
        /// Raises the connection changed event.
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="eventArguments">Event arguments.</param>
        private void OnConnectionChanged(object sender, PeripheralStateChangeEventArgs eventArguments)
        {
            if (eventArguments.Peripheral.GetType() != PeripheralType())
            {
                // peripheral is not the right type
                return;
            }

            if (!eventArguments.Connected)
            {
                SetState(StateEnum.Unsynched);
            }
            else if (state == StateEnum.Unsynched)
            {
                SetState(StateEnum.Synched);
            }
        }
Пример #8
0
        void OnPeripheralStateChange(object sender, PeripheralStateChangeEventArgs eventArguments)
        {
            if (eventArguments.Peripheral is ControllerPeripheral)
            {
                if (eventArguments.Peripheral.ControllerInput.connectionState == Ximmerse.InputSystem.DeviceConnectionState.Connected)
                {
                    InitSearchText(true);

                    if (isPairing)
                    {
                        isPairing = false;
                        VisionSDK.Instance.Tracking.StopPairing();
                    }
                }
                else
                {
                    InitSearchText(false);
                }
            }
        }
Пример #9
0
 private void OnPeripheralStateChange(object sender, PeripheralStateChangeEventArgs eventArguments)
 {
     Debug.Log("OnPeripheralStateChange: " + eventArguments.Peripheral + " " + eventArguments.Connected);
 }