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 Pro device.
48 
49  /// Exclusive end of device types.
51  };
52 
53  protected:
54 
55  /// Definition of an invalid enum value for quest devices.
56  static constexpr uint32_t invalidQuestDeviceValue_ = 1024u;
57 
58  public:
59 
60  /**
61  * Returns the type of the device.
62  * @return The device type, DT_UNKNOWN if unknown
63  */
65 
66  /**
67  * Returns the name of the device.
68  * @return The device name, "Unknown" if unknown
69  */
70  static inline std::string deviceName();
71 
72  /**
73  * Returns the name of a device.
74  * @param deviceType The device type for which the name will be returned
75  * @return The device name, "Unknown" if unknown
76  */
77  static std::string deviceName(const DeviceType deviceType);
78 };
79 
80 inline std::string Device::deviceName()
81 {
82  return deviceName(deviceType());
83 }
84 
85 #ifdef OCEAN_PLATFORM_META_QUEST_USE_EXTERNAL_DEVICE_NAME
86 
87 /**
88  * Returns the type of the device.
89  * @param productModel The product model for which the enum type will be returned
90  * @param productName The product name for which the enum type will be returned
91  * @return The device type, DT_UNKNOWN if unknown
92  */
93 uint32_t PlatformMetaDevice_externalDeviceType(const std::string& productModel, const std::string& productName);
94 
95 /**
96  * Returns the name of a device which is based on external knowledge.
97  * @param deviceType The device type for which the name will be returned
98  * @return The device name, "Unknown" if unknown
99  */
100 std::string PlatformMetaDevice_externalDeviceName(const uint32_t deviceType);
101 
102 #endif // OCEAN_PLATFORM_META_QUEST_USE_EXTERNAL_DEVICE_NAME
103 
104 } // Quest
105 
106 } // Meta
107 
108 } // Platform
109 
110 } // Ocean
111 
112 #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:50
@ DT_QUEST_PRO
Quest Pro device.
Definition: platform/meta/quest/Device.h:47
@ 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:56
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:80
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