forked from terminal29/Simple-OpenVR-Driver-Tutorial
-
Notifications
You must be signed in to change notification settings - Fork 14
/
IVRDriver.hpp
79 lines (62 loc) · 2.59 KB
/
IVRDriver.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#pragma once
#include <memory>
#include <vector>
#include <chrono>
#include <Driver/IVRDevice.hpp>
namespace ExampleDriver {
typedef std::variant<std::monostate, std::string, int, float, bool> SettingsValue;
class IVRDriver : protected vr::IServerTrackedDeviceProvider {
public:
/// <summary>
/// Returns all devices being managed by this driver
/// </summary>
/// <returns>All managed devices</returns>
virtual std::vector<std::shared_ptr<IVRDevice>> GetDevices() = 0;
/// <summary>
/// Returns all OpenVR events that happened on the current frame
/// </summary>
/// <returns>Current frame's OpenVR events</returns>
virtual std::vector<vr::VREvent_t> GetOpenVREvents() = 0;
/// <summary>
/// Returns the milliseconds between last frame and this frame
/// </summary>
/// <returns>MS between last frame and this frame</returns>
virtual std::chrono::milliseconds GetLastFrameTime() = 0;
/// <summary>
/// Adds a device to the driver
/// </summary>
/// <param name="device">Device instance</param>
/// <returns>True on success, false on failure</returns>
virtual bool AddDevice(std::shared_ptr<IVRDevice> device) = 0;
/// <summary>
/// Returns the value of a settings key
/// </summary>
/// <param name="key">The settings key</param>
/// <returns>Value of the key, std::monostate if the value is malformed or missing</returns>
virtual SettingsValue GetSettingsValue(std::string key) = 0;
/// <summary>
/// Gets the OpenVR VRDriverInput pointer
/// </summary>
/// <returns>OpenVR VRDriverInput pointer</returns>
virtual vr::IVRDriverInput* GetInput() = 0;
/// <summary>
/// Gets the OpenVR VRDriverProperties pointer
/// </summary>
/// <returns>OpenVR VRDriverProperties pointer</returns>
virtual vr::CVRPropertyHelpers* GetProperties() = 0;
/// <summary>
/// Gets the OpenVR VRServerDriverHost pointer
/// </summary>
/// <returns>OpenVR VRServerDriverHost pointer</returns>
virtual vr::IVRServerDriverHost* GetDriverHost() = 0;
/// <summary>
/// Writes a log message
/// </summary>
/// <param name="message">Message to log</param>
virtual void Log(std::string message) = 0;
virtual inline const char* const* GetInterfaceVersions() override {
return vr::k_InterfaceVersions;
};
virtual ~IVRDriver() {}
};
}