Bike-X  0.8
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
OVR_Linux_HMDDevice.h
Go to the documentation of this file.
1 /************************************************************************************
2 
3 Filename : OVR_Linux_HMDDevice.h
4 Content : Linux HMDDevice implementation
5 Created : June 17, 2013
6 Authors : Brant Lewis
7 
8 Copyright : Copyright 2014 Oculus VR, Inc. All Rights reserved.
9 
10 Licensed under the Oculus VR Rift SDK License Version 3.1 (the "License");
11 you may not use the Oculus VR Rift SDK except in compliance with the License,
12 which is provided at the time of installation or download, or which
13 otherwise accompanies this software in either electronic or hard copy form.
14 
15 You may obtain a copy of the License at
16 
17 http://www.oculusvr.com/licenses/LICENSE-3.1
18 
19 Unless required by applicable law or agreed to in writing, the Oculus VR SDK
20 distributed under the License is distributed on an "AS IS" BASIS,
21 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 See the License for the specific language governing permissions and
23 limitations under the License.
24 
25 *************************************************************************************/
26 
27 #ifndef OVR_Linux_HMDDevice_h
28 #define OVR_Linux_HMDDevice_h
29 
31 #include "OVR_Profile.h"
32 
33 namespace OVR { namespace Linux {
34 
35 class HMDDevice;
36 
37 //-------------------------------------------------------------------------------------
38 
39 // HMDDeviceFactory enumerates attached Oculus HMD devices.
40 //
41 // This is currently done by matching monitor device strings.
42 
44 {
45 public:
46  static HMDDeviceFactory &GetInstance();
47 
48  // Enumerates devices, creating and destroying relevant objects in manager.
49  virtual void EnumerateDevices(EnumerateVisitor& visitor);
50 
51 protected:
53 };
54 
55 
57 {
58  friend class HMDDevice;
59 
60 protected:
61  enum
62  {
65  };
68  struct
69  {
70  int X, Y;
71  } Desktop;
72  unsigned int Contents;
73 
78 
79  // TODO: update these to splines.
81  float DistortionK[4];
82 
83  long DisplayId;
84 
85 public:
87  const String& displayDeviceName, long dispId);
89 
90  virtual DeviceCreateDesc* Clone() const
91  {
92  return new HMDDeviceCreateDesc(*this);
93  }
94 
95  virtual DeviceBase* NewDeviceInstance();
96 
97  virtual MatchResult MatchDevice(const DeviceCreateDesc& other,
98  DeviceCreateDesc**) const;
99 
100  // Matches device by path.
101  virtual bool MatchDevice(const String& path);
102 
103  virtual bool UpdateMatchedCandidate(const DeviceCreateDesc&, bool* newDeviceFlag = NULL);
104 
105  virtual bool GetDeviceInfo(DeviceInfo* info) const;
106 
107  void SetScreenParameters(int x, int y,
108  int hres, int vres,
109  float hsize, float vsize,
110  float vCenterFromTopInMeters, float lensSeparationInMeters);
111  void SetDistortion(const float* dks);
112 
113  HmdTypeEnum GetHmdType() const;
114 };
115 
116 
117 //-------------------------------------------------------------------------------------
118 
119 // HMDDevice represents an Oculus HMD device unit. An instance of this class
120 // is typically created from the DeviceManager.
121 // After HMD device is created, we its sensor data can be obtained by
122 // first creating a Sensor object and then wrappig it in SensorFusion.
123 
124 class HMDDevice : public DeviceImpl<OVR::HMDDevice>
125 {
126 public:
127  HMDDevice(HMDDeviceCreateDesc* createDesc);
128  ~HMDDevice();
129 
130  virtual bool Initialize(DeviceBase* parent);
131  virtual void Shutdown();
132 
133  // Requests the currently used default profile. This profile affects the
134  // settings reported by HMDInfo.
135  virtual Profile* GetProfile();
136  virtual const char* GetProfileName();
137  virtual bool SetProfileName(const char* name);
138 
139  // Query associated sensor.
140  virtual OVR::SensorDevice* GetSensor();
141 
142 protected:
144 
145  // User name for the profile used with this device.
148 };
149 
150 
151 }} // namespace OVR::Linux
152 
153 #endif // OVR_Linux_HMDDevice_h
154 
virtual void EnumerateDevices(EnumerateVisitor &visitor)
virtual MatchResult MatchDevice(const DeviceCreateDesc &other, DeviceCreateDesc **) const
#define NULL
Ptr< DeviceCreateDesc > pCreateDesc
virtual DeviceCreateDesc * Clone() const
virtual bool SetProfileName(const char *name)
DeviceManagerImpl * pManager
void SetScreenParameters(int x, int y, int hres, int vres, float hsize, float vsize, float vCenterFromTopInMeters, float lensSeparationInMeters)
HMDDeviceCreateDesc(DeviceFactory *factory, const String &displayDeviceName, long dispId)
HMDDeviceCreateDesc * getDesc() const
virtual bool UpdateMatchedCandidate(const DeviceCreateDesc &, bool *newDeviceFlag=NULL)
virtual const char * GetProfileName()
struct OVR::Linux::HMDDeviceCreateDesc::@37 Desktop
virtual OVR::SensorDevice * GetSensor()
virtual bool Initialize(DeviceBase *parent)
static HMDDeviceFactory & GetInstance()
virtual DeviceBase * NewDeviceInstance()
DeviceManager * getManager() const
virtual Profile * GetProfile()
virtual bool GetDeviceInfo(DeviceInfo *info) const