Monado OpenXR Runtime
Loading...
Searching...
No Matches
Base implementations

The base module provide the default implementations of some of the XRT interfaces objects, such as the xrt_system and xrt_session. More...

Collaboration diagram for Base implementations:

Directories

directory base
 The base module implementation files.
 

Files

file  b_documentation.h
 Documentation for the base module.
 
file  b_hand_tracker.cpp
 Base implementation of xrt_hand_tracker.
 
file  b_hand_tracker.h
 Base implementation factory for xrt_hand_tracker.
 
file  b_hand_tracker.hpp
 C++ base implementation of xrt_hand_tracker.
 
file  b_space_overseer.c
 A implementation of the xrt_space_overseer interface.
 
file  b_space_overseer.h
 A implementation of the xrt_space_overseer interface.
 
file  b_system_devices.c
 Default implementation helpers for xrt_system_devices.
 
file  b_system_devices.h
 Default implementation helpers for xrt_system_devices.
 
file  b_timing_source.c
 Base timing source implementation.
 
file  b_timing_source.h
 Base timing source code.
 

Data Structures

struct  b_system_devices
 Helper struct to manage devices by implementing the xrt_system_devices. More...
 
struct  b_system_devices_static
 Helper struct to manage devices by implementing the xrt_system_devices, this has only static device roles. More...
 

Typedefs

typedef xrt_result_t(* b_hand_tracker_get_devices_func_t) (enum xrt_input_name input_name, struct xrt_system_devices *xsysd, void *data, uint32_t in_xdev_count, struct xrt_device **out_xdevs, uint32_t *out_xdev_count)
 Callback used by b_hand_tracker_create_with_cb to provide an ordered list of devices to try for input_name.
 

Functions

xrt_result_t b_hand_tracker_create (struct xrt_system_devices *xsysd, const struct xrt_hand_tracker_create_info *info, struct xrt_hand_tracker **out_xht)
 Create a base hand tracker from system devices.
 
xrt_result_t b_hand_tracker_create_with_cb (struct xrt_system_devices *xsysd, const struct xrt_hand_tracker_create_info *info, b_hand_tracker_get_devices_func_t get_devices, void *data, struct xrt_hand_tracker **out_xht)
 Create a base hand tracker that uses a callback to provide other devices to try first.
 
struct b_space_overseerb_space_overseer_create (struct xrt_session_event_sink *broadcast)
 Create a default implementation of a space overseer.
 
void b_space_overseer_legacy_setup (struct b_space_overseer *uso, struct xrt_device **xdevs, uint32_t xdev_count, struct xrt_device *head, const struct xrt_pose *local_offset, bool root_is_unbounded, bool per_app_local_spaces)
 Sets up the space overseer and all semantic spaces in a way that works with the old xrt_tracking_origin information.
 
void b_space_overseer_create_null_space (struct b_space_overseer *uso, struct xrt_space *parent, struct xrt_space **out_space)
 Creates a space without any offset, this is just for optimisation over a regular offset space.
 
void b_space_overseer_link_space_to_device (struct b_space_overseer *uso, struct xrt_space *xs, struct xrt_device *xdev)
 The space overseer internally keeps track the space that xrt_device is in, and then uses that mapping when creating pose spaces.
 
static struct b_system_devicesb_system_devices (struct xrt_system_devices *xsysd)
 Small inline helper to cast from xrt_system_devices.
 
struct b_system_devicesb_system_devices_allocate (void)
 Allocates a empty b_system_devices to be filled in by the caller, only the destroy function is filled in.
 
void b_system_devices_close (struct xrt_system_devices *xsysd)
 Destroys all devices and clears out the frame context, doesn't free the struct itself, useful for code embedding the system devices struct into other objects where it's not the first member or C++ classes.
 
static struct b_system_devices_staticb_system_devices_static (struct xrt_system_devices *xsysd)
 Small inline helper to cast from xrt_system_devices.
 
struct b_system_devices_staticb_system_devices_static_allocate (void)
 Allocates a empty b_system_devices to be filled in by the caller, only the destroy function is filled in.
 
void b_system_devices_static_finalize (struct b_system_devices_static *bsysds, struct xrt_device *left, struct xrt_device *right, struct xrt_device *gamepad)
 Finalizes the static struct with the given input devices, the system devices will always return these devices for the left and right role.
 

Detailed Description

The base module provide the default implementations of some of the XRT interfaces objects, such as the xrt_system and xrt_session.

Some of the objects are even extendable by external users of the the Monado codebase. These lives here instead of in other places such as the auxiliary or state tracker modules.

Typedef Documentation

◆ b_hand_tracker_get_devices_func_t

typedef xrt_result_t(* b_hand_tracker_get_devices_func_t) (enum xrt_input_name input_name, struct xrt_system_devices *xsysd, void *data, uint32_t in_xdev_count, struct xrt_device **out_xdevs, uint32_t *out_xdev_count)

#include <base/b_hand_tracker.h>

Callback used by b_hand_tracker_create_with_cb to provide an ordered list of devices to try for input_name.

Parameters
input_nameHand-tracking input being resolved.
xsysdSystem devices object that owns the static device list.
dataPrivate callback data.
in_xdev_countMaximum number of devices that fit in out_xdevs.
out_xdevsCaller-provided array to fill with devices in priority order.
out_xdev_countNumber of devices written to out_xdevs.

Function Documentation

◆ b_hand_tracker_create()

xrt_result_t b_hand_tracker_create ( struct xrt_system_devices xsysd,
const struct xrt_hand_tracker_create_info info,
struct xrt_hand_tracker **  out_xht 
)

#include <base/b_hand_tracker.h>

Create a base hand tracker from system devices.

◆ b_hand_tracker_create_with_cb()

xrt_result_t b_hand_tracker_create_with_cb ( struct xrt_system_devices xsysd,
const struct xrt_hand_tracker_create_info info,
b_hand_tracker_get_devices_func_t  get_devices,
void *  data,
struct xrt_hand_tracker **  out_xht 
)

#include <base/b_hand_tracker.h>

Create a base hand tracker that uses a callback to provide other devices to try first.

If a locked device is supplied in info, locked mode takes precedence. Otherwise this selects HandTrackerMode::Callback, defined and described in b_hand_tracker.hpp, and uses get_devices to resolve its inputs.

◆ b_space_overseer_create()

◆ b_space_overseer_create_null_space()

void b_space_overseer_create_null_space ( struct b_space_overseer uso,
struct xrt_space parent,
struct xrt_space **  out_space 
)

#include <base/b_space_overseer.h>

Creates a space without any offset, this is just for optimisation over a regular offset space.

References create_space().

Referenced by b_space_overseer_legacy_setup().

◆ b_space_overseer_legacy_setup()

void b_space_overseer_legacy_setup ( struct b_space_overseer uso,
struct xrt_device **  xdevs,
uint32_t  xdev_count,
struct xrt_device head,
const struct xrt_pose local_offset,
bool  root_is_unbounded,
bool  per_app_local_spaces 
)

◆ b_space_overseer_link_space_to_device()

void b_space_overseer_link_space_to_device ( struct b_space_overseer uso,
struct xrt_space xs,
struct xrt_device xdev 
)

#include <base/b_space_overseer.h>

The space overseer internally keeps track the space that xrt_device is in, and then uses that mapping when creating pose spaces.

This function allows builders to create a much more bespoke setup. This function adds a reference to the space.

References b_space_overseer::lock, xrt_device::str, U_LOG_W, b_space_overseer::xdev_map, and xrt_space::xrt_space_reference().

Referenced by add_device_helper(), and remote_builder_setup_space_overseer().

◆ b_system_devices()

static struct b_system_devices * b_system_devices ( struct xrt_system_devices xsysd)
inlinestatic

#include <base/b_system_devices.h>

Small inline helper to cast from xrt_system_devices.

◆ b_system_devices_allocate()

struct b_system_devices * b_system_devices_allocate ( void  )

#include <base/b_system_devices.h>

Allocates a empty b_system_devices to be filled in by the caller, only the destroy function is filled in.

References xrt_system_devices::create_hand_tracker, xrt_system_devices::destroy, and U_TYPED_CALLOC.

◆ b_system_devices_close()

void b_system_devices_close ( struct xrt_system_devices xsysd)

#include <base/b_system_devices.h>

Destroys all devices and clears out the frame context, doesn't free the struct itself, useful for code embedding the system devices struct into other objects where it's not the first member or C++ classes.

References ARRAY_SIZE, xrt_system_devices::static_xdevs, and b_system_devices::xfctx.

◆ b_system_devices_static()

static struct b_system_devices_static * b_system_devices_static ( struct xrt_system_devices xsysd)
inlinestatic

#include <base/b_system_devices.h>

Small inline helper to cast from xrt_system_devices.

◆ b_system_devices_static_allocate()

struct b_system_devices_static * b_system_devices_static_allocate ( void  )

#include <base/b_system_devices.h>

Allocates a empty b_system_devices to be filled in by the caller, only the destroy function is filled in.

References xrt_system_devices::create_hand_tracker, xrt_system_devices::feature_dec, xrt_system_devices::feature_inc, and U_TYPED_CALLOC.

Referenced by t_builder_roles_helper_open_system().

◆ b_system_devices_static_finalize()

void b_system_devices_static_finalize ( struct b_system_devices_static bsysds,
struct xrt_device left,
struct xrt_device right,
struct xrt_device gamepad 
)

#include <base/b_system_devices.h>

Finalizes the static struct with the given input devices, the system devices will always return these devices for the left and right role.

This function must be called before xrt_system_devices_get_roles is called.

References b_system_devices_static::cached, xrt_system_roles::gamepad, xrt_system_roles::left, xrt_system_devices::left, xrt_system_roles::right, xrt_system_devices::right, U_LOG_D, and xrt_system_roles::XRT_SYSTEM_ROLES_INIT.

Referenced by t_builder_roles_helper_open_system().