Monado OpenXR Runtime
oxr_roles.h File Reference

Helper functions for device role getting. More...

#include "oxr_objects.h"
Include dependency graph for oxr_roles.h:

Go to the source code of this file.

Data Structures

struct  oxr_roles
 Helper struct that wraps xrt_system_roles for OpenXR state tracker usage. More...
 

Macros

#define GET_STATIC_XDEV_BY_ROLE(SYS, ROLE)   (get_static_role_##ROLE((SYS)))
 
#define STATIC_WRAP(ROLE)
 
#define MAKE_GET_DYN_ROLES_FN(ROLE)
 
#define GET_XDEV_BY_ROLE(ROLES, ROLE)   (get_role_##ROLE((ROLES)))
 
#define MAKE_GET_DYN_ROLE_PROFILE_FN(ROLE)
 
#define GET_PROFILE_NAME_BY_ROLE(ROLES, ROLE)   (get_role_profile_##ROLE((ROLES)))
 

Functions

XRT_CHECK_RESULT XrResult oxr_roles_init_on_stack (struct oxr_logger *log, struct oxr_roles *roles, struct oxr_system *sys)
 Initialize an oxr_roles struct on the stack. More...
 
static struct xrt_deviceget_static_role_head (struct oxr_system *sys)
 
static struct xrt_deviceget_static_role_eyes (struct oxr_system *sys)
 
static struct xrt_deviceget_static_role_face (struct oxr_system *sys)
 
static struct xrt_deviceget_static_role_body (struct oxr_system *sys)
 
static struct xrt_deviceget_static_role_hand_tracking_unobstructed_left (struct oxr_system *sys)
 
static struct xrt_deviceget_static_role_hand_tracking_unobstructed_right (struct oxr_system *sys)
 
static struct xrt_deviceget_static_role_hand_tracking_conforming_left (struct oxr_system *sys)
 
static struct xrt_deviceget_static_role_hand_tracking_conforming_right (struct oxr_system *sys)
 
static struct xrt_deviceget_role_head (const struct oxr_roles *roles)
 
static struct xrt_deviceget_role_eyes (const struct oxr_roles *roles)
 
static struct xrt_deviceget_role_face (const struct oxr_roles *roles)
 
static struct xrt_deviceget_role_body (const struct oxr_roles *roles)
 
static struct xrt_deviceget_role_hand_tracking_unobstructed_left (const struct oxr_roles *roles)
 
static struct xrt_deviceget_role_hand_tracking_unobstructed_right (const struct oxr_roles *roles)
 
static struct xrt_deviceget_role_hand_tracking_conforming_left (const struct oxr_roles *roles)
 
static struct xrt_deviceget_role_hand_tracking_conforming_right (const struct oxr_roles *roles)
 
static struct xrt_deviceget_role_left (const struct oxr_roles *roles)
 
static struct xrt_deviceget_role_right (const struct oxr_roles *roles)
 
static struct xrt_deviceget_role_gamepad (const struct oxr_roles *roles)
 
static enum xrt_device_name get_role_profile_head (const struct oxr_roles *roles)
 
static enum xrt_device_name get_role_profile_eyes (const struct oxr_roles *roles)
 
static enum xrt_device_name get_role_profile_face (const struct oxr_roles *roles)
 
static enum xrt_device_name get_role_profile_body (const struct oxr_roles *roles)
 
static enum xrt_device_name get_role_profile_hand_tracking_unobstructed_left (const struct oxr_roles *roles)
 
static enum xrt_device_name get_role_profile_hand_tracking_unobstructed_right (const struct oxr_roles *roles)
 
static enum xrt_device_name get_role_profile_hand_tracking_conforming_left (const struct oxr_roles *roles)
 
static enum xrt_device_name get_role_profile_hand_tracking_conforming_right (const struct oxr_roles *roles)
 
static enum xrt_device_name get_role_profile_left (const struct oxr_roles *roles)
 
static enum xrt_device_name get_role_profile_right (const struct oxr_roles *roles)
 
static enum xrt_device_name get_role_profile_gamepad (const struct oxr_roles *roles)
 

Detailed Description

Helper functions for device role getting.

Macro Definition Documentation

◆ MAKE_GET_DYN_ROLE_PROFILE_FN

#define MAKE_GET_DYN_ROLE_PROFILE_FN (   ROLE)
Value:
static inline enum xrt_device_name get_role_profile_##ROLE(const struct oxr_roles *roles) \
{ \
return roles->roles.ROLE##_profile; \
}
Helper struct that wraps xrt_system_roles for OpenXR state tracker usage.
Definition: oxr_roles.h:30
xrt_device_name
A enum that is used to name devices so that the state trackers can reason about the devices easier.
Definition: xrt_defines.h:724

◆ MAKE_GET_DYN_ROLES_FN

#define MAKE_GET_DYN_ROLES_FN (   ROLE)
Value:
static inline struct xrt_device *get_role_##ROLE(const struct oxr_roles *roles) \
{ \
const int32_t xdev_idx = roles->roles.ROLE; \
struct xrt_system_devices *xsysd = roles->sys->xsysd; \
if (xdev_idx < 0 || xdev_idx >= (int32_t)xsysd->xdev_count) { \
return NULL; \
} \
return xsysd->xdevs[xdev_idx]; \
}
A single HMD or input device.
Definition: xrt_device.h:310
A collection of xrt_device, and an interface for identifying the roles they have been assigned.
Definition: xrt_system.h:214
struct xrt_device * xdevs[XRT_SYSTEM_MAX_DEVICES]
All devices known in the system.
Definition: xrt_system.h:221

◆ STATIC_WRAP

#define STATIC_WRAP (   ROLE)
Value:
static inline struct xrt_device *get_role_##ROLE(const struct oxr_roles *roles) \
{ \
return get_static_role_##ROLE(roles->sys); \
}