Пример #1
0
        public void Dispose()
        {
            _continue = false;
            if (_headPoseCallbackInstance != null)
            {
                Interop.tobii_head_pose_unsubscribe(_device.Handle);
            }

            _device.Dispose();
            _thread.Join(300);
            _headPoseCallbackInstance = null;
        }
Пример #2
0
        internal TobiiTracker(ApiContext api)
        {
            _device = api
                      .GetDeviceUrls()
                      .Select(u => new DeviceContext(api.Handle, u))
                      .FirstOrDefault();

            if (_device != null)
            {
                var result = Interop.tobii_stream_supported(_device.Handle, tobii_stream_t.TOBII_STREAM_HEAD_POSE, out var headPoseSupported);
                if (result == tobii_error_t.TOBII_ERROR_NO_ERROR && headPoseSupported)
                {
                    _headPoseCallbackInstance = HeadPoseCallback;
                    result = Interop.tobii_head_pose_subscribe(_device.Handle, _headPoseCallbackInstance);
                }

                _thread = new Thread(DataPump);
                _thread.IsBackground = true;
                _thread.Name         = $"Headpose datapump for {_device.SerialNumber}";
                _thread.Start();
            }
        }
Пример #3
0
 public static extern tobii_error_t tobii_head_pose_subscribe(IntPtr device, tobii_head_pose_callback_t callback);