public void Dispose() { _continue = false; if (_headPoseCallbackInstance != null) { Interop.tobii_head_pose_unsubscribe(_device.Handle); } _device.Dispose(); _thread.Join(300); _headPoseCallbackInstance = null; }
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(); } }
public static extern tobii_error_t tobii_head_pose_subscribe(IntPtr device, tobii_head_pose_callback_t callback);