OSVR-Core
EyeTrackerComponent.h
Go to the documentation of this file.
1 
12 // Copyright 2015 Sensics, Inc.
13 //
14 // Licensed under the Apache License, Version 2.0 (the "License");
15 // you may not use this file except in compliance with the License.
16 // You may obtain a copy of the License at
17 //
18 // http://www.apache.org/licenses/LICENSE-2.0
19 //
20 // Unless required by applicable law or agreed to in writing, software
21 // distributed under the License is distributed on an "AS IS" BASIS,
22 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 // See the License for the specific language governing permissions and
24 // limitations under the License.
25 
26 #ifndef INCLUDED_EyeTrackerComponent_h_GUID_68C4C9C6_84AF_43AC_1392_008C04EFAF0D
27 #define INCLUDED_EyeTrackerComponent_h_GUID_68C4C9C6_84AF_43AC_1392_008C04EFAF0D
28 
29 // Internal Includes
30 #include <osvr/Common/Export.h>
35 
36 // Library/third-party includes
37 #include <vrpn_BaseClass.h>
38 
39 // Standard includes
40 // - none
41 
42 namespace osvr {
43 namespace common {
44 
46  OSVR_ChannelCount sensor;
47  };
48 
49  namespace messages {
50  class EyeRegion : public MessageRegistration<EyeRegion> {
51  public:
53 
54  static const char *identifier();
55  };
56 
57  } // namespace messages
58 
61  public:
66  static OSVR_COMMON_EXPORT shared_ptr<EyeTrackerComponent>
67  create(OSVR_ChannelCount numSensor = 2);
68 
71 
72  OSVR_COMMON_EXPORT void
73  sendNotification(OSVR_ChannelCount sensor,
74  OSVR_TimeValue const &timestamp);
75 
76  typedef std::function<void(OSVR_EyeNotification const &,
77  util::time::TimeValue const &)> EyeHandler;
78  OSVR_COMMON_EXPORT void registerEyeHandler(EyeHandler cb);
79 
80  private:
82  virtual void m_parentSet();
83 
84  static int VRPN_CALLBACK
85  m_handleEyeRegion(void *userdata, vrpn_HANDLERPARAM p);
86 
87  OSVR_ChannelCount m_numSensor;
88  std::vector<EyeHandler> m_cb;
89  bool m_gotOne;
90  };
91 
92 } // namespace common
93 } // namespace osvr
94 
95 #endif // INCLUDED_EyeTrackerComponent_h_GUID_68C4C9C6_84AF_43AC_1392_008C04EFAF0D
uint32_t OSVR_ChannelCount
The integer type specifying a number of channels/sensors or a channel/sensor index.
Definition: ChannelCountC.h:51
Handles spatial transformations.
Definition: SerializationTraitExample_Complicated.h:40
Definition: CommonComponent.h:44
The main namespace for all C++ elements of the framework, internal and external.
Definition: namespace_osvr.dox:3
Definition: DeviceComponent.h:42
CRTP class template wrapping message-specific data and/or logic.
Definition: MessageRegistration.h:44
BaseDevice component.
Definition: EyeTrackerComponent.h:60
Definition: EyeTrackerComponent.h:45
Definition: EyeTrackerComponent.h:50
Standardized, portable parallel to struct timeval for representing both absolute times and time inter...
Definition: TimeValueC.h:81
Definition: EyeTrackerComponent.cpp:39
messages::EyeRegion eyeRegion
Message from server to client, containing eye data.
Definition: EyeTrackerComponent.h:70