LeapDevice.h
Go to the documentation of this file.
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_LEAPDEVICE_H
17 #define SURGSIM_DEVICES_LEAP_LEAPDEVICE_H
18 
19 #include <memory>
20 
23 
24 
25 namespace SurgSim
26 {
27 namespace Devices
28 {
29 
30 class LeapScaffold;
31 
32 SURGSIM_STATIC_REGISTRATION(LeapDevice);
33 
34 enum HandType : SURGSIM_ENUM_TYPE;
35 
66 {
67 public:
70  explicit LeapDevice(const std::string& name);
71 
73 
75  virtual ~LeapDevice();
76 
79  void setHandType(HandType type);
80 
83  HandType getHandType() const;
84 
91  void setUseHmdTrackingMode(bool useHmdTrackingMode);
92 
95  bool isUsingHmdTrackingMode() const;
96 
99  void setProvideImages(bool provideImages);
100 
103  bool isProvidingImages() const;
104 
105  bool initialize() override;
106 
107  bool isInitialized() const override;
108 
109 private:
110  friend class LeapScaffold;
111 
112  bool finalize() override;
113 
114  std::shared_ptr<LeapScaffold> m_scaffold;
115 
116  HandType m_handType;
117 
120 
123 };
124 
125 };
126 };
127 
128 SURGSIM_SERIALIZABLE_ENUM(SurgSim::Devices::HandType, (HANDTYPE_LEFT)(HANDTYPE_RIGHT));
129 
130 #endif //SURGSIM_DEVICES_LEAP_LEAPDEVICE_H
SurgSim::Devices::LeapDevice::m_requestedHmdTrackingMode
DataStructures::OptionalValue< bool > m_requestedHmdTrackingMode
Tracking mode.
Definition: LeapDevice.h:119
SURGSIM_ENUM_TYPE
#define SURGSIM_ENUM_TYPE
Required type of enums used by SURGSIM_SERIALIZABLE_ENUM.
Definition: Accessible.h:261
SurgSim::DataStructures::OptionalValue< bool >
SurgSim::Devices::LeapDevice::m_scaffold
std::shared_ptr< LeapScaffold > m_scaffold
Definition: LeapDevice.h:114
SurgSim::Devices::LeapDevice::isProvidingImages
bool isProvidingImages() const
Get if the device should provide the stereo infrared images.
Definition: LeapDevice.cpp:88
SurgSim::Devices::LeapScaffold
A class that manages Leap devices.
Definition: LeapScaffold.h:41
SurgSim::Devices::LeapDevice::setProvideImages
void setProvideImages(bool provideImages)
Set if the device should provide the stereo infrared images.
Definition: LeapDevice.cpp:82
SurgSim::Devices::LeapDevice::setUseHmdTrackingMode
void setUseHmdTrackingMode(bool useHmdTrackingMode)
Set the hand tracking mode to HMD This is a global setting that optimizes hand tracking based on the ...
Definition: LeapDevice.cpp:61
SurgSim::Devices::LeapDevice::isInitialized
bool isInitialized() const override
Definition: LeapDevice.cpp:121
SurgSim::Devices::LeapDevice::isUsingHmdTrackingMode
bool isUsingHmdTrackingMode() const
Is Using HMD Tracking Mode.
Definition: LeapDevice.cpp:70
OptionalValue.h
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::Input::CommonDevice
A class that implements some common management code on top of the DeviceInterface.
Definition: CommonDevice.h:35
SurgSim::Devices::LeapDevice::m_isProvidingImages
bool m_isProvidingImages
Request Camera Images mode.
Definition: LeapDevice.h:122
CommonDevice.h
SURGSIM_SERIALIZABLE_ENUM
SURGSIM_SERIALIZABLE_ENUM(SurgSim::Devices::HandType,(HANDTYPE_LEFT)(HANDTYPE_RIGHT))
SurgSim::Devices::LeapDevice::initialize
bool initialize() override
Fully initialize the device.
Definition: LeapDevice.cpp:93
SurgSim::Devices::LeapDevice::m_handType
HandType m_handType
Definition: LeapDevice.h:116
SurgSim::Devices::LeapDevice::finalize
bool finalize() override
Finalize (de-initialize) the device.
Definition: LeapDevice.cpp:113
SurgSim::Devices::LeapDevice::setHandType
void setHandType(HandType type)
Set the type of hand.
Definition: LeapDevice.cpp:51
SurgSim::Devices::LeapDevice
A class implementing the communication with one hand tracked by Leap Motion camera.
Definition: LeapDevice.h:65
SurgSim::Devices::LeapDevice::SURGSIM_CLASSNAME
SURGSIM_CLASSNAME(SurgSim::Devices::LeapDevice)
SurgSim::Devices::LeapDevice::~LeapDevice
virtual ~LeapDevice()
Destructor.
Definition: LeapDevice.cpp:43
SurgSim::Devices::LeapDevice::getHandType
HandType getHandType() const
Get the type of hand.
Definition: LeapDevice.cpp:56
SurgSim::Devices::LeapDevice::LeapDevice
LeapDevice(const std::string &name)
Constructor.
Definition: LeapDevice.cpp:31
string
string(TOUPPER ${DEVICE} DEVICE_UPPER_CASE) option(BUILD_DEVICE_$
Definition: CMakeLists.txt:38