Monado OpenXR Runtime
Loading...
Searching...
No Matches
b_tracked_device.h
Go to the documentation of this file.
1// Copyright 2026, NVIDIA CORPORATION.
2// SPDX-License-Identifier: BSL-1.0
3/*!
4 * @file
5 * @brief Per-device tracking state for the space overseer.
6 *
7 * @ingroup base
8 */
9
10#pragma once
11
12#include "xrt/xrt_space.h"
13
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19
20struct b_tracked_device;
21
22
23typedef void (*b_tracked_device_pose_space_cb)(struct xrt_space *xs, void *priv);
24
25
26/*!
27 * Create a tracked device with a reference to @p space. The @p xdev pointer is
28 * borrowed and only used for debug printing. The device must be removed from the
29 * space overseer before it is destroyed, or the space overseer must be
30 * destroyed first.
31 *
32 * @public @memberof b_tracked_device
33 */
34struct b_tracked_device *
35b_tracked_device_create(struct xrt_device *xdev, struct xrt_space *space);
36
37/*!
38 * @public @memberof b_tracked_device
39 */
40void
41b_tracked_device_reference(struct b_tracked_device **dst, struct b_tracked_device *src);
42
43/*!
44 * Returns the device space without taking a reference.
45 *
46 * @public @memberof b_tracked_device
47 */
48struct xrt_space *
49b_tracked_device_get_space(struct b_tracked_device *btd);
50
51/*!
52 * Returns the device, only to be used for debug printing.
53 *
54 * @public @memberof b_tracked_device
55 */
56struct xrt_device *
57b_tracked_device_get_xdev(struct b_tracked_device *btd);
58
59/*!
60 * Track a pose space owned by this device. The caller must hold the space
61 * overseer graph lock for writing.
62 *
63 * @public @memberof b_tracked_device
64 */
65void
66b_tracked_device_track_pose_space_write_locked(struct b_tracked_device *btd, struct xrt_space *xs);
67
68/*!
69 * Stop tracking a pose space. The caller must hold the space overseer graph
70 * lock for writing.
71 *
72 * @public @memberof b_tracked_device
73 */
74void
75b_tracked_device_untrack_pose_space_write_locked(struct b_tracked_device *btd, struct xrt_space *xs);
76
77/*!
78 * Iterate tracked pose spaces. The caller must hold the space overseer graph
79 * lock, for writing if @p cb modifies the pose spaces.
80 *
81 * @public @memberof b_tracked_device
82 */
83void
84b_tracked_device_for_each_pose_space_read_locked(struct b_tracked_device *btd,
85 b_tracked_device_pose_space_cb cb,
86 void *priv);
87
88/*!
89 * Drop all tracked pose spaces without destroying them. The caller must hold the
90 * space overseer graph lock for writing.
91 *
92 * @public @memberof b_tracked_device
93 */
94void
95b_tracked_device_clear_pose_spaces_write_locked(struct b_tracked_device *btd);
96
97
98#ifdef __cplusplus
99}
100#endif
Definition b_tracked_device.c:19
struct b_tracked_device * b_tracked_device_create(struct xrt_device *xdev, struct xrt_space *space)
Create a tracked device with a reference to space.
Definition b_tracked_device.c:48
struct xrt_device * xdev
Borrowed pointer, only used for debug printing.
Definition b_tracked_device.c:28
A single HMD or input device.
Definition xrt_device.h:345
A space very similar to a OpenXR XrSpace but not a full one-to-one mapping, but used to power XrSpace...
Definition xrt_space.h:32
Header defining xrt space and space overseer.