Example #1
0
        internal override void SetDeviceConfiguration(WearableDeviceConfig config)
        {
                        #if UNITY_EDITOR
            USBDeviceConfiguration deviceConfig = new USBDeviceConfiguration
            {
                intervalMilliseconds  = (int)WearableTools.SensorUpdateIntervalToMilliseconds(config.updateInterval),
                sensorRotationNineDof = config.rotationNineDof.isEnabled ? 1 : 0,
                sensorRotationSixDof  = config.rotationSixDof.isEnabled ? 1 : 0,
                sensorGyroscope       = config.gyroscope.isEnabled ? 1 : 0,
                sensorAccelerometer   = config.accelerometer.isEnabled ? 1 : 0,
                gestureHeadNod        = config.headNodGesture.isEnabled ? 1 : 0,
                gestureHeadShake      = config.headShakeGesture.isEnabled ? 1 : 0,
                gestureDoubleTap      = config.doubleTapGesture.isEnabled ? 1 : 0,
                gestureTouchAndHold   = config.touchAndHoldGesture.isEnabled ? 1 : 0,
                gestureInput          = config.inputGesture.isEnabled ? 1 : 0,
                gestureAffirmative    = config.affirmativeGesture.isEnabled ? 1 : 0,
                gestureNegative       = config.negativeGesture.isEnabled ? 1 : 0
            };

            WearableUSBSetDeviceConfiguration(deviceConfig);
                        #endif

            // Assume the configuration succeeded, because it generally will. Failed configs will show up when we poll
            // for status flags, and adjust the internal config as necessary.
            _config = config.Clone();
        }
Example #2
0
 private void PollForDeviceConfig()
 {
     if (WaitingForDeviceConfig)
     {
                         #if UNITY_EDITOR
         bool complete = WearableUSBHasReceivedDeviceConfiguration();
         if (complete)
         {
             USBDeviceConfiguration config = WearableUSBGetDeviceConfiguration();
             _config.updateInterval                = WearableTools.MillisecondsToClosestSensorUpdateInterval(config.intervalMilliseconds);
             _config.accelerometer.isEnabled       = config.sensorAccelerometer != 0;
             _config.gyroscope.isEnabled           = config.sensorGyroscope != 0;
             _config.rotationNineDof.isEnabled     = config.sensorRotationNineDof != 0;
             _config.rotationSixDof.isEnabled      = config.sensorRotationSixDof != 0;
             _config.headNodGesture.isEnabled      = config.gestureHeadNod != 0;
             _config.headShakeGesture.isEnabled    = config.gestureHeadShake != 0;
             _config.doubleTapGesture.isEnabled    = config.gestureDoubleTap != 0;
             _config.touchAndHoldGesture.isEnabled = config.gestureTouchAndHold != 0;
             _config.inputGesture.isEnabled        = config.gestureInput != 0;
             _config.affirmativeGesture.isEnabled  = config.gestureAffirmative != 0;
             _config.negativeGesture.isEnabled     = config.gestureNegative != 0;
             OnReceivedDeviceConfiguration(_config.Clone());
         }
                         #endif
     }
 }
Example #3
0
 private static extern void WearableUSBSetDeviceConfiguration(USBDeviceConfiguration deviceConfig);