Exemplo n.º 1
0
        public DeviceResources(IFactory factory, IDeviceHandle <IHMDDevice, IHMDInfo> handle)
        {
            if (factory == null || handle == null)
            {
                throw new ArgumentNullException();
            }

            Info   = handle.DeviceInfo;
            Device = handle.CreateDevice();
            Sensor = Device.Sensor;
            Fusion = factory.CreateSensorFusion(Sensor);

            if (Info == null)
            {
                throw new ArgumentNullException();
            }
            if (Device == null)
            {
                throw new ArgumentNullException();
            }
            if (Sensor == null)
            {
                throw new ArgumentNullException();
            }

            Key = new DeviceKey(Sensor.Info);
        }
Exemplo n.º 2
0
        public void TestSensorDevices()
        {
// ReSharper disable PossibleMultipleEnumeration

            IDeviceManager mgr;

            using (mgr = Factory.CreateDeviceManager())
            {
                mgr.RefCount.Should().Be(1);
                mgr.IsDisposed.Should().BeFalse();
                var devices = mgr.SensorDevices;
                devices.Should().NotBeNull();
                foreach (var desc in devices)
                {
                    desc.DeviceType.Should().NotBe(DeviceType.None);
                    desc.Should().NotBeNull();
                    desc.IsAvailable.Should().BeTrue();
                    desc.IsCreated.Should().BeFalse();

                    using (ISensorDevice sensor = desc.CreateDevice())
                    {
                        sensor.Type.Should().BeSameAs(desc.DeviceType);
                        sensor.Should().NotBeNull();
                    }

                    desc.IsCreated.Should().BeTrue();
                }
            }
            mgr.RefCount.Should().Be(0);
            mgr.IsDisposed.Should().BeTrue();

// ReSharper restore PossibleMultipleEnumeration
        }
Exemplo n.º 3
0
        public SensorFusion(ISensorDevice sensorDevice)
        {
            if (sensorDevice == null)
            {
                throw new ArgumentNullException();
            }

            _sensorDevice = sensorDevice;
        }
Exemplo n.º 4
0
		public DeviceResources(IFactory factory, IDeviceHandle<IHMDDevice, IHMDInfo> handle)
		{
			if (factory == null || handle == null)
				throw new ArgumentNullException();

			Info = handle.DeviceInfo;
			Device = handle.CreateDevice();
			Sensor = Device.Sensor;
			Fusion = factory.CreateSensorFusion(Sensor);

			if (Info == null)
				throw new ArgumentNullException();
			if (Device == null)
				throw new ArgumentNullException();
			if (Sensor == null)
				throw new ArgumentNullException();

			Key = new DeviceKey(Sensor.Info);
		}
Exemplo n.º 5
0
        public DeviceResources(IFactory factory, IDeviceHandle<IHMDDevice, IHMDInfo> handle)
        {
            if (factory == null || handle == null)
                throw new ArgumentNullException();

            Info = handle.DeviceInfo;
            Device = handle.CreateDevice();
            Sensor = Device.Sensor;
            Fusion = factory.CreateSensorFusion(Sensor);

            if (Info == null)
                throw new ArgumentNullException();
            if (Device == null)
                throw new ArgumentNullException();
            if (Sensor == null)
                System.Diagnostics.Trace.TraceWarning("Unable to create Sensor");

            if (Sensor != null)
                Key = new DeviceKey(Sensor.Info);
        }
Exemplo n.º 6
0
 /// <summary>
 ///     Creates a high-level object which accumulates information from the given
 ///     sensor and exposes it through various properties, such as orientation, acceleration
 ///     etc..
 /// </summary>
 /// <remarks>
 ///     The caller is responsible for disposing of the returned object.
 /// </remarks>
 /// <param name="sensorDevice">The sensor device who's input is to be processed</param>
 /// <returns></returns>
 /// <exception cref="ArgumentNullException">In case null is passed for the sensor device</exception>
 public static ISensorFusion CreateSensorFusion(ISensorDevice sensorDevice = null)
 {
     return(_platformFactory.CreateSensorFusion(sensorDevice));
 }
Exemplo n.º 7
0
 public HMDDevice(IDevice parent, ISensorDevice sensor, HMDInfo info)
 {
     _sensor = sensor;
     _parent = parent;
     _info   = info;
 }
Exemplo n.º 8
0
 public ISensorFusion CreateSensorFusion(ISensorDevice sensorDevice)
 {
     return(new SensorFusion(sensorDevice));
 }
Exemplo n.º 9
0
		public HMDDevice(IDevice parent, ISensorDevice sensor, HMDInfo info)
		{
			_sensor = sensor;
			_parent = parent;
			_info = info;
		}
Exemplo n.º 10
0
		/// <summary>
		///     Creates a high-level object which accumulates information from the given
		///     sensor and exposes it through various properties, such as orientation, acceleration
		///     etc..
		/// </summary>
		/// <remarks>
		///     The caller is responsible for disposing of the returned object.
		/// </remarks>
		/// <param name="sensorDevice">The sensor device who's input is to be processed</param>
		/// <returns></returns>
		/// <exception cref="ArgumentNullException">In case null is passed for the sensor device</exception>
		public static ISensorFusion CreateSensorFusion(ISensorDevice sensorDevice = null)
		{
			return _platformFactory.CreateSensorFusion(sensorDevice);
		}
Exemplo n.º 11
0
		public ISensorFusion CreateSensorFusion(ISensorDevice sensorDevice)
		{
			return new SensorFusion(sensorDevice);
		}