Example #1
0
        /// <summary>
        /// Output the Info of Controller
        /// </summary>
        private void OutputControllerInfo(Peripheral peripheral)
        {
            if (!peripheral.Connected)
            {
                return;
            }

            Sdk.Logger.Log("Controller Device Name: " + peripheral.GetDeviceName());
            Sdk.Logger.Log("Controller FW Info: " + peripheral.GetFirmwareVersion());
            Sdk.Logger.Log("Controller Modle Name: " + peripheral.GetModelName());
            Sdk.Logger.Log("Controller Serial Number: " + peripheral.GetSerialNumber());
            Sdk.Logger.Log("Controller Battery: " + peripheral.GetBatteryLevel());
        }
Example #2
0
        /// <summary>
        /// Check the State of the Peripheral
        /// </summary>
        private void CheckPeripheralState()
        {
            //Check The Cotroller Peripheral State
            Peripheral controllerPeripheral = Sdk.Connections.GetPeripheral("XCobra-0");

            if (controllerPeripheral != null && controllerPeripheral.Connected)
            {
                if (controllerPeripheral.GetModelName() == MirageAR_DeviceConstants.CONTROLLER_UNIVERSAL_MODELNAME)
                {
                    controllerType       = MirageAR_DeviceConstants.ControllerType.UniversalController;
                    mUniversalController = (ControllerPeripheral)controllerPeripheral;
                }
                else if (controllerPeripheral.GetModelName() == MirageAR_DeviceConstants.CONTROLLER_SABER_MODELNAME)
                {
                    controllerType   = MirageAR_DeviceConstants.ControllerType.SaberController;
                    mSaberController = (ControllerPeripheral)controllerPeripheral;
                }
                else
                {
                    Sdk.Logger.Log("Unknow Controller" + controllerPeripheral.GetDeviceName());
                }

                //Output the Info of Controller
                OutputControllerInfo(controllerPeripheral);
            }

            //Check The Hmd Peripheral State
            HmdPeripheral hmdPeripheral = (HmdPeripheral)Sdk.Connections.GetPeripheral("XHawk-0");

            if (hmdPeripheral != null && hmdPeripheral.Connected)
            {
                mHmdController = hmdPeripheral;

                //Output the Info of Hmd
                OutputHmdInfo(mHmdController);
            }
        }