Monado OpenXR Runtime
wmr_hmd_controller.h
Go to the documentation of this file.
1// Copyright 2023 Jan Schmidt
2// SPDX-License-Identifier: BSL-1.0
3/*!
4 * @file
5 * @brief Implementation of tunnelled controller connection,
6 * that translates messages passing via an HP G2 or Sasmung Odyssey+ HMD
7 * @author Jan Schmidt <jan@centricular.com>
8 * @ingroup drv_wmr
9 */
10#include <stdint.h>
11
12#include "os/os_threading.h"
13#include "xrt/xrt_device.h"
14
15#include "wmr_controller_base.h"
16
17#pragma once
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
24{
25 struct wmr_controller_connection base;
26
27 /* Controller and HMD each hold a reference. It's
28 * only cleaned up once both release it. */
29 struct xrt_reference ref;
30 enum u_logging_level log_level;
31
32 uint8_t hmd_cmd_base;
33
34 /* Protect access when sending / receiving data */
35 struct os_mutex lock;
36 bool disconnected; /* Set to true once disconnect() is called */
37
38 struct wmr_hmd *hmd;
39};
40
42wmr_hmd_controller_create(struct wmr_hmd *hmd,
43 uint8_t hmd_cmd_base,
44 enum xrt_device_type controller_type,
45 uint16_t vid,
46 uint16_t pid,
47 enum u_logging_level log_level);
48
49struct xrt_device *
50wmr_hmd_controller_connection_get_controller(struct wmr_hmd_controller_connection *wcc);
51
52#ifdef __cplusplus
53}
54#endif
u_logging_level
Logging level enum.
Definition: u_logging.h:43
xrt_device_type
How an xrt_device can be used.
Definition: xrt_defines.h:786
Wrapper around OS threading native functions.
A wrapper around a native mutex.
Definition: os_threading.h:55
A connection for communicating with the controller.
Definition: wmr_controller_base.h:49
Definition: wmr_hmd_controller.h:24
Definition: wmr_hmd.h:72
A single HMD or input device.
Definition: xrt_device.h:241
struct xrt_hmd_parts * hmd
Null if this device does not interface with the users head.
Definition: xrt_device.h:253
A base class for reference counted objects.
Definition: xrt_defines.h:96
Common implementation for WMR controllers, handling shared behaviour such as communication,...
Header defining an xrt display or controller device.