LeapDevice.h
Go to the documentation of this file.
// This file is a part of the OpenSurgSim project.
// Copyright 2013-2015, SimQuest Solutions Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef SURGSIM_DEVICES_LEAP_LEAPDEVICE_H
#define SURGSIM_DEVICES_LEAP_LEAPDEVICE_H
#include <memory>
#include "SurgSim/DataStructures/OptionalValue.h"
#include "SurgSim/Input/CommonDevice.h"
namespace SurgSim
{
namespace Devices
{
class LeapScaffold;
SURGSIM_STATIC_REGISTRATION(LeapDevice);
enum HandType : SURGSIM_ENUM_TYPE;
class LeapDevice : public SurgSim::Input::CommonDevice
{
public:
explicit LeapDevice(const std::string& name);
SURGSIM_CLASSNAME(SurgSim::Devices::LeapDevice);
virtual ~LeapDevice();
void setHandType(HandType type);
HandType getHandType() const;
void setUseHmdTrackingMode(bool useHmdTrackingMode);
bool isUsingHmdTrackingMode() const;
void setProvideImages(bool provideImages);
bool isProvidingImages() const;
bool initialize() override;
bool isInitialized() const override;
private:
friend class LeapScaffold;
bool finalize() override;
std::shared_ptr<LeapScaffold> m_scaffold;
HandType m_handType;
DataStructures::OptionalValue<bool> m_requestedHmdTrackingMode;
bool m_isProvidingImages;
};
};
};
SURGSIM_SERIALIZABLE_ENUM(SurgSim::Devices::HandType, (HANDTYPE_LEFT)(HANDTYPE_RIGHT));
#endif //SURGSIM_DEVICES_LEAP_LEAPDEVICE_H
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::Devices::LeapDevice::m_handType
HandType m_handType
Definition: LeapDevice.h:116
SurgSim::Devices::LeapDevice::m_scaffold
std::shared_ptr< LeapScaffold > m_scaffold
Definition: LeapDevice.h:114
SurgSim::Devices::LeapDevice::finalize
bool finalize() override
Finalize (de-initialize) the device.
Definition: LeapDevice.cpp:113
SurgSim::Devices::LeapDevice::LeapDevice
LeapDevice(const std::string &name)
Constructor.
Definition: LeapDevice.cpp:31
SurgSim::Devices::LeapDevice::SURGSIM_CLASSNAME
SURGSIM_CLASSNAME(SurgSim::Devices::LeapDevice)
SurgSim::Devices::LeapDevice::m_requestedHmdTrackingMode
DataStructures::OptionalValue< bool > m_requestedHmdTrackingMode
Tracking mode.
Definition: LeapDevice.h:119
SurgSim::DataStructures::OptionalValue< bool >
SurgSim::Devices::LeapDevice::initialize
bool initialize() override
Fully initialize the device.
Definition: LeapDevice.cpp:93
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
A class implementing the communication with one hand tracked by Leap Motion camera.
Definition: LeapDevice.h:65
SurgSim::Devices::LeapDevice::m_isProvidingImages
bool m_isProvidingImages
Request Camera Images mode.
Definition: LeapDevice.h:122
SurgSim::Devices::LeapScaffold
A class that manages Leap devices.
Definition: LeapScaffold.h:41
SURGSIM_SERIALIZABLE_ENUM
SURGSIM_SERIALIZABLE_ENUM(SurgSim::Devices::HandType,(HANDTYPE_LEFT)(HANDTYPE_RIGHT))
SurgSim::Devices::LeapDevice::isProvidingImages
bool isProvidingImages() const
Get if the device should provide the stereo infrared images.
Definition: LeapDevice.cpp:88
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
SurgSim::Input::CommonDevice
A class that implements some common management code on top of the DeviceInterface.
Definition: CommonDevice.h:35
SurgSim::Devices::LeapDevice::getHandType
HandType getHandType() const
Get the type of hand.
Definition: LeapDevice.cpp:56
SURGSIM_ENUM_TYPE
#define SURGSIM_ENUM_TYPE
Required type of enums used by SURGSIM_SERIALIZABLE_ENUM.
Definition: Accessible.h:261
CommonDevice.h
OptionalValue.h
SurgSim::Devices::LeapDevice::~LeapDevice
virtual ~LeapDevice()
Destructor.
Definition: LeapDevice.cpp:43
SurgSim::Devices::LeapDevice::setHandType
void setHandType(HandType type)
Set the type of hand.
Definition: LeapDevice.cpp:51