13#include <unordered_map>
15#include <condition_variable>
21#include "openvr_driver.h"
28 using ContextPtr = std::shared_ptr<Context>;
30 vr::ITrackedDeviceServerDriver *driver;
32 const std::string &steam_install;
35 vr::ITrackedDeviceServerDriver *p_driver,
37 const std::string &p_stream_install)
38 : ctx{p_ctx}, driver{p_driver}, serial{p_serial}, steam_install{p_stream_install}
56 get_input_from_name(std::string_view
name);
62 update_pose(
const vr::DriverPose_t &newPose)
const;
69 handle_properties(
const vr::PropertyWrite_t *batch, uint32_t count);
80 std::shared_ptr<Context> ctx;
81 vr::PropertyContainerHandle_t container_handle{0};
82 std::unordered_map<std::string_view, xrt_input *> inputs_map;
83 std::vector<xrt_input> inputs_vec;
84 inline static xrt_pose chaperone = XRT_POSE_IDENTITY;
86 std::string manufacturer;
88 float vsync_to_photon_ns{0.f};
89 bool provides_battery_status{
false};
94 handle_property_write(
const vr::PropertyWrite_t &prop);
97 vr::ITrackedDeviceServerDriver *driver;
98 uint64_t current_frame{0};
100 std::mutex frame_mutex;
103 init_chaperone(
const std::string &steam_install);
114 vr::IVRDisplayComponent *display;
123 SetDisplayEyeToHead(uint32_t unWhichDevice,
124 const vr::HmdMatrix34_t &eyeToHeadLeft,
125 const vr::HmdMatrix34_t &eyeToHeadRight);
129 uint64_t at_timestamp_ns,
139 set_hmd_parts(std::unique_ptr<Parts> parts);
148 std::unique_ptr<Parts> hmd_parts{
nullptr};
151 handle_property_write(
const vr::PropertyWrite_t &prop)
override;
154 set_nominal_frame_interval(uint64_t interval_ns);
156 std::condition_variable hmd_parts_cv;
157 std::mutex hmd_parts_mut;
169 set_haptic_handle(vr::VRInputComponentHandle_t handle);
175 get_finger_from_name(std::string_view
name);
179 int64_t desired_timestamp_ns,
181 int64_t *out_timestamp_ns);
191 set_input_class(
const InputClass *input_class);
194 vr::VRInputComponentHandle_t haptic_handle{0};
195 std::unique_ptr<xrt_output> output{
nullptr};
196 bool has_index_hand_tracking{
false};
197 std::vector<IndexFingerInput> finger_inputs_vec;
198 std::unordered_map<std::string_view, IndexFingerInput *> finger_inputs_map;
199 uint64_t hand_tracking_timestamp;
205 handle_property_write(
const vr::PropertyWrite_t &prop)
override;
Definition: context.hpp:57
Definition: device.hpp:161
Definition: device.hpp:48
void get_pose(uint64_t at_timestamp_ns, xrt_space_relation *out_relation)
Helper to use the m_relation_history member.
Definition: device.cpp:415
xrt_result_t update_inputs()
Update any attached inputs.
Definition: device.cpp:382
virtual xrt_result_t get_tracked_pose(xrt_input_name name, uint64_t at_timestamp_ns, xrt_space_relation *out_relation)=0
Maps to xrt_device::get_tracked_pose.
Definition: device.hpp:107
SteamVR driver context - implements xrt_tracking_origin and IVRDriverContext.
xrt_hand
Enumeration for left and right hand.
Definition: xrt_defines.h:1354
xrt_input_name
Every internal input source known to monado with a baked in type.
Definition: xrt_defines.h:1298
enum xrt_result xrt_result_t
Result type used across Monado.
xrt_output_name
Name of a output with a baked in type.
Definition: xrt_defines.h:1801
Small utility for keeping track of the history of an xrt_space_relation, ie.
Definition: device.hpp:27
Definition: device.hpp:112
Definition: m_relation_history.cpp:46
A single HMD or input device.
Definition: xrt_device.h:241
void(* set_output)(struct xrt_device *xdev, enum xrt_output_name name, const union xrt_output_value *value)
Set a output value.
Definition: xrt_device.h:412
void(* get_hand_tracking)(struct xrt_device *xdev, enum xrt_input_name name, int64_t desired_timestamp_ns, struct xrt_hand_joint_set *out_value, int64_t *out_timestamp_ns)
Get relationship of hand joints to the tracking origin space as the base space.
Definition: xrt_device.h:350
void(* get_view_poses)(struct xrt_device *xdev, const struct xrt_vec3 *default_eye_relation, int64_t at_timestamp_ns, uint32_t view_count, struct xrt_space_relation *out_head_relation, struct xrt_fov *out_fovs, struct xrt_pose *out_poses)
Get the per-view pose in relation to the view space.
Definition: xrt_device.h:451
xrt_result_t(* get_battery_status)(struct xrt_device *xdev, bool *out_present, bool *out_charging, float *out_charge)
Get battery status information.
Definition: xrt_device.h:528
enum xrt_device_name name
Enum identifier of the device.
Definition: xrt_device.h:243
xrt_result_t(* get_tracked_pose)(struct xrt_device *xdev, enum xrt_input_name name, int64_t at_timestamp_ns, struct xrt_space_relation *out_relation)
Get relationship of a tracked device to the tracking origin space as the base space.
Definition: xrt_device.h:322
bool(* compute_distortion)(struct xrt_device *xdev, uint32_t view, float u, float v, struct xrt_uv_triplet *out_result)
Compute the distortion at a single point.
Definition: xrt_device.h:473
Describes a projection matrix fov.
Definition: xrt_defines.h:486
Joint set type used for hand tracking.
Definition: xrt_defines.h:1397
All of the device components that deals with interfacing to a users head.
Definition: xrt_device.h:90
A pose composed of a position and orientation.
Definition: xrt_defines.h:465
A relation with two spaces, includes velocity and acceleration.
Definition: xrt_defines.h:657
Represents a uv triplet for distortion, basically just three xrt_vec2.
Definition: xrt_defines.h:261
A 3 element vector with single floats.
Definition: xrt_defines.h:271
A union of all output types.
Definition: xrt_defines.h:1887
Header defining an xrt display or controller device.