Ocean
platform/meta/quest/Device.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #ifndef META_OCEAN_PLATFORM_META_QUEST_DEVICE_H
9 #define META_OCEAN_PLATFORM_META_QUEST_DEVICE_H
10 
12 
13 namespace Ocean
14 {
15 
16 namespace Platform
17 {
18 
19 namespace Meta
20 {
21 
22 namespace Quest
23 {
24 
25 /**
26  * This class implements functions for Meta's Quest devices.
27  * @ingroup platformmetaquest
28  */
29 class Device
30 {
31  public:
32 
33  /**
34  * Definition of individual device types.
35  */
36  enum DeviceType : uint32_t
37  {
38  /// Unknown device.
39  DT_UNKNOWN = 0u,
40  /// Quest device, version 1.
42  /// Quest device, version 2.
44  /// Quest device, version 3.
46  // Quest device, version 3S.
48  /// Quest Pro device.
50 
51  /// Exclusive end of device types.
53  };
54 
55  protected:
56 
57  /// Definition of an invalid enum value for quest devices.
58  static constexpr uint32_t invalidQuestDeviceValue_ = 1024u;
59 
60  public:
61 
62  /**
63  * Returns the type of the device.
64  * @return The device type, DT_UNKNOWN if unknown
65  */
67 
68  /**
69  * Returns the name of the device.
70  * @return The device name, "Unknown" if unknown
71  */
72  static inline std::string deviceName();
73 
74  /**
75  * Returns the name of a device.
76  * @param deviceType The device type for which the name will be returned
77  * @return The device name, "Unknown" if unknown
78  */
79  static std::string deviceName(const DeviceType deviceType);
80 };
81 
82 inline std::string Device::deviceName()
83 {
84  return deviceName(deviceType());
85 }
86 
87 #ifdef OCEAN_PLATFORM_META_QUEST_USE_EXTERNAL_DEVICE_NAME
88 
89 /**
90  * Returns the type of the device.
91  * @param productModel The product model for which the enum type will be returned
92  * @param productName The product name for which the enum type will be returned
93  * @return The device type, DT_UNKNOWN if unknown
94  */
95 uint32_t PlatformMetaDevice_externalDeviceType(const std::string& productModel, const std::string& productName);
96 
97 /**
98  * Returns the name of a device which is based on external knowledge.
99  * @param deviceType The device type for which the name will be returned
100  * @return The device name, "Unknown" if unknown
101  */
102 std::string PlatformMetaDevice_externalDeviceName(const uint32_t deviceType);
103 
104 #endif // OCEAN_PLATFORM_META_QUEST_USE_EXTERNAL_DEVICE_NAME
105 
106 } // Quest
107 
108 } // Meta
109 
110 } // Platform
111 
112 } // Ocean
113 
114 #endif // META_OCEAN_PLATFORM_META_QUEST_DEVICE_H
This class implements functions for Meta's Quest devices.
Definition: platform/meta/quest/Device.h:30
DeviceType
Definition of individual device types.
Definition: platform/meta/quest/Device.h:37
@ DT_QUEST_2
Quest device, version 2.
Definition: platform/meta/quest/Device.h:43
@ DT_QUEST_3
Quest device, version 3.
Definition: platform/meta/quest/Device.h:45
@ DT_UNKNOWN
Unknown device.
Definition: platform/meta/quest/Device.h:39
@ DT_QUEST_END
Exclusive end of device types.
Definition: platform/meta/quest/Device.h:52
@ DT_QUEST_3S
Definition: platform/meta/quest/Device.h:47
@ DT_QUEST_PRO
Quest Pro device.
Definition: platform/meta/quest/Device.h:49
@ DT_QUEST
Quest device, version 1.
Definition: platform/meta/quest/Device.h:41
static std::string deviceName(const DeviceType deviceType)
Returns the name of a device.
static constexpr uint32_t invalidQuestDeviceValue_
Definition of an invalid enum value for quest devices.
Definition: platform/meta/quest/Device.h:58
static DeviceType deviceType()
Returns the type of the device.
static std::string deviceName()
Returns the name of the device.
Definition: platform/meta/quest/Device.h:82
std::string PlatformMetaDevice_externalDeviceName(const uint32_t deviceType)
Returns the name of a device which is based on external knowledge.
uint32_t PlatformMetaDevice_externalDeviceType(const std::string &productModel, const std::string &productName)
Returns the type of the device.
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15