Monado OpenXR Runtime
Loading...
Searching...
No Matches
u_system_helpers.h
Go to the documentation of this file.
1// Copyright 2022-2023, Collabora, Ltd.
2// Copyright 2026, NVIDIA CORPORATION.
3// SPDX-License-Identifier: BSL-1.0
4/*!
5 * @file
6 * @brief Helpers for probing and querying @ref xrt_system_devices.
7 * @author Jakob Bornecrantz <jakob@collabora.com>
8 * @ingroup aux_util
9 */
10
11#pragma once
12
13#include "xrt/xrt_instance.h"
14#include "xrt/xrt_results.h"
15#include "xrt/xrt_system.h"
16#include "xrt/xrt_tracking.h"
17
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23struct xrt_device;
26
27/*!
28 * Takes a @ref xrt_instance, gets the prober from it and then uses the prober
29 * to create a populated @ref xrt_system_devices struct from it.
30 *
31 * @ingroup aux_util
32 */
35 struct xrt_session_event_sink *broadcast,
36 struct xrt_system_devices **out_xsysd,
37 struct xrt_space_overseer **out_xso);
38
39/*!
40 * Looks through @ref xrt_system_devices's devices and returns the first device
41 * that supports hand tracking and the supplied input name.
42 *
43 * Used by target_builder_lighthouse to find Knuckles controllers in the list of
44 * devices returned, the legacy builder to find hand tracking devices, etc.
45 *
46 * @ingroup aux_util
47 */
48struct xrt_device *
50
51/*!
52 * Helper to get the first left (unobstructed) hand-tracking device,
53 * uses @ref u_system_devices_get_ht_device.
54 *
55 * @ingroup aux_util
56 */
57static inline struct xrt_device *
59{
60 return u_system_devices_get_ht_device(xsysd, XRT_INPUT_HT_UNOBSTRUCTED_LEFT);
61}
62
63/*!
64 * Helper to get the first (unobstructed) right hand-tracking device,
65 * uses @ref u_system_devices_get_ht_device.
66 *
67 * @ingroup aux_util
68 */
69static inline struct xrt_device *
71{
72 return u_system_devices_get_ht_device(xsysd, XRT_INPUT_HT_UNOBSTRUCTED_RIGHT);
73}
74
75/*!
76 * Helper to get the first left (conforming) hand-tracking device,
77 * uses @ref u_system_devices_get_ht_device.
78 *
79 * @ingroup aux_util
80 */
81static inline struct xrt_device *
83{
84 return u_system_devices_get_ht_device(xsysd, XRT_INPUT_HT_CONFORMING_LEFT);
85}
86
87/*!
88 * Helper to get the first (conforming) right hand-tracking device,
89 * uses @ref u_system_devices_get_ht_device.
90 *
91 * @ingroup aux_util
92 */
93static inline struct xrt_device *
95{
96 return u_system_devices_get_ht_device(xsysd, XRT_INPUT_HT_CONFORMING_RIGHT);
97}
98
99#ifdef __cplusplus
100}
101#endif
struct xrt_device * u_system_devices_get_ht_device(struct xrt_system_devices *xsysd, enum xrt_input_name name)
Looks through xrt_system_devices's devices and returns the first device that supports hand tracking a...
Definition u_system_helpers.c:70
static struct xrt_device * u_system_devices_get_ht_device_conforming_left(struct xrt_system_devices *xsysd)
Helper to get the first left (conforming) hand-tracking device, uses u_system_devices_get_ht_device.
Definition u_system_helpers.h:82
static struct xrt_device * u_system_devices_get_ht_device_conforming_right(struct xrt_system_devices *xsysd)
Helper to get the first (conforming) right hand-tracking device, uses u_system_devices_get_ht_device.
Definition u_system_helpers.h:94
static struct xrt_device * u_system_devices_get_ht_device_unobstructed_right(struct xrt_system_devices *xsysd)
Helper to get the first (unobstructed) right hand-tracking device, uses u_system_devices_get_ht_devic...
Definition u_system_helpers.h:70
xrt_result_t u_system_devices_create_from_prober(struct xrt_instance *xinst, struct xrt_session_event_sink *broadcast, struct xrt_system_devices **out_xsysd, struct xrt_space_overseer **out_xso)
Takes a xrt_instance, gets the prober from it and then uses the prober to create a populated xrt_syst...
Definition u_system_helpers.c:41
static struct xrt_device * u_system_devices_get_ht_device_unobstructed_left(struct xrt_system_devices *xsysd)
Helper to get the first left (unobstructed) hand-tracking device, uses u_system_devices_get_ht_device...
Definition u_system_helpers.h:58
xrt_input_name
Every internal input source known to monado with a baked in type.
Definition xrt_defines.h:930
enum xrt_result xrt_result_t
Result type used across Monado.
A single HMD or input device.
Definition xrt_device.h:310
enum xrt_device_name name
Enum identifier of the device.
Definition xrt_device.h:312
This interface acts as a root object for Monado.
Definition xrt_instance.h:120
Used internally from producers of events to push events into session, some sinks might multiplex even...
Definition xrt_session.h:237
Object that oversees and manages spaces, one created for each XR system.
Definition xrt_space.h:97
A collection of xrt_device, and an interface for identifying the roles they have been assigned.
Definition xrt_system.h:214
Header for xrt_instance object.
Internal result type for XRT.
Header for system objects.
Header defining the tracking system integration in Monado.