opensurgsim
LeapScaffold.h
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2013-2015, SimQuest Solutions Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 
16 #ifndef SURGSIM_DEVICES_LEAP_LEAPSCAFFOLD_H
17 #define SURGSIM_DEVICES_LEAP_LEAPSCAFFOLD_H
18 
19 #include <memory>
20 
21 #include "SurgSim/DataStructures/DataGroup.h"
22 #include "SurgSim/Devices/Leap/LeapDevice.h"
23 
24 
25 namespace SurgSim
26 {
27 
28 namespace Framework
29 {
30 class Logger;
31 };
32 
33 namespace Devices
34 {
35 
36 class LeapDevice;
37 
42 {
43 public:
45  virtual ~LeapScaffold();
46 
47 private:
49  struct StateData;
50 
52  struct DeviceData;
53 
55  class Listener;
56 
57  friend class LeapDevice;
58 
60  LeapScaffold();
61 
65  static std::shared_ptr<LeapScaffold> getOrCreateSharedInstance();
66 
70  bool registerDevice(LeapDevice* device);
71 
75  bool unregisterDevice(const LeapDevice* device);
76 
80  bool doRegisterDevice(DeviceData* info);
81 
83  void handleFrame();
84 
86  void handleConnect();
87 
89  void updateHandData();
90 
92  void updateImageData();
93 
95  static DataStructures::DataGroup buildDeviceInputData();
96 
98  std::unique_ptr<StateData> m_state;
99 
102  void setUseHmdTrackingMode(bool useHmdTrackingMode);
103 
106  bool isUsingHmdTrackingMode() const;
107 
109  std::shared_ptr<Framework::Logger> m_logger;
110 };
111 
112 }; // namespace Devices
113 }; // namespace SurgSim
114 
115 #endif // SURGSIM_DEVICES_LEAP_LEAPSCAFFOLD_H
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
Definition: LeapScaffold.cpp:136
A class implementing the communication with one hand tracked by Leap Motion camera.
Definition: LeapDevice.h:65
A class that manages Leap devices.
Definition: LeapScaffold.h:41
A collection of NamedData objects.
Definition: DataGroup.h:68
Definition: LeapScaffold.cpp:83
Definition: LeapScaffold.cpp:121